Blueprint loading works
This commit is contained in:
18
EveCalc.Shared/Views/BrowserView.xaml
Normal file
18
EveCalc.Shared/Views/BrowserView.xaml
Normal file
@@ -0,0 +1,18 @@
|
||||
<Window
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wpf="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
|
||||
x:Class="EveCalc.Shared.Views.BrowserView"
|
||||
mc:Ignorable="d"
|
||||
Title="BrowserView" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox x:Name="TxtUrl" Grid.Row="0" Height="25"/>
|
||||
<wpf:WebView2 x:Name="WbrBrowser" Grid.Row="1" NavigationStarting="WbrBrowser_NavigationStarting"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
48
EveCalc.Shared/Views/BrowserView.xaml.cs
Normal file
48
EveCalc.Shared/Views/BrowserView.xaml.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for BrowserView.xaml
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user