mirror of
https://github.com/2dust/v2rayN.git
synced 2026-04-14 19:45:45 +00:00
Merge 523dfb7acf into 005cb620ec
This commit is contained in:
commit
acf93fa8dd
20 changed files with 612 additions and 40 deletions
|
|
@ -1101,6 +1101,13 @@ public class Utils
|
|||
|
||||
public static bool IsLinux() => OperatingSystem.IsLinux();
|
||||
|
||||
public static bool IsWayland() =>
|
||||
OperatingSystem.IsLinux()
|
||||
&& (
|
||||
Environment.GetEnvironmentVariable("WAYLAND_DISPLAY").IsNotEmpty()
|
||||
|| string.Equals(Environment.GetEnvironmentVariable("XDG_SESSION_TYPE"), "wayland", StringComparison.OrdinalIgnoreCase)
|
||||
);
|
||||
|
||||
public static bool IsMacOS() => OperatingSystem.IsMacOS();
|
||||
|
||||
public static bool IsNonWindows() => !OperatingSystem.IsWindows();
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
{
|
||||
await MoveServer(EMove.Bottom);
|
||||
}, canEditRemove);
|
||||
MoveToGroupCmd = ReactiveCommand.CreateFromTask<SubItem>(async sub =>
|
||||
MoveToGroupCmd = ReactiveCommand.Create<SubItem>(sub =>
|
||||
{
|
||||
SelectedMoveToGroup = sub;
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,6 +22,24 @@
|
|||
<StyleInclude Source="Assets/GlobalStyles.axaml" />
|
||||
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
|
||||
<dialogHost:DialogHostStyles />
|
||||
<Style Selector="Border.windowTitleBar">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
<Setter Property="BorderThickness" Value="0,0,0,1" />
|
||||
</Style>
|
||||
<Style Selector="Button.windowTitleBarButton">
|
||||
<Setter Property="Width" Value="36" />
|
||||
<Setter Property="Height" Value="32" />
|
||||
<Setter Property="MinWidth" Value="36" />
|
||||
<Setter Property="Padding" Value="0" />
|
||||
<Setter Property="Theme" Value="{DynamicResource BorderlessButton}" />
|
||||
</Style>
|
||||
<Style Selector="TextBlock.windowTitleBarGlyph">
|
||||
<Setter Property="FontSize" Value="14" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</Application.Styles>
|
||||
|
||||
<TrayIcon.Icons>
|
||||
|
|
|
|||
|
|
@ -2,8 +2,17 @@ namespace v2rayN.Desktop.Base;
|
|||
|
||||
public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewModel : class
|
||||
{
|
||||
private Border? _linuxTitleBar;
|
||||
private Control? _linuxTitleBarDragRegion;
|
||||
private Button? _linuxTitleBarCloseButton;
|
||||
|
||||
public WindowBase()
|
||||
{
|
||||
if (Utils.IsWayland())
|
||||
{
|
||||
SystemDecorations = SystemDecorations.BorderOnly;
|
||||
}
|
||||
|
||||
Loaded += OnLoaded;
|
||||
}
|
||||
|
||||
|
|
@ -34,10 +43,13 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
|
|||
Position = new PixelPoint((int)x, (int)y);
|
||||
}
|
||||
catch { }
|
||||
|
||||
ConfigureLinuxTitleBar();
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
ReleaseLinuxTitleBar();
|
||||
base.OnClosed(e);
|
||||
try
|
||||
{
|
||||
|
|
@ -45,4 +57,67 @@ public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewMode
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
protected virtual void HandleLinuxTitleBarClose()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void ConfigureLinuxTitleBar()
|
||||
{
|
||||
if (!Utils.IsWayland())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_linuxTitleBar ??= this.FindControl<Border>("linuxTitleBar");
|
||||
if (_linuxTitleBar == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_linuxTitleBar.IsVisible = true;
|
||||
|
||||
_linuxTitleBarDragRegion ??= this.FindControl<Control>("linuxTitleBarDragRegion");
|
||||
if (_linuxTitleBarDragRegion != null)
|
||||
{
|
||||
_linuxTitleBarDragRegion.PointerPressed -= LinuxTitleBar_PointerPressed;
|
||||
_linuxTitleBarDragRegion.PointerPressed += LinuxTitleBar_PointerPressed;
|
||||
}
|
||||
|
||||
_linuxTitleBarCloseButton ??= this.FindControl<Button>("btnLinuxClose");
|
||||
if (_linuxTitleBarCloseButton != null)
|
||||
{
|
||||
_linuxTitleBarCloseButton.Click -= LinuxTitleBarClose_Click;
|
||||
_linuxTitleBarCloseButton.Click += LinuxTitleBarClose_Click;
|
||||
}
|
||||
}
|
||||
|
||||
private void ReleaseLinuxTitleBar()
|
||||
{
|
||||
if (_linuxTitleBarDragRegion != null)
|
||||
{
|
||||
_linuxTitleBarDragRegion.PointerPressed -= LinuxTitleBar_PointerPressed;
|
||||
}
|
||||
|
||||
if (_linuxTitleBarCloseButton != null)
|
||||
{
|
||||
_linuxTitleBarCloseButton.Click -= LinuxTitleBarClose_Click;
|
||||
}
|
||||
}
|
||||
|
||||
private void LinuxTitleBar_PointerPressed(object? sender, PointerPressedEventArgs e)
|
||||
{
|
||||
if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
BeginMoveDrag(e);
|
||||
}
|
||||
|
||||
private void LinuxTitleBarClose_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
HandleLinuxTitleBarClose();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Avalonia.Platform.Storage;
|
||||
using MsBox.Avalonia;
|
||||
using MsBox.Avalonia.Dto;
|
||||
|
||||
namespace v2rayN.Desktop.Common;
|
||||
|
||||
|
|
@ -9,7 +10,17 @@ internal class UI
|
|||
|
||||
public static async Task<ButtonResult> ShowYesNo(Window owner, string msg)
|
||||
{
|
||||
var box = MessageBoxManager.GetMessageBoxStandard(caption, msg, ButtonEnum.YesNo);
|
||||
var messageBoxParams = new MessageBoxStandardParams
|
||||
{
|
||||
ContentTitle = caption,
|
||||
ContentMessage = msg,
|
||||
ButtonDefinitions = ButtonEnum.YesNo,
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
CanResize = false,
|
||||
Topmost = false,
|
||||
SystemDecorations = Utils.IsWayland() ? SystemDecorations.BorderOnly : SystemDecorations.Full
|
||||
};
|
||||
var box = MessageBoxManager.GetMessageBoxStandard(messageBoxParams);
|
||||
return await box.ShowWindowDialogAsync(owner);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,8 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -252,5 +281,6 @@
|
|||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -154,5 +184,6 @@
|
|||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -1131,5 +1161,6 @@
|
|||
<Separator Grid.Row="9" Margin="{StaticResource MarginTb8}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -486,5 +516,6 @@
|
|||
</DockPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -178,5 +208,6 @@
|
|||
</DockPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -127,5 +157,6 @@
|
|||
Text="{x:Static resx:ResUI.TbGlobalHotkeySettingTip}" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:view="using:v2rayN.Desktop.Views"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
x:Name="mainWindow"
|
||||
Title="v2rayN"
|
||||
Width="1200"
|
||||
Height="800"
|
||||
|
|
@ -21,7 +22,43 @@
|
|||
Background="Gray"
|
||||
CloseOnClickAway="True"
|
||||
DisableOpeningAnimation="True">
|
||||
<DockPanel>
|
||||
<DockPanel LastChildFill="True">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
DockPanel.Dock="Top"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, ElementName=mainWindow}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel
|
||||
Grid.Column="2"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnLinuxClose"
|
||||
Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<DockPanel Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
|
||||
<ContentControl x:Name="conTheme" DockPanel.Dock="Right" />
|
||||
<Menu Margin="{StaticResource Margin4}">
|
||||
|
|
|
|||
|
|
@ -280,7 +280,14 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||
{
|
||||
case WindowCloseReason.OwnerWindowClosing or WindowCloseReason.WindowClosing:
|
||||
e.Cancel = true;
|
||||
ShowHideWindow(false);
|
||||
if (Utils.IsLinux())
|
||||
{
|
||||
HideToTray();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowHideWindow(false);
|
||||
}
|
||||
break;
|
||||
|
||||
case WindowCloseReason.ApplicationShutdown or WindowCloseReason.OSShutdown:
|
||||
|
|
@ -388,6 +395,22 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||
await AppManager.Instance.AppExitAsync(true);
|
||||
}
|
||||
|
||||
protected override void HandleLinuxTitleBarClose()
|
||||
{
|
||||
HideToTray();
|
||||
}
|
||||
|
||||
private void HideToTray()
|
||||
{
|
||||
foreach (var ownedWindow in OwnedWindows)
|
||||
{
|
||||
ownedWindow.Close();
|
||||
}
|
||||
|
||||
Hide();
|
||||
AppManager.Instance.ShowInTaskbar = false;
|
||||
}
|
||||
|
||||
private void Shutdown(bool obj)
|
||||
{
|
||||
if (obj is bool b && _blCloseByUser == false)
|
||||
|
|
@ -426,7 +449,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||
{
|
||||
if (Utils.IsLinux() && _config.UiItem.Hide2TrayWhenClose == false)
|
||||
{
|
||||
WindowState = WindowState.Minimized;
|
||||
HideToTray();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -965,5 +995,6 @@
|
|||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -12,8 +12,37 @@
|
|||
x:DataType="vms:ProfilesSelectViewModel"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<DockPanel Margin="8">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="8">
|
||||
<!-- Bottom buttons -->
|
||||
<StackPanel
|
||||
Margin="4"
|
||||
|
|
@ -123,5 +152,6 @@
|
|||
</DataGrid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel>
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1">
|
||||
<Grid
|
||||
Margin="{StaticResource Margin4}"
|
||||
ColumnDefinitions="Auto,Auto,Auto"
|
||||
|
|
@ -250,5 +280,6 @@
|
|||
TextWrapping="Wrap" />
|
||||
</HeaderedContentControl>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -13,7 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel>
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1">
|
||||
<Menu Margin="{StaticResource Margin4}" DockPanel.Dock="Top">
|
||||
<MenuItem x:Name="menuRuleAdd" Header="{x:Static resx:ResUI.menuRuleAdd}" />
|
||||
<MenuItem x:Name="menuImportRulesFromFile" Header="{x:Static resx:ResUI.menuImportRulesFromFile}" />
|
||||
|
|
@ -253,5 +283,6 @@
|
|||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -13,8 +13,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<DockPanel>
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1">
|
||||
<Menu Margin="{StaticResource Margin4}" DockPanel.Dock="Top">
|
||||
<MenuItem x:Name="menuRoutingAdvancedAdd2" Header="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" />
|
||||
<MenuItem x:Name="menuRoutingAdvancedImportRules2" Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
|
||||
|
|
@ -138,5 +167,6 @@
|
|||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,37 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DockPanel Grid.Row="1" Margin="{StaticResource Margin8}">
|
||||
<StackPanel
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Center"
|
||||
|
|
@ -266,5 +296,6 @@
|
|||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -14,12 +14,43 @@
|
|||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<dialogHost:DialogHost
|
||||
Background="Gray"
|
||||
CloseOnClickAway="True"
|
||||
DisableOpeningAnimation="True"
|
||||
Identifier="dialogHostSub">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid RowDefinitions="Auto,*">
|
||||
<Border
|
||||
x:Name="linuxTitleBar"
|
||||
Classes="windowTitleBar"
|
||||
IsVisible="False">
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Height="36">
|
||||
<Border
|
||||
x:Name="linuxTitleBarDragRegion"
|
||||
Grid.ColumnSpan="2"
|
||||
Background="Transparent" />
|
||||
<StackPanel
|
||||
Grid.Column="0"
|
||||
Margin="12,0,0,0"
|
||||
Orientation="Horizontal"
|
||||
Spacing="8">
|
||||
<Image
|
||||
Width="16"
|
||||
Height="16"
|
||||
Source="/Assets/NotifyIcon1.ico" />
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Title, RelativeSource={RelativeSource AncestorType=Window}}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Column="2" Orientation="Horizontal">
|
||||
<Button x:Name="btnLinuxClose" Classes="windowTitleBarButton">
|
||||
<TextBlock Classes="windowTitleBarGlyph" Text="×" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<dialogHost:DialogHost
|
||||
Grid.Row="1"
|
||||
Background="Gray"
|
||||
CloseOnClickAway="True"
|
||||
DisableOpeningAnimation="True"
|
||||
Identifier="dialogHostSub">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Menu Margin="{StaticResource Margin4}" DockPanel.Dock="Top">
|
||||
<MenuItem x:Name="menuSubAdd" Header="{x:Static resx:ResUI.menuSubAdd}" />
|
||||
<MenuItem x:Name="menuSubDelete" Header="{x:Static resx:ResUI.menuSubDelete}" />
|
||||
|
|
@ -75,6 +106,7 @@
|
|||
Header="{x:Static resx:ResUI.LvSort}" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</dialogHost:DialogHost>
|
||||
</DockPanel>
|
||||
</dialogHost:DialogHost>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
Loading…
Reference in a new issue