mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-01 12:32:10 +00:00
Each window can remember its size
This commit is contained in:
parent
cb28c31519
commit
7a9ee6e9e2
31 changed files with 212 additions and 81 deletions
|
@ -101,6 +101,7 @@ public class ConfigHandler
|
|||
EnableAutoAdjustMainLvColWidth = true
|
||||
};
|
||||
config.UiItem.MainColumnItem ??= new();
|
||||
config.UiItem.WindowSizeItem ??= new();
|
||||
|
||||
if (config.UiItem.CurrentLanguage.IsNullOrEmpty())
|
||||
{
|
||||
|
@ -2174,4 +2175,34 @@ public class ConfigHandler
|
|||
}
|
||||
|
||||
#endregion Regional Presets
|
||||
|
||||
#region UIItem
|
||||
|
||||
public static WindowSizeItem? GetWindowSizeItem(Config config, string typeName)
|
||||
{
|
||||
var sizeItem = config?.UiItem?.WindowSizeItem?.FirstOrDefault(t => t.TypeName == typeName);
|
||||
if (sizeItem == null || sizeItem.Width <= 0 || sizeItem.Height <= 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return sizeItem;
|
||||
}
|
||||
|
||||
public static int SaveWindowSizeItem(Config config, string typeName, double width, double height)
|
||||
{
|
||||
var sizeItem = config?.UiItem?.WindowSizeItem?.FirstOrDefault(t => t.TypeName == typeName);
|
||||
if (sizeItem == null)
|
||||
{
|
||||
sizeItem = new WindowSizeItem { TypeName = typeName };
|
||||
config.UiItem.WindowSizeItem.Add(sizeItem);
|
||||
}
|
||||
|
||||
sizeItem.Width = width;
|
||||
sizeItem.Height = height;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion UIItem
|
||||
}
|
||||
|
|
|
@ -89,8 +89,6 @@ public class UIItem
|
|||
{
|
||||
public bool EnableAutoAdjustMainLvColWidth { get; set; }
|
||||
public bool EnableUpdateSubOnlyRemarksExist { get; set; }
|
||||
public double MainWidth { get; set; }
|
||||
public double MainHeight { get; set; }
|
||||
public double MainGirdHeight1 { get; set; }
|
||||
public double MainGirdHeight2 { get; set; }
|
||||
public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical;
|
||||
|
@ -103,9 +101,10 @@ public class UIItem
|
|||
public bool DoubleClick2Activate { get; set; }
|
||||
public bool AutoHideStartup { get; set; }
|
||||
public bool Hide2TrayWhenClose { get; set; }
|
||||
public List<ColumnItem> MainColumnItem { get; set; }
|
||||
public bool ShowInTaskbar { get; set; }
|
||||
public bool MacOSShowInDock { get; set; }
|
||||
public List<ColumnItem> MainColumnItem { get; set; }
|
||||
public List<WindowSizeItem> WindowSizeItem { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
@ -246,3 +245,11 @@ public class Fragment4RayItem
|
|||
public string? Length { get; set; }
|
||||
public string? Interval { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class WindowSizeItem
|
||||
{
|
||||
public string TypeName { get; set; }
|
||||
public double Width { get; set; }
|
||||
public double Height { get; set; }
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ internal class IPAPIInfo
|
|||
{
|
||||
public string? ip { get; set; }
|
||||
public string? clientIp { get; set; }
|
||||
public string? ip_addr { get; set; }
|
||||
public string? ip_addr { get; set; }
|
||||
public string? query { get; set; }
|
||||
public string? country { get; set; }
|
||||
public string? country_name { get; set; }
|
||||
|
|
|
@ -4,7 +4,7 @@ using SQLite;
|
|||
namespace ServiceLib.Models;
|
||||
|
||||
[Serializable]
|
||||
public class ProfileItem: ReactiveObject
|
||||
public class ProfileItem : ReactiveObject
|
||||
{
|
||||
public ProfileItem()
|
||||
{
|
||||
|
|
52
v2rayN/v2rayN.Desktop/Base/WindowBase.cs
Normal file
52
v2rayN/v2rayN.Desktop/Base/WindowBase.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
|
||||
namespace v2rayN.Desktop.Base;
|
||||
|
||||
public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewModel : class
|
||||
{
|
||||
public WindowBase()
|
||||
{
|
||||
Loaded += OnLoaded;
|
||||
}
|
||||
|
||||
private void ReactiveWindowBase_Closed(object? sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected virtual void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sizeItem = ConfigHandler.GetWindowSizeItem(AppHandler.Instance.Config, GetType().Name);
|
||||
if (sizeItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Width = sizeItem.Width;
|
||||
Height = sizeItem.Height;
|
||||
|
||||
var workingArea = (Screens.ScreenFromWindow(this) ?? Screens.Primary).WorkingArea;
|
||||
var scaling = VisualRoot is not null ? VisualRoot.RenderScaling : 1.0;
|
||||
|
||||
var x = workingArea.X + ((workingArea.Width - (Width * scaling)) / 2);
|
||||
var y = workingArea.Y + ((workingArea.Height - (Height * scaling)) / 2);
|
||||
|
||||
Position = new PixelPoint((int)x, (int)y);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
try
|
||||
{
|
||||
ConfigHandler.SaveWindowSizeItem(AppHandler.Instance.Config, GetType().Name, Width, Height);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class AddServer2Window : ReactiveWindow<AddServer2ViewModel>
|
||||
public partial class AddServer2Window : WindowBase<AddServer2ViewModel>
|
||||
{
|
||||
public AddServer2Window()
|
||||
{
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class AddServerWindow : ReactiveWindow<AddServerViewModel>
|
||||
public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||
{
|
||||
public AddServerWindow()
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class DNSSettingWindow : ReactiveWindow<DNSSettingViewModel>
|
||||
public partial class DNSSettingWindow : WindowBase<DNSSettingViewModel>
|
||||
{
|
||||
private static Config _config;
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ using System.Text;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Handler;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class GlobalHotkeySettingWindow : ReactiveWindow<GlobalHotkeySettingViewModel>
|
||||
public partial class GlobalHotkeySettingWindow : WindowBase<GlobalHotkeySettingViewModel>
|
||||
{
|
||||
private readonly List<object> _textBoxKeyEventItem = new();
|
||||
|
||||
|
|
|
@ -5,18 +5,18 @@ using Avalonia.Controls.ApplicationLifetimes;
|
|||
using Avalonia.Controls.Notifications;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using Avalonia.Threading;
|
||||
using DialogHostAvalonia;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
using v2rayN.Desktop.Handler;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
||||
public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||
{
|
||||
private static Config _config;
|
||||
private WindowNotificationManager? _manager;
|
||||
|
@ -154,7 +154,6 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
|||
}
|
||||
menuAddServerViaScan.IsVisible = false;
|
||||
|
||||
RestoreUI();
|
||||
AddHelpMenuItem();
|
||||
MessageBus.Current.Listen<string>(EMsgCommand.AppExit.ToString()).Subscribe(StorageUI);
|
||||
}
|
||||
|
@ -436,14 +435,14 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
|||
_config.UiItem.ShowInTaskbar = bl;
|
||||
}
|
||||
|
||||
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(sender, e);
|
||||
RestoreUI();
|
||||
}
|
||||
|
||||
private void RestoreUI()
|
||||
{
|
||||
if (_config.UiItem.MainWidth > 0 && _config.UiItem.MainHeight > 0)
|
||||
{
|
||||
Width = _config.UiItem.MainWidth;
|
||||
Height = _config.UiItem.MainHeight;
|
||||
}
|
||||
|
||||
if (_config.UiItem.MainGirdHeight1 > 0 && _config.UiItem.MainGirdHeight2 > 0)
|
||||
{
|
||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||
|
@ -461,8 +460,7 @@ public partial class MainWindow : ReactiveWindow<MainWindowViewModel>
|
|||
|
||||
private void StorageUI(string? n = null)
|
||||
{
|
||||
_config.UiItem.MainWidth = this.Width;
|
||||
_config.UiItem.MainHeight = this.Height;
|
||||
ConfigHandler.SaveWindowSizeItem(_config, GetType().Name, Width, Height);
|
||||
|
||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||
{
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class OptionSettingWindow : ReactiveWindow<OptionSettingViewModel>
|
||||
public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||
{
|
||||
private static Config _config;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class RoutingRuleDetailsWindow : ReactiveWindow<RoutingRuleDetailsViewModel>
|
||||
public partial class RoutingRuleDetailsWindow : WindowBase<RoutingRuleDetailsViewModel>
|
||||
{
|
||||
public RoutingRuleDetailsWindow()
|
||||
{
|
||||
|
|
|
@ -2,14 +2,14 @@ using System.Reactive.Disposables;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class RoutingRuleSettingWindow : ReactiveWindow<RoutingRuleSettingViewModel>
|
||||
public partial class RoutingRuleSettingWindow : WindowBase<RoutingRuleSettingViewModel>
|
||||
{
|
||||
public RoutingRuleSettingWindow()
|
||||
{
|
||||
|
|
|
@ -2,14 +2,14 @@ using System.Reactive.Disposables;
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class RoutingSettingWindow : ReactiveWindow<RoutingSettingViewModel>
|
||||
public partial class RoutingSettingWindow : WindowBase<RoutingSettingViewModel>
|
||||
{
|
||||
private bool _manualClose = false;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class SubEditWindow : ReactiveWindow<SubEditViewModel>
|
||||
public partial class SubEditWindow : WindowBase<SubEditViewModel>
|
||||
{
|
||||
public SubEditWindow()
|
||||
{
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
using System.Reactive.Disposables;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.ReactiveUI;
|
||||
using DialogHostAvalonia;
|
||||
using DynamicData;
|
||||
using MsBox.Avalonia.Enums;
|
||||
using ReactiveUI;
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class SubSettingWindow : ReactiveWindow<SubSettingViewModel>
|
||||
public partial class SubSettingWindow : WindowBase<SubSettingViewModel>
|
||||
{
|
||||
private bool _manualClose = false;
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@
|
|||
<Setter Property="Background" Value="{DynamicResource MaterialDesignPaper}" />
|
||||
<Setter Property="TextElement.FontFamily" Value="{x:Static conv:MaterialDesignFonts.MyFont}" />
|
||||
<Setter Property="FontFamily" Value="{x:Static conv:MaterialDesignFonts.MyFont}" />
|
||||
<Setter Property="ResizeMode" Value="NoResize" />
|
||||
<Setter Property="ResizeMode" Value="CanResize" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="ViewGlobal"
|
||||
|
|
42
v2rayN/v2rayN/Base/WindowBase.cs
Normal file
42
v2rayN/v2rayN/Base/WindowBase.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using System.Windows;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace v2rayN.Base;
|
||||
|
||||
public class WindowBase<TViewModel> : ReactiveWindow<TViewModel> where TViewModel : class
|
||||
{
|
||||
public WindowBase()
|
||||
{
|
||||
Loaded += OnLoaded;
|
||||
}
|
||||
|
||||
protected virtual void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
var sizeItem = ConfigHandler.GetWindowSizeItem(AppHandler.Instance.Config, GetType().Name);
|
||||
if (sizeItem == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Width = Math.Min(sizeItem.Width, SystemParameters.WorkArea.Width);
|
||||
Height = Math.Min(sizeItem.Height, SystemParameters.WorkArea.Height);
|
||||
|
||||
Left = SystemParameters.WorkArea.Left + ((SystemParameters.WorkArea.Width - Width) / 2);
|
||||
Top = SystemParameters.WorkArea.Top + ((SystemParameters.WorkArea.Height - Height) / 2);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
protected override void OnClosed(EventArgs e)
|
||||
{
|
||||
base.OnClosed(e);
|
||||
|
||||
try
|
||||
{
|
||||
ConfigHandler.SaveWindowSizeItem(AppHandler.Instance.Config, GetType().Name, Width, Height);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.AddServer2Window"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -198,4 +199,4 @@
|
|||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.AddServerWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -1071,4 +1072,4 @@
|
|||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.DNSSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -204,4 +205,4 @@
|
|||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.GlobalHotkeySettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -169,4 +170,4 @@
|
|||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -40,8 +41,8 @@
|
|||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
ClipToBounds="True"
|
||||
Style="{StaticResource MaterialDesignToolBar}"
|
||||
KeyboardNavigation.TabNavigation="Continue">
|
||||
KeyboardNavigation.TabNavigation="Continue"
|
||||
Style="{StaticResource MaterialDesignToolBar}">
|
||||
<Menu Margin="0,1" Style="{StaticResource ToolbarMenu}">
|
||||
<MenuItem Padding="8,0" AutomationProperties.Name="{x:Static resx:ResUI.menuServers}">
|
||||
<MenuItem.Header>
|
||||
|
@ -432,4 +433,4 @@
|
|||
</DockPanel>
|
||||
</Grid>
|
||||
</materialDesign:DialogHost>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -139,7 +139,6 @@ public partial class MainWindow
|
|||
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
|
||||
}
|
||||
|
||||
RestoreUI();
|
||||
AddHelpMenuItem();
|
||||
WindowsHandler.Instance.RegisterGlobalHotkey(_config, OnHotkeyHandler, null);
|
||||
MessageBus.Current.Listen<string>(EMsgCommand.AppExit.ToString()).Subscribe(StorageUI);
|
||||
|
@ -395,20 +394,14 @@ public partial class MainWindow
|
|||
_config.UiItem.ShowInTaskbar = bl;
|
||||
}
|
||||
|
||||
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(sender, e);
|
||||
RestoreUI();
|
||||
}
|
||||
|
||||
private void RestoreUI()
|
||||
{
|
||||
if (_config.UiItem.MainWidth > 0 && _config.UiItem.MainHeight > 0)
|
||||
{
|
||||
Width = _config.UiItem.MainWidth;
|
||||
Height = _config.UiItem.MainHeight;
|
||||
}
|
||||
|
||||
var maxWidth = SystemParameters.WorkArea.Width;
|
||||
var maxHeight = SystemParameters.WorkArea.Height;
|
||||
if (Width > maxWidth)
|
||||
Width = maxWidth;
|
||||
if (Height > maxHeight)
|
||||
Height = maxHeight;
|
||||
if (_config.UiItem.MainGirdHeight1 > 0 && _config.UiItem.MainGirdHeight2 > 0)
|
||||
{
|
||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||
|
@ -426,8 +419,7 @@ public partial class MainWindow
|
|||
|
||||
private void StorageUI(string? n = null)
|
||||
{
|
||||
_config.UiItem.MainWidth = this.Width;
|
||||
_config.UiItem.MainHeight = this.Height;
|
||||
ConfigHandler.SaveWindowSizeItem(_config, GetType().Name, Width, Height);
|
||||
|
||||
if (_config.UiItem.MainGirdOrientation == EGirdOrientation.Horizontal)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.OptionSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -959,8 +960,6 @@
|
|||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsChinaUserTip}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
|
@ -1231,4 +1230,4 @@
|
|||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.RoutingRuleDetailsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -242,4 +243,4 @@
|
|||
</GroupBox>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.RoutingRuleSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -334,4 +335,4 @@
|
|||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.RoutingSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -220,4 +221,4 @@
|
|||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
AutomationProperties.Name="{x:Static resx:ResUI.menuRouting}"
|
||||
DisplayMemberPath="Remarks"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
Style="{StaticResource MaterialDesignFloatingHintComboBox}">
|
||||
Style="{StaticResource MaterialDesignFloatingHintComboBox}">
|
||||
</ComboBox>
|
||||
</StackPanel>
|
||||
|
||||
|
@ -185,7 +185,7 @@
|
|||
AutomationProperties.Name="{x:Static resx:ResUI.menuRouting}"
|
||||
DisplayMemberPath="Remarks"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}">
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}">
|
||||
</ComboBox>
|
||||
</DockPanel>
|
||||
</MenuItem.Header>
|
||||
|
@ -200,7 +200,7 @@
|
|||
AutomationProperties.Name="{x:Static resx:ResUI.menuServers}"
|
||||
DisplayMemberPath="Text"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}">
|
||||
Style="{StaticResource MaterialDesignFilledComboBox}">
|
||||
</ComboBox>
|
||||
</DockPanel>
|
||||
</MenuItem.Header>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.SubEditWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -315,4 +316,4 @@
|
|||
</Grid>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.SubSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -120,4 +121,4 @@
|
|||
</DataGrid>
|
||||
</DockPanel>
|
||||
</materialDesign:DialogHost>
|
||||
</reactiveui:ReactiveWindow>
|
||||
</base:WindowBase>
|
||||
|
|
Loading…
Reference in a new issue