using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; namespace EveCalc.Shared.Views { /// /// Interaction logic for BrowserView.xaml /// public partial class BrowserView : Window { public string AuthCode { get; private set; } public BrowserView() { this.InitializeComponent(); //this.WbrBrowser.EnsureCoreWebView2Async().Wait(); } public BrowserView(string url) : this() { this.WbrBrowser.Source = new Uri(url); } private void WbrBrowser_NavigationStarting(object sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationStartingEventArgs e) { this.TxtUrl.Text = e.Uri.ToString(); if (this.TxtUrl.Text.StartsWith("https://localhost/evecalc?code=")) { // Habemus login var split = this.TxtUrl.Text.Split(new[] { "code=", "&state=" }, StringSplitOptions.None); this.AuthCode = split[1]; this.DialogResult = true; this.Close(); } } } }