Adjust style and bug fixes

This commit is contained in:
2dust
2023-03-09 13:46:07 +08:00
parent 3230c7f3aa
commit d9ba4ac726
25 changed files with 338 additions and 277 deletions

View File

@@ -65,9 +65,8 @@
<Style TargetType="{x:Type TextElement}"> <Style TargetType="{x:Type TextElement}">
<Setter Property="FontWeight" Value="Regular" /> <Setter Property="FontWeight" Value="Regular" />
</Style> </Style>
<Style x:Key="lvItemSelected" <Style x:Key="lvItemSelected" TargetType="{x:Type ListViewItem}">
TargetType="{x:Type ListViewItem}"> <Setter Property="Margin" Value="2" />
<Setter Property="Margin" Value="5" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="ListViewItem"> <ControlTemplate TargetType="ListViewItem">
@@ -76,7 +75,7 @@
</materialDesign:Card> </materialDesign:Card>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true"> <Trigger Property="IsSelected" Value="true">
<Setter TargetName="_Card" Property="Foreground" Value="{DynamicResource PrimaryHueDarkBrush}"/> <Setter TargetName="_Card" Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -97,7 +96,7 @@
BasedOn="{StaticResource MaterialDesignRaisedButton}" BasedOn="{StaticResource MaterialDesignRaisedButton}"
TargetType="{x:Type ButtonBase}"> TargetType="{x:Type ButtonBase}">
<Setter Property="FontSize" Value="{DynamicResource StdFontSize3}" /> <Setter Property="FontSize" Value="{DynamicResource StdFontSize3}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkForegroundBrush}"/> <Setter Property="Foreground" Value="{DynamicResource PrimaryHueDarkForegroundBrush}" />
</Style> </Style>
<Style <Style
x:Key="DefMenu" x:Key="DefMenu"

View File

@@ -50,7 +50,7 @@ namespace ClashN
Global.processJob = new Job(); Global.processJob = new Job();
Logging.Setup(); Logging.Setup();
Utils.SaveLog($"clashN start up | {Utils.GetVersion()} | {Utils.GetExePath()}"); Utils.SaveLog($"ClashN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
Logging.ClearLogs(); Logging.ClearLogs();
Init(); Init();

View File

@@ -45,8 +45,8 @@
public const string mixinConfigFileName = "Mixin.yaml"; public const string mixinConfigFileName = "Mixin.yaml";
public const string SampleMixin = "clashN.Sample.SampleMixin.yaml"; public const string SampleMixin = "ClashN.Sample.SampleMixin.yaml";
public const string SampleTun = "clashN.Sample.SampleTun.yaml"; public const string SampleTun = "ClashN.Sample.SampleTun.yaml";
public const string InboundSocks = "socks"; public const string InboundSocks = "socks";
public const string InboundHttp = "http"; public const string InboundHttp = "http";
@@ -86,7 +86,7 @@
/// <summary> /// <summary>
/// Icon /// Icon
/// </summary> /// </summary>
public const string CustomIconName = "clashN.ico"; public const string CustomIconName = "ClashN.ico";
public const int MinFontSize = 10; public const int MinFontSize = 10;
@@ -101,7 +101,7 @@
"" ""
}; };
public static readonly List<string> coreTypes = new List<string> { "clash", "clash_premium", "clash_meta", }; public static readonly List<string> coreTypes = new List<string> { "Clash", "ClashPremium", "ClashMeta", };
public static readonly List<string> allowSelectType = new List<string> { "selector", "urltest", "loadbalance", "fallback" }; public static readonly List<string> allowSelectType = new List<string> { "selector", "urltest", "loadbalance", "fallback" };

View File

@@ -85,7 +85,7 @@ namespace ClashN.Handler
{ {
if (args.Success) if (args.Success)
{ {
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "clashN")); _updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "ClashN"));
url = args.Msg; url = args.Msg;
AskToDownload(downloadHandle, url, true); AskToDownload(downloadHandle, url, true);
@@ -96,7 +96,7 @@ namespace ClashN.Handler
_updateFunc(false, args.Msg); _updateFunc(false, args.Msg);
} }
}; };
_updateFunc(false, string.Format(ResUI.MsgStartUpdating, "clashN")); _updateFunc(false, string.Format(ResUI.MsgStartUpdating, "ClashN"));
CheckUpdateAsync(CoreKind.ClashN); CheckUpdateAsync(CoreKind.ClashN);
} }

