private async void InjectCode(object sender, WebViewNavigationCompletedEventArgs e) { confWebUrl = e.Uri.AbsoluteUri; if (confWebUrl == confUrl) { // Try to only inject this once string[] args = { @" if (!window.SGHandler) { window.SGHandler = { Value: 0, Status: 'busy', getResultValue: function() { return window.SGHandler.Value; }, getResultStatus: function() { return window.SGHandler.Status; }, getResultCode: function() { return 0; }, update: function(a, b) { window.SGHandler.Value = a; window.SGHandler.Status = b; } }; runLocalUrlO = runLocalUrl; runLocalUrl = function(url) { window.SGHandler.update(0, 'busy'); runLocalUrlO(url); } }" }; await ConfirmationWeb.InvokeScriptAsync("eval", args); } }
private void BackPressed(object s, BackPressedEventArgs args) { if (ConfirmationWeb.Visibility == Visibility.Visible && ConfirmationWeb.CanGoBack && confWebUrl != confUrl) { ConfirmationWeb.GoBack(); args.Handled = true; } }
private void ConfirmationsButton_Click(object sender, RoutedEventArgs e) { HideAll(); ConfirmationWeb.Visibility = Visibility.Visible; account.GenerateConfirmationURL(async response => { confUrl = response; HttpRequestMessage message = GetMessageForUrl(response); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { ConfirmationWeb.NavigateWithHttpRequestMessage(message); }); }); }
internal void HandleUri(Uri uri) { Dictionary <string, string> query = new Dictionary <string, string>(); if (uri.Query.Length > 0) { WwwFormUrlDecoder decoder = new WwwFormUrlDecoder(uri.Query); query = decoder.ToDictionary(x => x.Name, x => x.Value); } switch (uri.Host) { case "settitle": // I'm not entirely sure if this is applicable // Sets values like title=Confirmations or title=Chat break; case "lostauth": LogoutButton_Click(null, null); break; case "steamguard": if (query["op"] != "conftag") { break; } account.GenerateConfirmationQueryParams(async response => { string[] args = { "window.SGHandler.update('" + response + "', 'ok');" }; await ConfirmationWeb.InvokeScriptAsync("eval", args); }, query["arg1"]); break; default: Debug.WriteLine("Unhandled uri: " + uri.AbsoluteUri); break; } }