Tag: uwp

Azure Notification Hubs包是否与.NET Core兼容?

我正在使用.NET核心应用程序,我发现一些Azure软件包不兼容,例如NotificationHubs和SendGrid : Package Microsoft.Azure.NotificationHubs 1.0.5 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0) The dependency SendGrid.CSharp.HTTP.Client 2.0.4 does not support framework .NETCoreApp, Version=v1.0 我只尝试添加NotificationHubs和SendGrid。 我还没有尝试过任何ActiveDirectory包。 有没有人知道其中一些软件包是否会很快兼容? 或者也许我做错了什么? 或者,在.NET核心应用程序中是否有一种方法可以引用较旧的包? 谢谢!

vstest.console.exe可以在没有安全证书的情况下运行appx

我正在尝试在命令行上使用MSBuild在我的构建代理上设置自动构建。 我目前关注的两个项目是UWP,它是相关的unit testing项目。 要构建,我必须使用这个: /p:AppxPackageSigningEnabled=false 否则,我收到此错误: error APPX0101: A signing key is required in order to package this project. Please specify a PackageCertificateKeyFile or PackageCertificateThumbprint value in the project file. 但是,这不会生成.cer安全证书。 所以当我运行vstest.console.exe时,我收到此错误: error 0x800B0100: The app package must be digitally signed for signature validation.. 问题:可以使vstest.console.exe在没有.cer的情况下运行,如果没有,我怎样才能构建所有内容并运行我的测试? 我不希望开发人员使用临时的.pfx文件。

如何在通用Windows应用程序中绑定模板内的空值?

在你回答之前,看看这篇文章 。 首先得到答案可能会解决以下问题。 这是一个刚刚开始使用Windows 10(Universal Apps)的问题。 在Windows 8.1和其他所有XAML技术中,这种技术完美无瑕。 这是空白通用应用程序项目中的设置: 1.具有附加属性的静态类 创建一个包含Brush类型的附加属性的类。 把它放在项目的任何地方。 public static class MySettings { public static Brush GetAccentBrush(DependencyObject d) { return (Brush)d.GetValue(AccentBrushProperty); } public static void SetAccentBrush(DependencyObject d, Brush value) { d.SetValue(AccentBrushProperty, value); } public static readonly DependencyProperty AccentBrushProperty = DependencyProperty.RegisterAttached( “AccentBrush”, typeof(Brush), typeof(MySettings), null ); } 2.使用附加属性将控件添加到MainPage.xaml 在主页面中,添加一个ContentControl其中包含一个自定义模板,该模板的背景颜色设置为重点画笔。 重点画笔以风格设置。 如果您现在运行该应用程序,它将显示绿色背景。 一切正常。 […]

UWP,XAML – 使CheckBox为空

如何让CheckBox为空? 我只需要打勾。 现在它需要额外的空白空间,就像这里: (我添加了颜色以查看此控件占用多少空间(空白空间导致所有问题))。 我只需要刻度矩形,我不想要空的空间。 我怎样才能做到这一点? 将保证金设置为零并将内容设置为“”不起作用。

如何在Windows Universal App中使用双工wcf服务

如何在Windows通用应用程序中使用双工合约使用wcf服务? 我正在使用PlatformNotSupportedExcetpion: Operation is not supported on this platform. 尝试在Windows Universal App中使用双面wcf服务时出现运行时exception,目标是Windows 10(10.0; Build 10240) 根据msdn,它支持API。 如果不可能,我应该如何进行我的方案? 我有两个应用程序(控制台和Windows通用xaml应用程序)在同一台机器上运行,我需要双向通信。 我有创建服务主机的clasic .net 4.6控制台应用程序: var host = new ServiceHost(typeof(MyService), new Uri(“net.tcp://localhost:8008/MyService”)); var binding = new NetTcpBinding(); //I’ve also tried net http binding binding.Security.Mode = SecurityMode.None; host.Description.Behaviors.Add(new ServiceMetadataBehavior()); host.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexTcpBinding(), “mex”); host.AddServiceEndpoint(typeof(IMyService), binding, “”); host.Open(); 服务合约: [ServiceContract(CallbackContract = typeof(IMyServiceCallback))] […]

无法在UWP应用程序中获取某些用户帐户信息 – 内部部署活动目录(非Azure AD)

在UWP应用程序中,我启用了User Account Informationfunction。 我需要获取当前登录用户的用户名和域名(每个用户名单独)(用户使用内部部署的Active Directory帐户登录 – 非Azure AD )。 例如,用户将使用用户名user1登录到Active Directory域domain1 。 即domain1\user1 。 我使用以下代码来尝试获取所需的详细信息: IReadOnlyList users = await User.FindAllAsync(); var user = users.FirstOrDefault(); // get domain var data1 = await user.GetPropertyAsync(KnownUserProperties.DomainName); string strDomainName = (string)data1; // get username var data2 = await user.GetPropertyAsync(KnownUserProperties.AccountName); string strUserName = (string)data2; 问题: strDomainName返回domain1.com\user1 。 为什么这包括我们所有域名的.com部分? 在c#winforms应用程序中,我们可以轻松获取domain1\user1而没有任何问题。 strUserName返回一个空字符串。 即“”。 […]

在没有测试整个应用程序的情况下,有没有办法让UnitTest成为类库(通用Windows)?

我需要UnitTest一个Class Library (Universal Windows) ,但是从“添加新项目”窗口,我只看到这个: 该项目使用App Container运行所有测试,它始终打开一个App。 由于我不需要所有这些开销,我想知道是否有unit testingUWP库的方法。

等待Task.CompletedTask什么?

我使用在Build2017中引入的Windows Template Studio创建了UWP应用程序。 下面的类是它生成的代码的一部分。 public class SampleModelService { public async Task<IEnumerable> GetDataAsync() { await Task.CompletedTask; // <– what is this for? var data = new List(); data.Add(new SampleModel { Title = “Lorem ipsum dolor sit 1”, Description = “Lorem ipsum dolor sit amet”, Symbol = Symbol.Globe }); data.Add(new SampleModel { Title = “Lorem ipsum dolor […]

如何在StackPanel或ListView中叠加项目?

我正在制作一个纸牌游戏,我想在玩家的手中显示半张相互覆盖的牌。 如何使用ListView或StackPanel执行此操作? 这是一个如何显示玩家手牌的示例。 UPDATE 我为ListView的ItemContainerStyle设置了边距并且它有效,但我有另一个问题。 ListView项目的宽度不适合图像,并且有一些间距。 我该如何删除它。 请参阅XAML代码下方的图像。

如何在Windows 10 UWP中基于HTML内容调整Webview高度?

我目前正在使用Windows 10 UWP App并面临WebView的问题,当我的HTML内容较少时,我在javascript中获得更多高度。 我的守则如下 WebView webView = new WebView() { IsHitTestVisible = true }; string notifyJS = @” function setupBrowser(){ document.touchmove=function(){return false;};; document.onmousemove=function(){return false;}; document.onselectstart=function(){return false;}; document.ondragstart=function(){return false;} window.external.notify(‘ContentHeight:’+document.body.firstChild.offsetHeight); //window.external.notify(‘ContentHeight:’+document.getElementById(‘pageWrapper’).offsetHeight); var links = document.getElementsByTagName(‘a’); for(var i=0;i<links.length;i++) { links[i].onclick = function() { window.external.notify(this.href); return false; } } } “; string htmlContent; if (hexcolor != null) […]