windows-runtime

Correct use of UDP DatagramSocket

拥有回忆 提交于 2020-01-04 05:23:10
问题 I have the following code (snips provided below) in my base class for handling a UDP socket. I am adding support for WinRT (controlled by the #define for WINRT). I have everything working for .Net, but something is going wrong with my WinRT implementation. When I send the data, it is not being received on the server side. Any idea what is going wrong? I don't see any errors on the client side, just nothing shows up on the server. I have successfully gotten my TCP socket class working, using

SignalR Unexpected character encountered while parsing value: <

末鹿安然 提交于 2020-01-04 04:38:05
问题 I am using a WinRT client. I receive this exception when I try to send a message. Unexpected character encountered while parsing value: <. The problem occurs when you send an object to the hub, and the object is not defined on the hub. The object is a Bindable object (ViewModel). I don't want to include all the property notify change stuff on the web project. Client Code return Proxy.Invoke("PlayerUpdate", sessionData); Try one was to have the hub accept an 'object' parameter public async

How can I open a file I've added to my Windows Store App project programatically?

﹥>﹥吖頭↗ 提交于 2020-01-04 02:32:51
问题 I want to load a PDF file in response to a Tapped event. I added the file to my project (Add > Existing Item), set "Build Action" to "Content" and "Copy to Output Directory" to "Copy if newer" I'm thinking the code I need may be something like this: async Task LoadTutorial() { await Launcher.LaunchUriAsync(new Uri("what should be here to access the output folder?")); } If I'm right, what do I need to pass as the Uri? Otherwise, how is this accomplished? UPDATE On a related note, to add an

Replacing or recreating a file in Windows 8 RT keeps the old DateCreated value

时光怂恿深爱的人放手 提交于 2020-01-03 19:06:17
问题 I'm attempting to cache data in a file for a Windows Store app, and using the DateCreated value to determine if it is out of date. I first tried doing this: var file = await rootFolder.CreateFileAsync(filename, Windows.Storage.CreationCollisionOption.ReplaceExisting); FileIO.WriteTextAsync(file, contents); but when it saves the file only the DateModified value is changed, even though the comments for the ReplaceExisting option clearly state that it recreates the file and replaces an existing

DataTriggerBehavior Doesn't Work With Enum?

落花浮王杯 提交于 2020-01-03 16:01:47
问题 I'm trying to use a DataTriggerBehavior from the Behaviors SDK. But it doesn't seem to work with enums... or else I'm doing something wrong. You can assume that the DataContext for these examples is something like this ( INotifyPropertyChanged is implemented, but I'm not going to show it here): public class MyDataClass { public MyEnum ItemCommand { get; set; } public string ItemCommandString { get; set; } } public enum MyEnum { EnumValue1 } _Button.DataContext = new MyDataClass() {

DataTriggerBehavior Doesn't Work With Enum?

点点圈 提交于 2020-01-03 16:01:12
问题 I'm trying to use a DataTriggerBehavior from the Behaviors SDK. But it doesn't seem to work with enums... or else I'm doing something wrong. You can assume that the DataContext for these examples is something like this ( INotifyPropertyChanged is implemented, but I'm not going to show it here): public class MyDataClass { public MyEnum ItemCommand { get; set; } public string ItemCommandString { get; set; } } public enum MyEnum { EnumValue1 } _Button.DataContext = new MyDataClass() {

XMPP Libraries for Metro Apps in WinRT [closed]

烂漫一生 提交于 2020-01-03 13:36:53
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . Could you please list down some XMPP Libraries which supports for Metro Apps in WinRT? Thanks! 回答1: MatriX is available for WinRT

How to pre-select multiple listview/gridview items in C#/XAML windows 8 app?

雨燕双飞 提交于 2020-01-03 08:48:09
问题 in my app there is gridview of my custom class. I am using custom data template and values are bound from SQLite. Now when user launch the app, the certain items (NOT SINGLE) should be pre-selected in gridview/listview. Gridview/listview allows multiple selection. How can I achieve this with SelectedItem property ? UPDATE : I have followed this, it doesn't work for me. Returns 0 selections. UPDATE 2 : I have posted the code void MainPage_Loaded(object sender, RoutedEventArgs e) { using (var

How to programmatically maximize a window using LaunchUriAsync in Windows 8?

时光怂恿深爱的人放手 提交于 2020-01-03 05:47:20
问题 How do I maximize/minimize launching/current windows store applications programmatically using LaunchUriAsync in Windows 8? private async void Button_Click(object sender, RoutedEventArgs e) { var options = new Windows.System.LauncherOptions(); options.TreatAsUntrusted = false; options.DisplayApplicationPicker = false; Uri target = new Uri("ms-mail:"); bool isSucceed = await Windows.System.Launcher.LaunchUriAsync(target, options); } 回答1: There isn't a way to do this in Windows 8, but Windows 8

In metro, get all inherited classes of an (abstract) class?

。_饼干妹妹 提交于 2020-01-03 04:20:10
问题 I got stuck when trying to get all inherited classes in metro. The WinRT API is different from .net framework, so both the solutions (solution1 and solution2) don't work. Any code or tool solution is appreciated. I'm still trying. I will put my solution here if success. 回答1: This should work (based on the code from here): public IEnumerable<T> GetEnumerableOfType<T>(params object[] constructorArgs) where T : class, IComparable<T> { List<T> objects = new List<T>(); foreach (Type type in typeof