View File

@@ -5,8 +5,8 @@ namespace ClashN.Mode
public class ProfileItemModel : ProfileItem public class ProfileItemModel : ProfileItem
{ {
public bool IsActive { get; set; } public bool IsActive { get; set; }
public bool HasUrl => string.IsNullOrEmpty(url); public bool HasUrl => !string.IsNullOrEmpty(url);
public bool HasAddress => string.IsNullOrEmpty(address); public bool HasAddress => !string.IsNullOrEmpty(address);
public string StrUpdateTime public string StrUpdateTime
{ {
get get

View File

@@ -39,7 +39,7 @@ namespace ClashN.Properties {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("clashN.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ClashN.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;

File diff suppressed because it is too large Load Diff

View File

@@ -464,7 +464,7 @@
<value>چک کردن</value> <value>چک کردن</value>
</data> </data>
<data name="TbHelpProject" xml:space="preserve"> <data name="TbHelpProject" xml:space="preserve">
<value>پروژه clashN</value> <value>پروژه ClashN</value>
</data> </data>
<data name="TbHelpProjectGo" xml:space="preserve"> <data name="TbHelpProjectGo" xml:space="preserve">
<value>Go to</value> <value>Go to</value>

View File

@@ -464,7 +464,7 @@
<value>Check</value> <value>Check</value>
</data> </data>
<data name="TbHelpProject" xml:space="preserve"> <data name="TbHelpProject" xml:space="preserve">
<value>clashN Project</value> <value>ClashN Project</value>
</data> </data>
<data name="TbHelpProjectGo" xml:space="preserve"> <data name="TbHelpProjectGo" xml:space="preserve">
<value>Go to</value> <value>Go to</value>

View File

@@ -464,7 +464,7 @@
<value>检查更新</value> <value>检查更新</value>
</data> </data>
<data name="TbHelpProject" xml:space="preserve"> <data name="TbHelpProject" xml:space="preserve">
<value>clashN 项目</value> <value>ClashN 项目</value>
</data> </data>
<data name="TbHelpProjectGo" xml:space="preserve"> <data name="TbHelpProjectGo" xml:space="preserve">
<value>打开</value> <value>打开</value>

View File

@@ -6,20 +6,20 @@ namespace ClashN
{ {
public static void Show(string msg) public static void Show(string msg)
{ {
MessageBox.Show(msg, "clashN", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(msg, "ClashN", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
public static void ShowWarning(string msg) public static void ShowWarning(string msg)
{ {
MessageBox.Show(msg, "clashN", MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(msg, "ClashN", MessageBoxButtons.OK, MessageBoxIcon.Warning);
} }
public static void ShowError(string msg) public static void ShowError(string msg)
{ {
MessageBox.Show(msg, "clashN", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(msg, "ClashN", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
public static DialogResult ShowYesNo(string msg) public static DialogResult ShowYesNo(string msg)
{ {
return MessageBox.Show(msg, "clashN", MessageBoxButtons.YesNo, MessageBoxIcon.Question); return MessageBox.Show(msg, "ClashN", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
} }
//public static string GetResourseString(string key) //public static string GetResourseString(string key)

View File

@@ -9,6 +9,7 @@ using MaterialDesignThemes.Wpf;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Splat; using Splat;
using System;
using System.IO; using System.IO;
using System.Reactive; using System.Reactive;
using System.Windows.Forms; using System.Windows.Forms;
@@ -313,6 +314,10 @@ namespace ClashN.ViewModels
{ {
return; return;
} }
if (SelectedSource?.indexId == _config.IndexId)
{
return;
}
var item = _config.GetProfileItem(SelectedSource.indexId); var item = _config.GetProfileItem(SelectedSource.indexId);
if (item is null) if (item is null)
{ {
@@ -375,7 +380,8 @@ namespace ClashN.ViewModels
var img = QRCodeHelper.GetQRCode(item.url); var img = QRCodeHelper.GetQRCode(item.url);
var dialog = new ProfileQrcodeView() var dialog = new ProfileQrcodeView()
{ {
imgQrcode = { Source = img } imgQrcode = { Source = img } ,
txtContent = { Text = item.url },
}; };
await DialogHost.Show(dialog, "RootDialog"); await DialogHost.Show(dialog, "RootDialog");

View File

@@ -41,7 +41,7 @@ namespace ClashN.ViewModels
public ReactiveCommand<Unit, Unit> EditMixinContentCmd { get; } public ReactiveCommand<Unit, Unit> EditMixinContentCmd { get; }
#endregion #endregion
#region clashN #region ClashN
[Reactive] [Reactive]
public bool AutoRun { get; set; } public bool AutoRun { get; set; }
@@ -109,7 +109,7 @@ namespace ClashN.ViewModels
EditMixinContent(); EditMixinContent();
}, this.IsValid()); }, this.IsValid());
//clashN //ClashN
AutoRun = _config.AutoRun; AutoRun = _config.AutoRun;
EnableStatistics = _config.EnableStatistics; EnableStatistics = _config.EnableStatistics;
EnableSecurityProtocolTls13 = _config.EnableSecurityProtocolTls13; EnableSecurityProtocolTls13 = _config.EnableSecurityProtocolTls13;
@@ -244,7 +244,7 @@ namespace ClashN.ViewModels
_config.LogLevel = LogLevel; _config.LogLevel = LogLevel;
_config.EnableMixinContent = EnableMixinContent; _config.EnableMixinContent = EnableMixinContent;
//clashN //ClashN
Utils.SetAutoRun(AutoRun); Utils.SetAutoRun(AutoRun);
_config.AutoRun = AutoRun; _config.AutoRun = AutoRun;
_config.EnableStatistics = EnableStatistics; _config.EnableStatistics = EnableStatistics;

View File

@@ -29,7 +29,10 @@
<ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top"> <ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top">
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}"> <ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
<Button Width="1" Visibility="Hidden"> <Button Width="1" Visibility="Hidden">
<materialDesign:PackIcon Kind="ContentSave" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="ContentSave" />
</Button> </Button>
<TextBlock <TextBlock
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -50,7 +53,10 @@
<Separator /> <Separator />
<Button x:Name="btnConnectionCloseAll" ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}"> <Button x:Name="btnConnectionCloseAll" ToolTip="{x:Static resx:ResUI.menuConnectionCloseAll}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Close" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Close" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuConnectionCloseAll}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuConnectionCloseAll}" />
</StackPanel> </StackPanel>
</Button> </Button>

View File

@@ -10,7 +10,7 @@
xmlns:reactiveui="http://reactiveui.net" xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ClashN.Resx" xmlns:resx="clr-namespace:ClashN.Resx"
xmlns:vms="clr-namespace:ClashN.ViewModels" xmlns:vms="clr-namespace:ClashN.ViewModels"
Title="clashN" Title="ClashN"
Width="600" Width="600"
Height="500" Height="500"
x:TypeArguments="vms:ProfileEditViewModel" x:TypeArguments="vms:ProfileEditViewModel"

View File

@@ -24,7 +24,10 @@
<ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top"> <ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top">
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}"> <ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
<Button Width="1" Visibility="Hidden"> <Button Width="1" Visibility="Hidden">
<materialDesign:PackIcon Kind="ContentSave" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="ContentSave" />
</Button> </Button>
<TextBlock <TextBlock
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -37,7 +40,10 @@
<Separator /> <Separator />
<Button x:Name="btnDelete" Click="btnDelete_Click"> <Button x:Name="btnDelete" Click="btnDelete_Click">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Delete" />
</StackPanel> </StackPanel>
</Button> </Button>
<Separator /> <Separator />

View File

@@ -32,7 +32,7 @@
Style="{StaticResource MaterialDesignEmbeddedDialogHost}"> Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
<Grid> <Grid>
<Grid Grid.Column="0"> <Grid Grid.Column="0">
<TabControl Style="{StaticResource MaterialDesignNavigatilRailTabControl}" Padding="10, 0"> <TabControl Padding="2,0" Style="{StaticResource MaterialDesignNavigatilRailTabControl}">
<materialDesign:NavigationRailAssist.FloatingContent> <materialDesign:NavigationRailAssist.FloatingContent>
<StackPanel <StackPanel
Width="auto" Width="auto"
@@ -73,7 +73,7 @@
<Button <Button
x:Name="btnReload" x:Name="btnReload"
Content="{materialDesign:PackIcon Kind=Reload}" Content="{materialDesign:PackIcon Kind=Reload}"
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}" Style="{StaticResource MaterialDesignFloatingActionMiniButton}"
ToolTip="{x:Static resx:ResUI.TbReloadCore}" /> ToolTip="{x:Static resx:ResUI.TbReloadCore}" />
</StackPanel> </StackPanel>
</materialDesign:NavigationRailAssist.FloatingContent> </materialDesign:NavigationRailAssist.FloatingContent>
@@ -208,7 +208,7 @@
<tb:TaskbarIcon <tb:TaskbarIcon
x:Name="tbNotify" x:Name="tbNotify"
IconSource="/clashN.ico" IconSource="/ClashN.ico"
NoLeftClickDelay="True"> NoLeftClickDelay="True">
<tb:TaskbarIcon.ContextMenu> <tb:TaskbarIcon.ContextMenu>
<ContextMenu Style="{StaticResource DefMenu}"> <ContextMenu Style="{StaticResource DefMenu}">

View File

@@ -11,7 +11,7 @@
xmlns:reactiveui="http://reactiveui.net" xmlns:reactiveui="http://reactiveui.net"
xmlns:resx="clr-namespace:ClashN.Resx" xmlns:resx="clr-namespace:ClashN.Resx"
xmlns:vms="clr-namespace:ClashN.ViewModels" xmlns:vms="clr-namespace:ClashN.ViewModels"
Title="clashN" Title="ClashN"
Width="700" Width="700"
Height="600" Height="600"
x:TypeArguments="vms:ProfileEditViewModel" x:TypeArguments="vms:ProfileEditViewModel"

View File

@@ -6,28 +6,44 @@
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ClashN.Resx" xmlns:resx="clr-namespace:ClashN.Resx"
MaxWidth="400"
d:DesignHeight="300" d:DesignHeight="300"
d:DesignWidth="300" d:DesignWidth="300"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Margin="16"> <Grid Margin="30">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition /> <RowDefinition Height="Auto" />
<RowDefinition /> <RowDefinition Height="Auto" />
<RowDefinition Height="60" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Image <Image
Name="imgQrcode" x:Name="imgQrcode"
Grid.Row="0"
Width="300" Width="300"
Height="300" Height="300"
Stretch="UniformToFill" /> Stretch="UniformToFill" />
<Button
<TextBox
x:Name="txtContent"
Grid.Row="1" Grid.Row="1"
Margin="16" Width="300"
Margin="0,8"
VerticalAlignment="Center"
IsReadOnly="True"
MaxLines="3"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
<Button
Grid.Row="2"
Width="100"
Margin="8"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
Content="{x:Static resx:ResUI.TbConfirm}" Content="{x:Static resx:ResUI.TbConfirm}"
IsCancel="True" IsCancel="True"
IsDefault="True" IsDefault="True"
Style="{StaticResource MaterialDesignFlatButton}" /> Style="{StaticResource MaterialDesignFlatButton}" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -27,35 +27,60 @@
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}"> <ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
<Button x:Name="btnAddProfile" ToolTip="{x:Static resx:ResUI.menuAddProfile}"> <Button x:Name="btnAddProfile" ToolTip="{x:Static resx:ResUI.menuAddProfile}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Plus" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Plus" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuAddProfile}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuAddProfile}" />
</StackPanel> </StackPanel>
</Button> </Button>
<Separator /> <Separator />
<Button x:Name="btnAddProfileViaClipboard" ToolTip="{x:Static resx:ResUI.menuAddProfileViaClipboard}"> <Button x:Name="btnAddProfileViaClipboard" ToolTip="{x:Static resx:ResUI.menuAddProfileViaClipboard}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ContentPaste" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="ContentPaste" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbAddProfileViaClipboard}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbAddProfileViaClipboard}" />
</StackPanel> </StackPanel>
</Button> </Button>
<Separator /> <Separator />
<Button x:Name="btnSubUpdateViaProxy" ToolTip="{x:Static resx:ResUI.menuSubUpdateViaProxy}"> <Button x:Name="btnSubUpdateViaProxy" ToolTip="{x:Static resx:ResUI.menuSubUpdateViaProxy}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Update" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Update" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbSubUpdateViaProxy}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbSubUpdateViaProxy}" />
</StackPanel> </StackPanel>
</Button> </Button>
<Separator /> <Separator />
<Button x:Name="btnEditProfile" ToolTip="{x:Static resx:ResUI.menuEditProfile}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Edit" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuEditProfile}" />
</StackPanel>
</Button>
<Separator />
<Button x:Name="btnSetDefaultProfile" ToolTip="{x:Static resx:ResUI.menuSetDefaultProfile}"> <Button x:Name="btnSetDefaultProfile" ToolTip="{x:Static resx:ResUI.menuSetDefaultProfile}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Check" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="Check" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbSetDefaultProfile}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbSetDefaultProfile}" />
</StackPanel> </StackPanel>
</Button> </Button>
<Separator /> <Separator />
<Button x:Name="btnProfileQrcode" ToolTip="{x:Static resx:ResUI.menuProfileQrcode}"> <Button x:Name="btnProfileQrcode" ToolTip="{x:Static resx:ResUI.menuProfileQrcode}">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="QrcodePlus" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="QrcodePlus" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuProfileQrcode}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.menuProfileQrcode}" />
</StackPanel> </StackPanel>
</Button> </Button>
@@ -107,7 +132,7 @@
Background="{DynamicResource PrimaryHueLightBrush}" Background="{DynamicResource PrimaryHueLightBrush}"
CornerRadius="4" CornerRadius="4"
DockPanel.Dock="Left" DockPanel.Dock="Left"
Visibility="{Binding Path=isActive, Converter={StaticResource BoolToVisConverter}}" /> Visibility="{Binding Path=IsActive, Converter={StaticResource BoolToVisConverter}}" />
<Grid> <Grid>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
@@ -160,7 +185,10 @@
HorizontalAlignment="Left" HorizontalAlignment="Left"
VerticalAlignment="Center" VerticalAlignment="Center"
Orientation="Horizontal"> Orientation="Horizontal">
<materialDesign:PackIcon Kind="ChartDonut" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="ChartDonut" />
<TextBlock <TextBlock
Padding="4,0,4,0" Padding="4,0,4,0"
Style="{StaticResource ListItemSubTitle}" Style="{StaticResource ListItemSubTitle}"

View File

@@ -58,6 +58,7 @@ namespace ClashN.Views
this.BindCommand(ViewModel, vm => vm.AddProfileCmd, v => v.btnAddProfile).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.AddProfileCmd, v => v.btnAddProfile).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.AddProfileViaClipboardCmd, v => v.btnAddProfileViaClipboard).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.AddProfileViaClipboardCmd, v => v.btnAddProfileViaClipboard).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.btnSubUpdateViaProxy).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.btnSubUpdateViaProxy).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.EditProfileCmd, v => v.btnEditProfile).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SetDefaultProfileCmd, v => v.btnSetDefaultProfile).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SetDefaultProfileCmd, v => v.btnSetDefaultProfile).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ProfileQrcodeCmd, v => v.btnProfileQrcode).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ProfileQrcodeCmd, v => v.btnProfileQrcode).DisposeWith(disposables);
@@ -96,7 +97,7 @@ namespace ClashN.Views
private void lstProfiles_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e) private void lstProfiles_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
{ {
ViewModel?.EditProfile(false); ViewModel?.SetDefaultProfile();
} }
#region Drag and Drop #region Drag and Drop

