win-universal-app

how to sign out from windows 10 program in uwp?

☆樱花仙子☆ 提交于 2019-12-11 11:11:44
问题 how to log off(sign out) windows 10 using uwp? I have do in win-forms but codes are not working in uwp. [DllImport("user32.dll")] public static extern int ExitWindowsEx(int operationFlag, int rationReason); private void button_Click(object sender, RoutedEventArgs e) { //Application.Current.Exit(); ExitWindowsEx(0, 0); } 回答1: In non-UWP programme You can create a new process and run %windir%\System32\shutdown.exe /l /t 0 But this is not available to UWP programmes. Check out the Stack Overflow

Access to Internet in Background

折月煮酒 提交于 2019-12-11 11:10:17
问题 I'm using C# and Windows Phone 8.1 as Universal App. I used background task by this article: http://www.romasz.net/how-to-add-a-backgroundtask/ I want when my application is in background, open a site and grab html source. I've used this code (in the background project): public async void Run(IBackgroundTaskInstance taskInstance) { Debug.WriteLine("Background started\nRetrieving data"); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(new Uri("http://mysite")); HttpWebResponse

Dynamically generated code execute in wrong address

放肆的年华 提交于 2019-12-11 11:06:26
问题 This is an UWP app. I am having this issue with ARM/Release build. Variable out points to extra_memory where the memory's protection is changed by protect_readwrite each time before recompilation and by protect_exec each time before executing the recompiled code. Basically extra_memory is where we put recompiled code. First of all, after new_dynarec_init is called to change extra_memory's protection to read&write, out is given the pointer to extra_memory such that we can use out as the entry

Universal Apps: How to bind a property of a ListViewItem (container) to the actual item (View Model)?

我的梦境 提交于 2019-12-11 10:55:38
问题 I have this ListView <ListView ItemsSource="{Binding Items}"> <ListView.ItemContainerStyle> <Style TargetType="ListViewItem"> <Setter Property="Background" Value="{Binding IsValid, Converter={StaticResource BooleanToBrushConverter}" /> </Style> </ListView.ItemContainerStyle> <ListView.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding Name}" /> </DataTemplate> </ListView.ItemTemplate> </ListView> I KNOW Bindings don't work for Setters in Universal Applications but, then how do I bind a

Exception thrown when setting HttpClientHandler credentials in Windows Universal Apps

拥有回忆 提交于 2019-12-11 10:53:49
问题 I know that this is technically still a preview, and this might be a known (or unknown) issue but I could also be missing something obvious (especially as not being able to set credentials sounds important enough that Microsoft would probably have fixed it already). To reproduce: public class Credentials : ICredentials { public NetworkCredential GetCredential(Uri uri, string authType) { return new NetworkCredential("username", "password"); } } public App() { this.InitializeComponent(); this

Anchor a TextBox to the right and Left (so it’s stretched when parent is resized)

坚强是说给别人听的谎言 提交于 2019-12-11 10:51:32
问题 I’m looking for the XAML equivalent of Winforms’ Anchor property. I want to anchor a TextBox that’s on a Canvas (on a UWP app) to the left and right so it’s always 260 from the left and 10 from the right. I’ve tried many things, but the one that looks most promising was: <TextBox Height="Auto" Width="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="Wrap" Text="TextBox" Margin="260,10,10,10"/> It does not, however anchor to the right. 回答1: I would use a 3-column

Translating AesManaged to new universal app CryptographicEngine

好久不见. 提交于 2019-12-11 10:31:19
问题 I've this old code snipped that should be translated to use the new CryptographicEngine. But I'm overwhelmed by the possibilities of the new API. Can someone plz help me? private AesManaged GetAes(string textkey) { var aes = new AesManaged(); aes.IV = new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; var key = System.Text.Encoding.UTF8.GetBytes(textkey); aes.Key = key; return aes; } private string DecryptValue(string input, string textkey) { var bytes = Convert.FromBase64String

Windows credentials not passing through using Windows.Web.Http.HttpClient

五迷三道 提交于 2019-12-11 10:24:09
问题 My app is trying to make a request to a service on our domain, but it's failing to pass through, the windows credentials of the user running the app which is causing a login request for every service call (there are several in a row... ultra-annoying) If I set the ServerCredential to a PasswordCredential (using HttpBaseProtocolFilter) and use hardcoded information (resource, username, password) then everything works fine, but that is not adequate as it needs to be able to pass through the

Workaround for x:Shared in Universal Applications

别来无恙 提交于 2019-12-11 10:18:52
问题 I have a Style setter that sets the value to a resource. It works for a single element, but when the Style is applied to more than 1 element, an exception is thrown. This is what I have: <SymbolIcon x:Key="Star" Symbol="Star" /> <Style TargetType="ContentControl"> <Setter Property="Content" Value="{StaticResource Star}"/> </Style> I understand that only one instance will be created. Since I cannot create "multi-instance" resources , how could I make it work? 回答1: If you want to make couple

Add elements to the standard transport control

ε祈祈猫儿з 提交于 2019-12-11 10:17:55
问题 I want to add a selector into the standard transport control of windows universal apps, so i can select the quality of a video. I tried to modify the xaml where the standard controls are defined, but the control wasn't effected and the standard control is still dislplayed. The MediaElement with the standard transport control: <MediaElement AreTransportControlsEnabled="True"> </MediaElement> 回答1: Since you want to add a selector into the standard transport control and select the quality of a