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