View File

@@ -30,7 +30,10 @@
<ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top"> <ToolBarTray Margin="0,8,0,8" DockPanel.Dock="Top">
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}"> <ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
<Button Width="1" Visibility="Hidden"> <Button Width="1" Visibility="Hidden">
<materialDesign:PackIcon Kind="ContentSave" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="ContentSave" />
</Button> </Button>
<TextBlock <TextBlock
VerticalAlignment="Center" VerticalAlignment="Center"
@@ -98,13 +101,13 @@
<DockPanel> <DockPanel>
<ListView <ListView
x:Name="lstProxyGroups" x:Name="lstProxyGroups"
Margin="0, 0, 5, 0" Margin="0,0,5,0"
BorderThickness="0" BorderThickness="0"
DockPanel.Dock="Left" DockPanel.Dock="Left"
Style="{StaticResource MaterialDesignListView}"
ItemContainerStyle="{StaticResource lvItemSelected}" ItemContainerStyle="{StaticResource lvItemSelected}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Visible"> ScrollViewer.VerticalScrollBarVisibility="Visible"
Style="{StaticResource MaterialDesignListView}">
<ListView.ContextMenu> <ListView.ContextMenu>
<ContextMenu Style="{StaticResource DefMenu}"> <ContextMenu Style="{StaticResource DefMenu}">
<MenuItem x:Name="menuProxiesReload" Header="{x:Static resx:ResUI.menuProxiesReload}" /> <MenuItem x:Name="menuProxiesReload" Header="{x:Static resx:ResUI.menuProxiesReload}" />
@@ -118,7 +121,7 @@
</ListView.ItemsPanel> </ListView.ItemsPanel>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border Width="160" Padding="0"> <Border Width="200" Padding="0">
<DockPanel> <DockPanel>
<Grid Grid.Column="0" Margin="4"> <Grid Grid.Column="0" Margin="4">
<Grid.RowDefinitions> <Grid.RowDefinitions>
@@ -146,10 +149,10 @@
<ListView <ListView
x:Name="lstProxyDetails" x:Name="lstProxyDetails"
BorderThickness="0" BorderThickness="0"
Style="{StaticResource MaterialDesignListView}"
ItemContainerStyle="{StaticResource lvItemSelected}" ItemContainerStyle="{StaticResource lvItemSelected}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
ScrollViewer.VerticalScrollBarVisibility="Visible"> ScrollViewer.VerticalScrollBarVisibility="Visible"
Style="{StaticResource MaterialDesignListView}">
<ListView.ContextMenu> <ListView.ContextMenu>
<ContextMenu Style="{StaticResource DefMenu}"> <ContextMenu Style="{StaticResource DefMenu}">
<MenuItem x:Name="menuProxiesDelaytestPart" Header="{x:Static resx:ResUI.menuProxiesDelaytestPart}" /> <MenuItem x:Name="menuProxiesDelaytestPart" Header="{x:Static resx:ResUI.menuProxiesDelaytestPart}" />
@@ -163,7 +166,7 @@
</ListView.ItemsPanel> </ListView.ItemsPanel>
<ListView.ItemTemplate> <ListView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Border Width="160" Padding="0" KeyDown="ProxyItem_KeyDown"> <Border Width="200" Padding="0">
<DockPanel> <DockPanel>
<Border <Border
Width="5" Width="5"

