Tag: windows runtime

为什么HttpClient似乎在这里死锁?

我有一个在便携式类库中制作的API,需要使用特定于平台的API来发送HTTP请求。 这是我写的在WinRT上执行HTTP POST的方法: public bool Post(IEnumerable<KeyValuePair> headers, string data) { bool success = false; HttpClient client = new HttpClient(new HttpClientHandler {AllowAutoRedirect = false}); foreach (var header in headers) { client.DefaultRequestHeaders.Add(header.Key, header.Value); } try { var task=client.PostAsync(endpoint, new StringContent(data, Encoding.UTF8, “text/xml”)).ContinueWith( postTask => { try { postTask.Wait(client.Timeout); //Don’t wait longer than the client timeout. success = […]

WinRT – ScrollViewer中的多个WebView

我里面有一个ScrollViewer和WebViews。 … 所有WebView的高度都等于其内容(我为webView实现了类似WrapContent的东西)。 现在,问题是,webviews是弹跳(橡皮筋效果),而滚动和滚动查看器不滚动! 有时它的卷轴有时不是。 所以我的问题是如何禁用WebView的滚动/弹跳(橡皮筋效果)?

你如何以编程方式滚动到WinRT中TextBox的底部?

我正在为WinRT编写一个简单的应用程序,我无法找到一种方法来自动滚动到我的代码中TextBox的底部。 我正在将日志信息写入TextBox并希望它滚动以便最新条目在框中可见,但似乎没有任何效果。 以下是我尝试过的一些事情: 将TextBox放在ScrollViewer中: this.txtLog.Text = this.txtLog.Text + line + “\r\n”; ScrollToVerticallOffset(scrollView.ScrollableHeight); 选择TextBox中的最后一个数据: this.txtLog.Select(this.txtLog.Text.Length, 0); 但实际上我没有做任何事情导致显示的文本滚动,以便底部数据可见。 有没有人有任何想法?

在Windows Phone 8中获取UI调度程序

我一直在开发一个消耗Windows运行时组件(WRC)的Windows Phone应用程序。由非UI线程访问的function需要使用访问Windows Phone应用程序的回调。 void WControlPointCallback::OnListChange(char *pFriendlyName) { // Callback function to access the UI pCallBack->AlertCaller(“Message”); } 最初没有使用Dispatcher它扔了 Platform::AccessDeniedException 。 然后我提到了这个 , 这个和这个 。 我试图从UI获取Dispatcher。 var dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher; 它抛出了System.AccessViolationException 。然后我用了 pDispatcher = Windows::UI::Core::CoreWindow::GetForCurrentThread()->Dispatcher; 在C ++代码(WRC)中。但是这也抛出了Platform::AccessDeniedException 。 如何在Windows Phone中获取Dispatcher for UI?

使用FileIO.ReadTextAsync从文件中读取文本时出现exception

尝试使用时读取locl文本文件时出现以下exception var text = await FileIO.ReadTextAsync(file); 与此oplock关联的句柄已关闭。 oplock现在坏了。 (HRESULTexception:0x80070323) 这发生在一个回归unit testing中,它也会在应用程序中不时发生。 应用是XAML + C# 可能导致它的任何想法?!

如何让SQLite在Windows 10上运行?

哟, 所以我一直在一台机器上开发Visual Studio 2013中的通用Windowsapp store应用,并希望继续在运行Windows 10 Technical Preview的另一台机器上开发它。 问题是在Visual Studio 2015 Preview中有一个新的C ++ Redistributable包版本(2015),而最新的SQLite需要版本2013,因此缺少特定的引用。 我可以构建项目,它成功部署,但有一个例外,说它无法加载sqlite3.dll。 我假设这是因为缺少Visual C ++ Redistributable Package 2013.我尝试下载它,但是在Extensions下的Add reference对话框中仍然缺少该条目,在VS 2013上可以看到它。 任何让它工作的经验? 关于SQLite何时适用于Windows 10的任何内幕消息? 干杯

代码隐藏中的WinRT / Metro动画

以下代码在Silverlight中正常工作: private void Button_Click_1(object sender, RoutedEventArgs e) { Storyboard storyboard = new Storyboard(); DoubleAnimation doubleAnimation = new DoubleAnimation(); doubleAnimation.From = 50; doubleAnimation.To = 100; doubleAnimation.RepeatBehavior = RepeatBehavior.Forever; doubleAnimation.AutoReverse = true; doubleAnimation.Duration = new Duration(TimeSpan.FromMilliseconds(200)); storyboard.Children.Add(doubleAnimation); Storyboard.SetTarget(doubleAnimation, button1); Storyboard.SetTargetProperty(doubleAnimation, new PropertyPath(“Width”)); storyboard.Begin(); } 在WinRT / Metro中,它需要一个小的改动才能编译: Storyboard.SetTargetProperty(doubleAnimation, “Width”); 但是当你运行它时,没有任何反应。 如果您将属性从“宽度”更改为“不透明度”(也可以更改从= 0和To = 1)。 “宽度”有什么问题?

在Windows Phone 8.1上检测webview中的保持事件

我目前正在开发一款主要针对Windows Phone 8.1中的win rt的网络浏览器应用。 我现在试图找出当用户在webview中按下链接或图像并显示上下文菜单时如何检测保持事件。 我该怎么做呢? 我如何在wp8.1中检测到该事件? 我知道我必须调用脚本,但是检测事件的c#是什么? 谢谢 :)

如何在WinRT(C#和XAML中的Metro应用程序)中序列化和deserliaze Dictionary ?

我一直试图解决这个愚蠢的问题几天了,它正在努力。我会很高兴有人有一个有效的例子,因为我到目前为止发现的那些没有用:(我可以序列化基本类型,但不是对象。我对DataContractAttribute等非常困惑。我得到的错误是: {“类型’SerializeListWinRT.DataModel.LocalStorage + Cat’与数据合同名称’LocalStorage.Cat:http://schemas.datacontract.org/2004/07/SerializeListWinRT.DataModel’不是预期的。考虑使用DataContractResolver或添加任何静态地知道已知类型列表的类型 – 例如,通过使用KnownTypeAttribute属性或将它们添加到传递给DataContractSerializer的已知类型列表中。“} using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Storage; using System.IO; using System.Runtime.Serialization; using Windows.Storage.Streams; namespace SerializeListWinRT.DataModel { class LocalStorage { [DataContractAttribute] public class Cat { [DataMember()] public String Name { get; set; } } static private Dictionary _data = new Dictionary(); private const string filename […]

从Windows RT应用程序中的文件读取

可能重复: 如何逐行读取文本文件? 我试图在C#中逐行读取文件。 这是我的代码 String filename = “apoel.txt”; System.IO.StreamReader file = new System.IO.StreamReader(filename); 我按照MSDN页面上的说明进行操作,然后完全按照它们进 问题是我一直在收到错误 System.IO.StreamReader.StreamReader(System.IO.Stream)’的最佳重载方法匹配有一些无效的参数 参数1:无法从’string’转换为’System.IO.Stream’ 我添加了using System.IO ; 在我的代码顶部 我究竟做错了什么? 如果它有任何帮助,这是一个Windows Metro应用程序 也有人可以向我解释为什么我发布的MSDN上的文章是错误的并且不起作用? 请不要给我另类。 请告诉我为什么我的代码在MSDN中解释时没有工作