From 2bb5f6afc437da5ba250e7a6e70b515d17d9940b Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:22:07 +0800 Subject: [PATCH] Add DialogHost fro Desktop --- v2rayN/v2rayN.Desktop/App.axaml | 1 + v2rayN/v2rayN.Desktop/Views/MainWindow.axaml | 500 +++++++++--------- .../Views/ProfilesView.axaml.cs | 6 +- v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml | 20 +- .../v2rayN.Desktop/Views/QrcodeView.axaml.cs | 4 +- .../Views/SubSettingWindow.axaml | 113 ++-- .../Views/SubSettingWindow.axaml.cs | 3 +- v2rayN/v2rayN.Desktop/v2rayN.Desktop.csproj | 1 + 8 files changed, 325 insertions(+), 323 deletions(-) diff --git a/v2rayN/v2rayN.Desktop/App.axaml b/v2rayN/v2rayN.Desktop/App.axaml index 12b0fc39..81f369d2 100644 --- a/v2rayN/v2rayN.Desktop/App.axaml +++ b/v2rayN/v2rayN.Desktop/App.axaml @@ -9,6 +9,7 @@ + diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml index c1d0770e..9262a677 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml @@ -3,6 +3,7 @@ xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:dialogHost="clr-namespace:DialogHostAvalonia;assembly=DialogHost.Avalonia" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib" @@ -15,270 +16,273 @@ ShowInTaskbar="True" WindowStartupLocation="CenterScreen" mc:Ignorable="d"> + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - + + + + + - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - - - - - + + + + + - - - - - - - + + + + - - - - - - - - - - - + + + + + + - - - - - - - + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs index 4df3854f..ed9a34d7 100644 --- a/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/ProfilesView.axaml.cs @@ -3,6 +3,7 @@ using Avalonia.Input; using Avalonia.Interactivity; using Avalonia.ReactiveUI; using Avalonia.Threading; +using DialogHostAvalonia; using MsBox.Avalonia.Enums; using ReactiveUI; using Splat; @@ -88,7 +89,7 @@ namespace v2rayN.Desktop.Views RestoreUI(); ViewModel?.RefreshServers(); - } + } //#region Event @@ -170,8 +171,9 @@ namespace v2rayN.Desktop.Views { return; } + var dialog = new QrcodeView(url); - await dialog.ShowDialog(_window); + await DialogHost.Show(dialog); } private void lstProfiles_SelectionChanged(object? sender, SelectionChangedEventArgs e) diff --git a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml index 2f92209a..aefd7619 100644 --- a/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/QrcodeView.axaml @@ -1,25 +1,17 @@ - - -