View File

@@ -16,6 +16,7 @@ namespace ClashN.Views
InitializeComponent(); InitializeComponent();
ViewModel = new ProxiesViewModel(); ViewModel = new ProxiesViewModel();
Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(ProxiesViewModel)); Locator.CurrentMutable.RegisterLazySingleton(() => ViewModel, typeof(ProxiesViewModel));
lstProxyDetails.PreviewMouseDoubleClick += lstProxyDetails_PreviewMouseDoubleClick;
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
@@ -54,18 +55,10 @@ namespace ClashN.Views
} }
} }
private void lstProxyDetails_PreviewMouseDoubleClick(object sender, MouseButtonEventArgs e)
private object? lastProxyItemKeyDownSender;
private int lastProxyItemKeyDownTimestamp;
private void ProxyItem_KeyDown(object sender, KeyEventArgs e)
{
if (sender == lastProxyItemKeyDownSender && e.Timestamp - lastProxyItemKeyDownTimestamp < 500)
{ {
ViewModel?.SetActiveProxy(); ViewModel?.SetActiveProxy();
} }
lastProxyItemKeyDownSender = sender;
lastProxyItemKeyDownTimestamp = e.Timestamp;
}
} }
} }

View File

@@ -23,7 +23,10 @@
<ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}"> <ToolBar ClipToBounds="True" Style="{StaticResource MaterialDesignToolBar}">
<Button x:Name="btnSave"> <Button x:Name="btnSave">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="ContentSave" /> <materialDesign:PackIcon
Margin="0,0,8,0"
VerticalAlignment="Center"
Kind="ContentSave" />
<TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbSave}" /> <TextBlock Style="{StaticResource ToolbarItem}" Text="{x:Static resx:ResUI.TbSave}" />
</StackPanel> </StackPanel>
</Button> </Button>

