From 641a19763e74a76bd2797afd6a242d267656be8d Mon Sep 17 00:00:00 2001 From: database64128 Date: Tue, 5 Jan 2021 02:51:51 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=8C=20UI:=20Routing=20and=20Settings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/MainWindowViewModel.cs | 14 ++ Shadowsocks.WPF/Views/DashboardView.xaml | 31 ++-- Shadowsocks.WPF/Views/MainWindow.xaml.cs | 19 ++- Shadowsocks.WPF/Views/RoutingView.xaml | 102 ++++++++++-- Shadowsocks.WPF/Views/ServersView.xaml | 31 ++-- Shadowsocks.WPF/Views/SettingsView.xaml | 151 ++++++++++++++++-- 6 files changed, 306 insertions(+), 42 deletions(-) diff --git a/Shadowsocks.WPF/ViewModels/MainWindowViewModel.cs b/Shadowsocks.WPF/ViewModels/MainWindowViewModel.cs index c024f127..87d22bfc 100644 --- a/Shadowsocks.WPF/ViewModels/MainWindowViewModel.cs +++ b/Shadowsocks.WPF/ViewModels/MainWindowViewModel.cs @@ -1,4 +1,6 @@ using ReactiveUI; +using ReactiveUI.Fody.Helpers; +using Shadowsocks.WPF.Views; namespace Shadowsocks.WPF.ViewModels { @@ -6,6 +8,18 @@ namespace Shadowsocks.WPF.ViewModels { public MainWindowViewModel() { + GetDashboardView = new(); + GetServersView = new(); + GetRoutingView = new(); + GetSettingsView = new(); } + + public DashboardView GetDashboardView { get; } + + public ServersView GetServersView { get; } + + public RoutingView GetRoutingView { get; } + + public SettingsView GetSettingsView { get; } } } diff --git a/Shadowsocks.WPF/Views/DashboardView.xaml b/Shadowsocks.WPF/Views/DashboardView.xaml index 4614e373..84d0f9cd 100644 --- a/Shadowsocks.WPF/Views/DashboardView.xaml +++ b/Shadowsocks.WPF/Views/DashboardView.xaml @@ -8,20 +8,31 @@ xmlns:local="clr-namespace:Shadowsocks.WPF.Views" xmlns:vms="clr-namespace:Shadowsocks.WPF.ViewModels" xmlns:reactiveui="http://reactiveui.net" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:lex="http://wpflocalizeextension.codeplex.com" lex:LocalizeDictionary.DesignCulture="en" lex:ResxLocalizationProvider.DefaultAssembly="Shadowsocks" lex:ResxLocalizationProvider.DefaultDictionary="Strings" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - - - - - - - - - - + + + + + + + + + + + + Dashboard + + + diff --git a/Shadowsocks.WPF/Views/MainWindow.xaml.cs b/Shadowsocks.WPF/Views/MainWindow.xaml.cs index 25115d9a..98434331 100644 --- a/Shadowsocks.WPF/Views/MainWindow.xaml.cs +++ b/Shadowsocks.WPF/Views/MainWindow.xaml.cs @@ -1,6 +1,6 @@ using ReactiveUI; - using Shadowsocks.WPF.ViewModels; +using System.Reactive.Disposables; namespace Shadowsocks.WPF.Views { @@ -15,7 +15,22 @@ namespace Shadowsocks.WPF.Views ViewModel = new MainWindowViewModel(); this.WhenActivated(disposables => { - + this.OneWayBind(ViewModel, + viewModel => viewModel.GetDashboardView, + view => view.dashboardTabItem.Content) + .DisposeWith(disposables); + this.OneWayBind(ViewModel, + viewModel => viewModel.GetServersView, + view => view.serversTabItem.Content) + .DisposeWith(disposables); + this.OneWayBind(ViewModel, + viewModel => viewModel.GetRoutingView, + view => view.routingTabItem.Content) + .DisposeWith(disposables); + this.OneWayBind(ViewModel, + viewModel => viewModel.GetSettingsView, + view => view.settingsTabItem.Content) + .DisposeWith(disposables); }); } } diff --git a/Shadowsocks.WPF/Views/RoutingView.xaml b/Shadowsocks.WPF/Views/RoutingView.xaml index 01766672..3bcdb00c 100644 --- a/Shadowsocks.WPF/Views/RoutingView.xaml +++ b/Shadowsocks.WPF/Views/RoutingView.xaml @@ -8,20 +8,102 @@ xmlns:local="clr-namespace:Shadowsocks.WPF.Views" xmlns:vms="clr-namespace:Shadowsocks.WPF.ViewModels" xmlns:reactiveui="http://reactiveui.net" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:lex="http://wpflocalizeextension.codeplex.com" lex:LocalizeDictionary.DesignCulture="en" lex:ResxLocalizationProvider.DefaultAssembly="Shadowsocks" lex:ResxLocalizationProvider.DefaultDictionary="Strings" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - - - - - - - - - - + + + + + + + + + + + + + + + Routing + + + + Preset + + + + + + + + + + Domain strategy + + + + AsIs + + + IPIfNonMatch + + + IPOnDemand + + + + + Rules + + + + diff --git a/Shadowsocks.WPF/Views/ServersView.xaml b/Shadowsocks.WPF/Views/ServersView.xaml index d2cbd701..46f3caa3 100644 --- a/Shadowsocks.WPF/Views/ServersView.xaml +++ b/Shadowsocks.WPF/Views/ServersView.xaml @@ -8,20 +8,31 @@ xmlns:local="clr-namespace:Shadowsocks.WPF.Views" xmlns:vms="clr-namespace:Shadowsocks.WPF.ViewModels" xmlns:reactiveui="http://reactiveui.net" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:lex="http://wpflocalizeextension.codeplex.com" lex:LocalizeDictionary.DesignCulture="en" lex:ResxLocalizationProvider.DefaultAssembly="Shadowsocks" lex:ResxLocalizationProvider.DefaultDictionary="Strings" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - - - - - - - - - - + + + + + + + + + + + + Servers + + + diff --git a/Shadowsocks.WPF/Views/SettingsView.xaml b/Shadowsocks.WPF/Views/SettingsView.xaml index 471ef2c7..6a2a6fe3 100644 --- a/Shadowsocks.WPF/Views/SettingsView.xaml +++ b/Shadowsocks.WPF/Views/SettingsView.xaml @@ -8,20 +8,151 @@ xmlns:local="clr-namespace:Shadowsocks.WPF.Views" xmlns:vms="clr-namespace:Shadowsocks.WPF.ViewModels" xmlns:reactiveui="http://reactiveui.net" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:lex="http://wpflocalizeextension.codeplex.com" lex:LocalizeDictionary.DesignCulture="en" lex:ResxLocalizationProvider.DefaultAssembly="Shadowsocks" lex:ResxLocalizationProvider.DefaultDictionary="Strings" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="800"> - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + Settings + + + + UI + + + + Color Mode + + + + System + + + Light + + + Dark + + + + + Backend + + + Start on boot + + + + + shadowsocks-rust Path + + + + + + V2Ray Path + + + + + + Network + + + Forward Proxy + + + +