uwp

“finally” not executed because of Async in “try”?

北城以北 提交于 2019-12-25 19:04:03
问题 I have a bool ( b ) which appears only twice in my code (besides its declaration): try { b = true; //code including await SomeAsync(); } catch { } finally { b = false; } yet sometimes the try block is started with b being true (- before b = true ) which should never be happening because the declaration leaves it false , as does the previous finally . At some point, this code is executed in a loop, which in some cases is iterating quickly and SomeAsync() is trying to use too much memory. I

Toasted notifications action button is not working on lock screen

試著忘記壹切 提交于 2019-12-25 18:48:36
问题 I am building music player in uwp. Action buttons on the toasted notification are working fine when windows are unlocked. when i locked the screen and click on action button then nothing is happening. Application is going to pause state, no break points are getting hit. How can i make my application to run even when windows is locked to receive events from app? Another problem I am facing is when user clicks on next, previous buttons notification screen goes away. How can i keep the Toasted

How to sync ui to full screen or compact mode using MediaPlayerElement

会有一股神秘感。 提交于 2019-12-25 18:43:51
问题 I'm using MediaPlayerElement , when my app window in normal size, I have a Button and a TextBox on the MediaPlayerElement . But when I click fullscreen or compact button to enter fullscreen or compact mode, they disappeared. How to show them in full screen or compact mode? A helpfull repo is here, sync the TextBox to fullscreen. 回答1: For your requirement, you could custom your MediaTransportControls and found ControlPanel_ControlPanelVisibilityStates_Border in the style. Then add your element

Display image depending on application theme

元气小坏坏 提交于 2019-12-25 18:25:01
问题 I am develop an UWP app, and I am using Template 10. I have a black image and a white image. I want when the user choose dark theme, show the white image, and when the user choose light theme show the black image, exemple: if(dark theme) { white image; } else { black image; } 回答1: You can get current RequestedTheme using this.RequestedTheme and then compare it with ElementTheme.Light or ElementTheme.Dark Method 1 if (this.RequestedTheme == ElementTheme.Light) BackgroundImage.Source = new

Bind a List property of an object to a ListView

半腔热情 提交于 2019-12-25 17:46:24
问题 I try to work with the openweathermap api (5 days forecast). I've generated the json to C# code which looks like this: [DataContract] public class Main { [DataMember] public double temp { get; set; } [DataMember] public double temp_min { get; set; } [DataMember] public double temp_max { get; set; } [DataMember] public double pressure { get; set; } [DataMember] public double sea_level { get; set; } [DataMember] public double grnd_level { get; set; } [DataMember] public int humidity { get; set;

AudioGraph throws XAUDIO2_E_INVALID_CALL on second frame input node

久未见 提交于 2019-12-25 16:56:50
问题 I'm attempting to use the AudioGraph API of UWP to reproduce a mix of synthesised speech and short notification sounds ("earcons"). UWP has a speech synthesis API which gives me a stream containing a WAV file, but I don't want to make too many assumptions about the parameters (bit rate, sample depth, etc.) so the idea is to have an AudioSubmixNode and add AudioFrameInputNode s whenever there's some speech to reproduce. There's some complexity around queueing up separate utterances so that

RichEditBox: picture and content after the picture disappear (Windows 10 1703 Creators Update)

纵饮孤独 提交于 2019-12-25 16:05:00
问题 In Windows 10 1703 Creators Update a new bug appeared. Steps to reproduce: Load an RTF document with a picture into RichEditBox Save it. Save it again. Reload it or open it with another app - you will see that the picture is gone and all the content after it is gone too. I submitted this bug here in FeedbackHub app. The question is how to avoid this bug or make a workaround? 回答1: This project on GitHub is to demonstrate the bug and to fix it. After you save the document for the 2-nd time, the

RichEditBox: picture and content after the picture disappear (Windows 10 1703 Creators Update)

被刻印的时光 ゝ 提交于 2019-12-25 16:02:43
问题 In Windows 10 1703 Creators Update a new bug appeared. Steps to reproduce: Load an RTF document with a picture into RichEditBox Save it. Save it again. Reload it or open it with another app - you will see that the picture is gone and all the content after it is gone too. I submitted this bug here in FeedbackHub app. The question is how to avoid this bug or make a workaround? 回答1: This project on GitHub is to demonstrate the bug and to fix it. After you save the document for the 2-nd time, the

error installing Entity Framework Core SqlServer on VS 2017

时光怂恿深爱的人放手 提交于 2019-12-25 12:53:27
问题 Does anyone have any ideas about how to fix this? I have tried it various different ways and version on VS 2015, and then I just recently upgraded to VS 2017, but still have same issue. I'm in the process of installing Entity Framework Core, and wanted to connect to a SqlServer. When I install the package via Pack Man Console or via NuGet interface, I get the following error.... I have the following installed currently.. System.Threading.Thread 4.3.0 provides a compile-time reference assembly

multiple selection on custom picker C# UWP

允我心安 提交于 2019-12-25 12:52:12
问题 I've been looking on forums and internet about a custom picker on C#, I have a picker already functional, but some of my research throw me that you are only able to select 1 item of the custom Picker, this is the code im using to deploy the picker. Picker <custom:CustomPicker x:Name="pickerCategories" ItemsSource="{Binding listCategoriesName}" SelectedIndex="{Binding SelectedCategory}" SelectedIndexChanged="pickerCategories_SelectedIndexChanged" Grid.Column="1" BackgroundColor="White"/> the