mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-01 20:42:10 +00:00
Add DialogHost fro Desktop
This commit is contained in:
parent
3971318ffb
commit
2bb5f6afc4
8 changed files with 325 additions and 323 deletions
|
@ -9,6 +9,7 @@
|
|||
<StyleInclude Source="Styles/GlobalStyles.axaml" />
|
||||
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
|
||||
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
|
||||
<StyleInclude Source="avares://DialogHost.Avalonia/Styles.xaml" />
|
||||
</Application.Styles>
|
||||
|
||||
<TrayIcon.Icons>
|
||||
|
|
|
@ -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,7 +16,10 @@
|
|||
ShowInTaskbar="True"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<dialogHost:DialogHost
|
||||
Background="Gray"
|
||||
CloseOnClickAway="True"
|
||||
DisableOpeningAnimation="True">
|
||||
<DockPanel>
|
||||
<DockPanel Classes="Margin8" DockPanel.Dock="Top">
|
||||
<ContentControl x:Name="conTheme" DockPanel.Dock="Right" />
|
||||
|
@ -280,5 +284,5 @@
|
|||
</Grid>
|
||||
|
||||
</DockPanel>
|
||||
|
||||
</dialogHost:DialogHost>
|
||||
</Window>
|
|
@ -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;
|
||||
|
@ -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)
|
||||
|
|
|
@ -1,25 +1,17 @@
|
|||
<Window
|
||||
<UserControl
|
||||
x:Class="v2rayN.Desktop.Views.QrcodeView"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
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:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
Title=""
|
||||
Width="400"
|
||||
Height="480"
|
||||
d:DesignHeight="480"
|
||||
d:DesignWidth="400"
|
||||
ExtendClientAreaChromeHints="NoChrome"
|
||||
ExtendClientAreaToDecorationsHint="True"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterOwner"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="30">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="60" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Image
|
||||
|
@ -37,12 +29,6 @@
|
|||
IsReadOnly="True"
|
||||
MaxLines="1" />
|
||||
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Grid.Row="2"
|
||||
Width="100"
|
||||
HorizontalAlignment="Right"
|
||||
Classes="Margin8"
|
||||
Content="{x:Static resx:ResUI.TbConfirm}" />
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
</UserControl>
|
|
@ -3,7 +3,7 @@ using Avalonia.Media.Imaging;
|
|||
|
||||
namespace v2rayN.Desktop.Views
|
||||
{
|
||||
public partial class QrcodeView : Window
|
||||
public partial class QrcodeView : UserControl
|
||||
{
|
||||
public QrcodeView(string? url)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace v2rayN.Desktop.Views
|
|||
txtContent.Text = url;
|
||||
imgQrcode.Source = GetQRCode(url);
|
||||
|
||||
btnCancel.Click += (s, e) => this.Close();
|
||||
// btnCancel.Click += (s, e) => this.Close();
|
||||
}
|
||||
|
||||
private Bitmap? GetQRCode(string? url)
|
||||
|
|
|
@ -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,6 +16,11 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<dialogHost:DialogHost
|
||||
Background="Gray"
|
||||
CloseOnClickAway="True"
|
||||
DisableOpeningAnimation="True"
|
||||
Identifier="dialogHostSub">
|
||||
<DockPanel Classes="Margin8">
|
||||
<StackPanel
|
||||
Classes="Margin8"
|
||||
|
@ -69,4 +75,5 @@
|
|||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</dialogHost:DialogHost>
|
||||
</Window>
|
|
@ -1,6 +1,7 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using DialogHostAvalonia;
|
||||
using DynamicData;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
|
@ -71,7 +72,7 @@ namespace v2rayN.Desktop.Views
|
|||
return;
|
||||
}
|
||||
var dialog = new QrcodeView(url);
|
||||
await dialog.ShowDialog(this);
|
||||
await DialogHost.Show(dialog, "dialogHostSub");
|
||||
}
|
||||
|
||||
private void LstSubscription_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.3" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.3" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.1.3" />
|
||||
<PackageReference Include="DialogHost.Avalonia" Version="0.8.1" />
|
||||
<PackageReference Include="MessageBox.Avalonia" Version="3.1.6" />
|
||||
<PackageReference Include="Semi.Avalonia" Version="11.1.0.4" />
|
||||
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.1.0.4" />
|
||||
|
|
Loading…
Reference in a new issue