windows-runtime

How to check if file exists in StorageFolder in WinRT [duplicate]

泪湿孤枕 提交于 2019-12-22 10:54:51
问题 This question already has answers here : Closed 6 years ago . Possible Duplicate: Check if a file exists in the project in WinRT I'm using the StorageFolder and need to check if a file exists befor I read it to avoid a exception. my code looks like this: StorageFolder storageFolder = ApplicationData.Current.LocalFolder; StorageFile sampleFile = await storageFolder.GetFileAsync(myPath); the problem is, I can't find a method which checks if a file exist 回答1: Last time I checked you had to catch

Windows 8.1 how to automatically wrap grid items?

亡梦爱人 提交于 2019-12-22 10:43:43
问题 I'm building a universal app and my Win8.1 app has to show a grid of items. Normally the grid consists of 3 columns, but on smaller screens I want the items to wrap so that there are only 2 columns (or even 1). This is my code: <GridView ItemsSource="{Binding Regions}" IsItemClickEnabled="True"> <GridView.ItemsPanel> <ItemsPanelTemplate> <ItemsWrapGrid Orientation="Horizontal" MaximumRowsOrColumns="3" MinWidth="400" /> </ItemsPanelTemplate> </GridView.ItemsPanel> <GridView.ItemTemplate>

Exception thrown when WebAuthenticationBroker receives an OAuth2 callback

天大地大妈咪最大 提交于 2019-12-22 10:39:08
问题 The WebAuthenticationBroker doesn't seem to be able to handle navigation to my ms-app:// . Just throws this ugly error as you will see below. Steps Call AuthenticateAsync() , including callback uri obtained at runtime: WebAuthenticationBroker.GetCurrentApplicationCallbackUri() Go through authorize process, hit Allow . Instead of returning, the broker shows the page Can't connect to service. We can't connect to the service you need right now. Unable to do anything, so I hit the Back button

Catch an async lambda exception

ε祈祈猫儿з 提交于 2019-12-22 10:22:40
问题 I am working on Windows 8 (using C#) and when using the async keyword there's a scenario where i can't seem to handle exceptions well. The scenario involves launching an async lambda, posting it to run on the UI thread. Exceptions that occur during the execution of the lambda code gets re-thrown on the calling thread, with no ability to catch them properly. Example: this block of code is executed on some worker thread, and tries to schedule work on the UI thread: await Window.Current

UWP/WinRT: How to save and then restore a simple TextBox for resume from termination?

痞子三分冷 提交于 2019-12-22 09:47:52
问题 In this document describing the lifecycle of a Windows 10 UWP app, it states: Users now expect your app to remember its state as they multitask on their device. For example, they expect the page to be scrolled to the same position and all of the controls to be in the same state as before. By understanding the application lifecycle of launching, suspending, and resuming, you can provide this kind of seamless behavior. However, there doesn't appear to be much documentation on how this is

Vs update result in System.TypeLoadException

我怕爱的太早我们不能终老 提交于 2019-12-22 09:38:56
问题 I am developping a windows phone 8.1 sdk When I use vs 2013 update 3,the code works and i can run my demo. but,yesterday, I update my vs 2013 to update 4,then throw a System.TypeLoadException code details below: var swapChainPanel = new SwapChainPanel(); Children.Add(swapChainPanel); var res = new CXMapResource("", ""); cxEngine = new CXMapEngine(res); Type CXMapResource is a windows runtime component type written by c++ and it is the first winrt type I load in my code I set a break point

How to animate TextBlock when its value changes in WinRT XAML?

主宰稳场 提交于 2019-12-22 09:25:49
问题 I have the following Storyboard <Storyboard x:Name="DeleteStoryboard"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="StatusTextBlock"> <EasingDoubleKeyFrame KeyTime="0" Value="1"/> <EasingDoubleKeyFrame KeyTime="0:0:4" Value="1"/> <EasingDoubleKeyFrame KeyTime="0:0:5" Value="0"/> </DoubleAnimationUsingKeyFrames> </Storyboard> and the following TextBlock <TextBlock x:Name="StatusTextBlock" Text="{Binding Status}"> Both are in

How to keep the custom Settings Charm flyout open programmatically?

喜欢而已 提交于 2019-12-22 09:19:03
问题 I have created a custom AlarmSettingsPane in the settings charm which allows the user to give the time and also choose the audio file for alarm tone. So i implemented the file picker in the settings charm.When i click the file picker button it takes me to a new full screen where i get to pick my files, but when i select a file and open it, am directed to my home screen but the settings charm flyout gets closed. How can i preserve the state of the AlarmSettingsPane flyout and prevent it from

ScrollViewer in Windows 8: always show vertical scrollbar

匆匆过客 提交于 2019-12-22 08:37:03
问题 How always show vertical scrollbar in the scrollviewer? It disappear in few seconds, but I want to make scroll visible all the time when scrolling is available Thanks for any help 回答1: I think there might be a bug in the control in Windows 8 Consumer Preview, since the following should normally work: <ScrollViewer Style="{StaticResource VerticalScrollViewerStyle}" VerticalScrollBarVisibility="Visible" Template="{StaticResource ScrollViewerControlTemplate1}"> As a workaround you can modify the

Multiple MessageDialog app crash

£可爱£侵袭症+ 提交于 2019-12-22 08:29:27
问题 I use MessageDialogues at several places over my app. Problem is, whenever is any MessageDialog (or system alert, such as capability warning) active and another my MessageDialog is called, application crashes without exception or with UnathorizedAccessException . This is, how I call MessageDialog: CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { MessageDialog msg2 = new MessageDialog(_resourceLoader.GetString("MsgGPSUnavailable")); msg2.ShowAsync(