Tag: win universal app

UWP模态窗口

我想在我的通用Windows平台应用程序(C#)中在屏幕上显示一个模态窗口,就像添加帐户时标准的Mail-app一样。 或者当您在应用程序中登录服务(如Facebook)时。 带模态窗口的Windows邮件应用程序: 你可以移动这个窗口,但它不在任务栏中,而且是模态的。 有谁知道如何做到这一点? 它不应该那么难,但我找不到任何关于它的东西。

UWP与uwp中的FindAncestor等效

我有一个订单列表,当订单状态为Canceled时 ,我想要闪烁文本。 到目前为止,我的代码工作。 但是, 有时会抛出exception: WinRT信息:无法解析TargetName lblOrderStatus 由于某种原因,可以找到lblOrderStatus 。 所以,我想使用“FindAncestor”,但UWP中不存在FindAncestor。 在uwp中是否有与FindAncestor等效的function? 这是我的代码: … … … … … …

如何在Windows.Web.Http.HttpClient上停止凭据缓存?

我遇到一个问题,即应用程序尝试使用不同的身份validation方法从同一服务器访问资源,这两种方法是: 证书(NTLM,基础等) OAuth(持票人) 设置HttpBaseProtocolFilter HttpBaseProtocolFilter设置为: 禁用缓存 禁用自动UI凭据请求弹出窗口 码 HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter(); filter.CacheControl.WriteBehavior = HttpCacheWriteBehavior.NoCache; filter.CacheControl.ReadBehavior = HttpCacheReadBehavior.MostRecent; filter.AllowUI = false; 添加服务器凭据 如果资源需要凭证,那么我使用: filter.ServerCredential = new PasswordCredential( RequestUri.ToString(), UserName, Password); HttpClient httpClient = new HttpClient(filter); 添加OAuth令牌 如果资源需要Bearer令牌,我使用: HttpClient httpClient = new HttpClient(filter); httpClient.DefaultRequestHeaders.Authorization = new HttpCredentialsHeaderValue(“Bearer”, token); ServerCredential为null filter.ServerCredential = null 从服务器获得响应 using(httpClient) { […]

如何在Windows Phone 8.1中显示全屏Modal ContentDialog

当用户尝试登录我的应用程序时,我正在显示包含一些TextBlocks和ProgressBar的ContentDialog。 我选择ContentDialog是因为它是模态的并阻止用户,直到应用程序收集所需信息并准备导航到下一页。 以下链接显示可用于Windows Phone 8.1(通用应用程序)的内容对话框类。 下面的代码显示了我编写的用于显示ContentDialog的代码隐藏(我暂时将其放在OnNavigatedTo中进行测试,稍后将其移至适当的通知function) //Progress Bar ProgressBar bar = new ProgressBar(); bar.IsIndeterminate = true; //Downloading Data text TextBlock txt = new TextBlock(); txt.Text = “Downloading data…”; txt.FontSize = 17; txt.Foreground = new SolidColorBrush(Colors.White); txt.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; //This could take a few seconds TextBlock txt2 = new TextBlock(); txt2.Text = “This could take a […]

无法加载文件或程序集’Newtonsoft.Json,Version = 9.0.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed’或其中一个依赖项

我有一个以前在Windows 8.1上使用VS 2013构建的WinJS项目。 最近我通过创建一个空白的Javascript Universal Windows 10项目将该项目升级到Universal Windows 10,然后从旧项目添加了我的所有文件。 我有Windows运行时组件和SQLite的类库。 我添加了通用Windows运行时组件和通用类库,并将我的所有文件从旧项目复制到相应的位置。 不知何故,我设法删除所有构建错误。 我安装了所有必需的SQLite-net,SQLite for Universal Windows Platform,Newtonsoft等。 但是当我运行应用程序并在Windows运行时组件中调用Native方法时,它会产生一些奇怪的错误: An exception of type ‘System.IO.FileNotFoundException’ occurred in mscorlib.ni.dll but was not handled in user code. Additional information: Could not load file or assembly ‘Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed’ or one of its dependencies. The system cannot find the […]

UWP Apps中的模拟框架

我试图为Unittest我的UWP应用找到一个好的模拟框架,似乎所有好的Mocking基础设施(MOQ,RhinoMocks等)都可以理解地依赖于UWP不支持的动态代理。 看起来MOQ知道这个限制: https : //github.com/Moq/moq4/issues/195 在这种情况下,微软的帮助不大: https : //social.msdn.microsoft.com/Forums/en-US/652b9d16-c4ab-401c-9239-0af01108e460/uwp-is-there-any-indication-that-窗口-10- UWP的通用的应用程序意志支持码发射?论坛= wpdevelop 是否有任何Mocking基础设施用于unit testingUWP应用程序? 或者任何想法,如果动态代理支持即将在不久的将来为UWP提供? 谢谢!

使用POST方法在通用应用程序中发送登录数据

我正在使用Windowsapp store,我正在尝试发送登录名和密码值,这是我的代码: try { string user = login.Text; string pass = password.Password; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = “login=” + user + “&mdp=” + pass; byte[] data = encoding.GetBytes(postData); WebRequest request = WebRequest.Create(“myURL/login.php”); request.Method = “POST”; request.ContentType = “application/x-www-form-urlencoded”; request.ContentLength = data.Length; Stream stream = request.GetRequestStream(); stream.Write(data, 0, data.Length); stream.Dispose(); WebResponse response = […]

如何在Windows IoT中记录事件?

用于Windows IoT的WebUI(如Raspberry PI上所示)具有以下事件跟踪屏幕: 如何从uwp程序写入事件日志,然后检查那里写的是什么? 这个答案 (与Windows IoT无关)表明您需要使用标准的System.Diagnostics.Tracing类。 此答案所指的示例是演示记录到文件 。 在登录到内置设施(例如ETW)之后,我更加了。 遵循与示例中类似的逻辑我正在执行EventSource.Write并且它不会抛出错误,但是无处可见书面消息。 用于Window IoT的Windows Powershell也不支持Get-EventLog命令。 Windows IoT开发相对较新,因此互联网上没有太多信息。 目前最好的来源是Ms Iot Samples,但尽管样本量很大,但似乎没有任何事件记录。

UWP中的itemscontrol不绑定到observablecollection项的坐标

我的代码不绑定到可观察集合中项目的X和Y属性。 怎么了: 它确实绑定到Color和FillColor。 这是Shape类,它存储在ObservableCollection LED中: class Shape { public int X { get; private set; } public int Y { get; private set; } public string Color { get; private set; } public string FillColor { get; private set; } public Shape (int x, int y, string color, string fillColor) { X = x; Y […]

Windows UWP在发现后连接到BLE设备

我正在使用BluetoothLEAdvertisementWatcher查找附近的BLE设备,它运行良好。 找到它们后,我想通过GATT连接和读/写数据。 但在获取BluetoothLEAdvertisement后,我无法弄清楚如何使用API​​( https://msdn.microsoft.com/de-de/library/windows/apps/windows.devices.bluetooth.genericattributeprofile )。 public class Adapter { private readonly BluetoothLEAdvertisementWatcher _bleWatcher = new BluetoothLEAdvertisementWatcher(); public Adapter() { _bleWatcher.Received += BleWatcherOnReceived; } private void BleWatcherOnReceived(BluetoothLEAdvertisementWatcher sender, BluetoothLEAdvertisementReceivedEventArgs args) { // how to connect? // I know, it’s the wrong place to to this, but this is just an example } public void StartScanningForDevices(Guid[] serviceUuids) […]