View File

@@ -7,39 +7,39 @@
<UseWPF>true</UseWPF> <UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>clashN.ico</ApplicationIcon> <ApplicationIcon>ClashN.ico</ApplicationIcon>
<Copyright>Copyright © 2019-2023 (GPLv3)</Copyright> <Copyright>Copyright © 2019-2023 (GPLv3)</Copyright>
<FileVersion>2.14</FileVersion> <FileVersion>2.14</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="4.6.1" /> <PackageReference Include="MaterialDesignThemes" Version="4.8.0" />
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" /> <PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="1.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NHotkey" Version="2.1.0" /> <PackageReference Include="NHotkey" Version="2.1.0" />
<PackageReference Include="NHotkey.Wpf" Version="2.1.0" /> <PackageReference Include="NHotkey.Wpf" Version="2.1.0" />
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" /> <PackageReference Include="QRCoder.Xaml" Version="1.4.3" />
<PackageReference Include="TaskScheduler" Version="2.10.1" /> <PackageReference Include="TaskScheduler" Version="2.10.1" />
<PackageReference Include="YamlDotNet" Version="12.0.2" /> <PackageReference Include="YamlDotNet" Version="13.0.1" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.10" /> <PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
<PackageReference Include="ReactiveUI.Fody" Version="18.3.1" /> <PackageReference Include="ReactiveUI.Fody" Version="18.3.1" />
<PackageReference Include="ReactiveUI.Validation" Version="3.0.1" /> <PackageReference Include="ReactiveUI.Validation" Version="3.0.1" />
<PackageReference Include="ReactiveUI.WPF" Version="18.3.1" /> <PackageReference Include="ReactiveUI.WPF" Version="18.3.1" />
<PackageReference Include="Splat.NLog" Version="14.4.1" /> <PackageReference Include="Splat.NLog" Version="14.6.8" />
<PackageReference Include="System.Reactive" Version="5.0.0" /> <PackageReference Include="System.Reactive" Version="5.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Remove="clashN.ico" /> <None Remove="ClashN.ico" />
<AdditionalFiles Include="app.manifest" /> <AdditionalFiles Include="app.manifest" />
<EmbeddedResource Include="clashN.ico"> <EmbeddedResource Include="ClashN.ico">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="Sample\SampleMixin.yaml" /> <EmbeddedResource Include="Sample\SampleMixin.yaml" />
<EmbeddedResource Include="Sample\SampleTun.yaml" /> <EmbeddedResource Include="Sample\SampleTun.yaml" />
<ProjectReference Include="..\..\..\v2rayN\v2rayN\PacLib\PacLib.csproj" /> <ProjectReference Include="..\..\..\v2rayN\v2rayN\PacLib\PacLib.csproj" />
<Resource Include="clashN.ico"> <Resource Include="ClashN.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource> </Resource>
<Compile Update="Resx\ResUI.Designer.cs"> <Compile Update="Resx\ResUI.Designer.cs">