diff --git a/App.xaml b/App.xaml index f3ca95c..c815002 100644 --- a/App.xaml +++ b/App.xaml @@ -14,6 +14,7 @@ xmlns:settingsPages="clr-namespace:SparkClient.ViewModel.Configuration.SettingsPages" xmlns:settingPages="clr-namespace:SparkClient.Views.Configuration.SettingPages" xmlns:configuration="clr-namespace:System.Configuration;assembly=System.Configuration.ConfigurationManager" + xmlns:sparkClient="clr-namespace:SparkClient" StartupUri="MainWindow.xaml"> @@ -28,6 +29,9 @@ + + + diff --git a/Language/zh_CN.xaml b/Language/zh_CN.xaml index e9922cf..fbb2153 100644 --- a/Language/zh_CN.xaml +++ b/Language/zh_CN.xaml @@ -117,6 +117,26 @@ 选择 请选择 定级标准 + 主体颜色 + 交互颜色 + 面类别颜色 + 面部颜色 + 边框颜色 + 选中面颜色 + 选中面边框颜色 + 选中面同类面颜色 + 选中面文字信息颜色 + 标识线条颜色 + 正方向标记颜色 + 瑕疵面颜色 + 台面颜色 + 风筝面颜色 + 星刻面颜色 + 上腰面颜色 + 腰面颜色 + 亭部主刻面颜色 + 下腰面颜色 + 底面颜色 diff --git a/MainWindow.xaml b/MainWindow.xaml index 137b8ad..7711ace 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -14,150 +14,29 @@ MinHeight="400" MinWidth="800" - + StateChanged="MainWindow_OnStateChanged" Loaded="MainWindow_OnLoaded" WindowState="Maximized" Background="{DynamicResource SecondaryRegionBrush}"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - + + + + - + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index 674520d..ee17cff 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -8,6 +8,7 @@ using HandyControl.Tools; using log4net; using log4net.Config; using SparkClient.Model.Helper; +using SparkClient.ViewModel; using SparkClient.ViewModel.BaseWindow; using SparkClient.Views.BaseWindow; using Window = System.Windows.Window; @@ -25,6 +26,14 @@ public partial class MainWindow { InitializeComponent(); Logger.Info("Application started"); + var vm = DataContext as MainWindowViewModel; + if (vm != null) + { + vm.RequestMinimizeWindow += () => + { + this.WindowState = WindowState.Minimized; + }; + } } protected override void OnContentRendered(EventArgs e) @@ -42,6 +51,7 @@ public partial class MainWindow //初始化 // ConfigHelper.Instance.SetLang("en"); DataBaseHelper.CreateConnection(); + this.WindowState = WindowState.Maximized; } #region 重写窗体操作按钮 @@ -108,5 +118,16 @@ public partial class MainWindow #endregion - + private void MainWindow_OnStateChanged(object? sender, EventArgs e) + { + if (this.WindowState == WindowState.Normal || this.WindowState == WindowState.Maximized) + { + this.WindowState = WindowState.Maximized; + } + } + + private void FrameworkElement_OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + + } } \ No newline at end of file diff --git a/Resource/Images/UIResource/01-8-1.png b/Resource/Images/UIResource/01-8-1.png new file mode 100644 index 0000000..ee3e8fa Binary files /dev/null and b/Resource/Images/UIResource/01-8-1.png differ diff --git a/Resource/Images/UIResource/01-8.png b/Resource/Images/UIResource/01-8.png new file mode 100644 index 0000000..3ca7ec6 Binary files /dev/null and b/Resource/Images/UIResource/01-8.png differ diff --git a/Resource/Images/UIResource/01-bg.jpg b/Resource/Images/UIResource/01-bg.jpg new file mode 100644 index 0000000..08366cd Binary files /dev/null and b/Resource/Images/UIResource/01-bg.jpg differ diff --git a/Resource/Images/UIResource/02-2.png b/Resource/Images/UIResource/02-2.png new file mode 100644 index 0000000..baaebfb Binary files /dev/null and b/Resource/Images/UIResource/02-2.png differ diff --git a/Resource/Images/UIResource/02-3.png b/Resource/Images/UIResource/02-3.png new file mode 100644 index 0000000..431cf4f Binary files /dev/null and b/Resource/Images/UIResource/02-3.png differ diff --git a/Resource/Images/UIResource/03-1-1.png b/Resource/Images/UIResource/03-1-1.png new file mode 100644 index 0000000..dc2f4f0 Binary files /dev/null and b/Resource/Images/UIResource/03-1-1.png differ diff --git a/Resource/Images/UIResource/03-1.png b/Resource/Images/UIResource/03-1.png new file mode 100644 index 0000000..183471d Binary files /dev/null and b/Resource/Images/UIResource/03-1.png differ diff --git a/SparkClient.csproj b/SparkClient.csproj index d98a357..3590ad4 100644 --- a/SparkClient.csproj +++ b/SparkClient.csproj @@ -111,6 +111,18 @@ + + + + + + + + + + + + diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs new file mode 100644 index 0000000..521f947 --- /dev/null +++ b/ViewModel/MainWindowViewModel.cs @@ -0,0 +1,17 @@ +using System.Windows.Input; +using CommunityToolkit.Mvvm.Input; + +namespace SparkClient.ViewModel; + +public class MainWindowViewModel +{ + public ICommand MinimizeWindowCommand { get; } + + public event Action RequestMinimizeWindow; + + public MainWindowViewModel() + { + // 定义命令,当执行时触发 RequestMinimizeWindow 事件 + MinimizeWindowCommand = new RelayCommand(() => RequestMinimizeWindow?.Invoke()); + } +} \ No newline at end of file diff --git a/Views/BaseWindow/BaseControl.xaml b/Views/BaseWindow/BaseControl.xaml index 4a6327b..9bc7375 100644 --- a/Views/BaseWindow/BaseControl.xaml +++ b/Views/BaseWindow/BaseControl.xaml @@ -5,75 +5,120 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:hc="https://handyorg.github.io/handycontrol" mc:Ignorable="d" - Margin="10" CornerRadius="15" + Loaded="BaseControl_OnLoaded" > - + - - + + - - + + + + + + + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + - + diff --git a/Views/BaseWindow/BaseControl.xaml.cs b/Views/BaseWindow/BaseControl.xaml.cs index 233fb08..79bbea4 100644 --- a/Views/BaseWindow/BaseControl.xaml.cs +++ b/Views/BaseWindow/BaseControl.xaml.cs @@ -2,12 +2,14 @@ using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; +using SparkClient.Model.Helper; using SparkClient.ViewModel.BaseWindow; namespace SparkClient.Views.BaseWindow; -public partial class BaseControl +public partial class BaseControl { + private Window parentWindow; public BaseControl() { InitializeComponent(); @@ -52,4 +54,46 @@ public partial class BaseControl RadiusY = this.CornerRadius.TopLeft }; } + + + private void Minimize_Click(object sender, MouseButtonEventArgs e) + { + //this.WindowState = WindowState.Minimized; + if(parentWindow != null)parentWindow.WindowState = WindowState.Minimized; + } + + private void Close_Click(object sender, MouseButtonEventArgs e) + { + var message = MultilingualHelper.getString("ExitAsk"); + var title = MultilingualHelper.getString("ExitAskTitle"); + + MessageBoxResult result = HandyControl.Controls.MessageBox.Show( message, title, MessageBoxButton.YesNo, MessageBoxImage.Question ); + + if (result == MessageBoxResult.Yes) + { + + Environment.Exit(0); + } + } + + private void UIElement_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + if (e.LeftButton == MouseButtonState.Pressed) + { + try + { + // this.DragMove(); + } + catch (InvalidOperationException ex) + { + + } + } + } + + + private void BaseControl_OnLoaded(object sender, RoutedEventArgs e) + { + parentWindow = Window.GetWindow(this); + } } \ No newline at end of file diff --git a/Views/BaseWindow/HomeWindow.xaml b/Views/BaseWindow/HomeWindow.xaml index f4efc17..c3d2be3 100644 --- a/Views/BaseWindow/HomeWindow.xaml +++ b/Views/BaseWindow/HomeWindow.xaml @@ -10,7 +10,7 @@ > - + diff --git a/Views/Configuration/ConfigMenuPage.xaml b/Views/Configuration/ConfigMenuPage.xaml index 53e6d86..d2d63c9 100644 --- a/Views/Configuration/ConfigMenuPage.xaml +++ b/Views/Configuration/ConfigMenuPage.xaml @@ -6,19 +6,19 @@ xmlns:local="clr-namespace:SparkClient.Views" mc:Ignorable="d" > - - - + + + - - - - - - - - + + + + + + + + @@ -38,88 +38,7 @@ - - - - - - - - - - - - - - - - - + diff --git a/Views/Configuration/ConfigMenuPage.xaml.cs b/Views/Configuration/ConfigMenuPage.xaml.cs index 3fd5e76..19f36da 100644 --- a/Views/Configuration/ConfigMenuPage.xaml.cs +++ b/Views/Configuration/ConfigMenuPage.xaml.cs @@ -15,57 +15,57 @@ public partial class ConfigMenuPage DataContext = new ConfigMenuPageVM(); } - private void LevelButton_OnMouseEnter(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgLevel.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Level_Sel@3x.png")); - tbLevel.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E");; - } - - private void LevelButton_OnMouseLeave(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgLevel.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Level_Def@3x.png")); - tbLevel.Foreground = new SolidColorBrush(Colors.Azure); - } - private void AlgorButton_OnMouseEnter(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgAlgor.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Algor_Sel@3x.png")); - tbAlgor.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E");; - } - - private void AlgorButton_OnMouseLeave(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgAlgor.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Algor_Def@3x.png")); - tbAlgor.Foreground = new SolidColorBrush(Colors.Azure); - } - private void CutButton_OnMouseEnter(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgCut.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Cut_Sel@3x.png")); - tbCut.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E");; - } - - private void CutButton_OnMouseLeave(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgCut.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Cut_Def@3x.png")); - tbCut.Foreground = new SolidColorBrush(Colors.Azure); - } - - private void SettingButton_OnMouseEnter(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgSet.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Setting_Sel@3x.png")); - tbSet.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E"); ; - } - - private void SettingButton_OnMouseLeave(object sender, MouseEventArgs e) - { - var brushConverter = new BrushConverter(); - imgSet.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Setting_Def@3x.png")); - tbSet.Foreground = new SolidColorBrush(Colors.Azure); - } + // private void LevelButton_OnMouseEnter(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgLevel.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Level_Sel@3x.png")); + // tbLevel.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E");; + // } + // + // private void LevelButton_OnMouseLeave(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgLevel.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Level_Def@3x.png")); + // tbLevel.Foreground = new SolidColorBrush(Colors.Azure); + // } + // private void AlgorButton_OnMouseEnter(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgAlgor.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Algor_Sel@3x.png")); + // tbAlgor.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E");; + // } + // + // private void AlgorButton_OnMouseLeave(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgAlgor.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Algor_Def@3x.png")); + // tbAlgor.Foreground = new SolidColorBrush(Colors.Azure); + // } + // private void CutButton_OnMouseEnter(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgCut.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Cut_Sel@3x.png")); + // tbCut.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E");; + // } + // + // private void CutButton_OnMouseLeave(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgCut.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Cut_Def@3x.png")); + // tbCut.Foreground = new SolidColorBrush(Colors.Azure); + // } + // + // private void SettingButton_OnMouseEnter(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgSet.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Setting_Sel@3x.png")); + // tbSet.Foreground = (Brush)brushConverter.ConvertFromString("#9C7C5E"); ; + // } + // + // private void SettingButton_OnMouseLeave(object sender, MouseEventArgs e) + // { + // var brushConverter = new BrushConverter(); + // imgSet.Source = new BitmapImage(new Uri(@"pack://application:,,,/Resource/Images/Setting_Def@3x.png")); + // tbSet.Foreground = new SolidColorBrush(Colors.Azure); + // } } \ No newline at end of file diff --git a/Views/Configuration/SettingPages/ModelColorSetPage.xaml b/Views/Configuration/SettingPages/ModelColorSetPage.xaml index c66ce8a..1939f6e 100644 --- a/Views/Configuration/SettingPages/ModelColorSetPage.xaml +++ b/Views/Configuration/SettingPages/ModelColorSetPage.xaml @@ -4,9 +4,243 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:SparkClient.Views.Configuration.SettingPages" + xmlns:hc="https://handyorg.github.io/handycontrol" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300"> + d:DesignHeight="300" d:DesignWidth="1000"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Views/Configuration/SettingPages/ModelColorSetPage.xaml.cs b/Views/Configuration/SettingPages/ModelColorSetPage.xaml.cs index df27909..7a9e227 100644 --- a/Views/Configuration/SettingPages/ModelColorSetPage.xaml.cs +++ b/Views/Configuration/SettingPages/ModelColorSetPage.xaml.cs @@ -1,4 +1,8 @@ using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using HandyControl.Controls; +using HandyControl.Tools; namespace SparkClient.Views.Configuration.SettingPages; @@ -8,4 +12,36 @@ public partial class ModelColorSetPage { InitializeComponent(); } + + private void LabelsColor_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + if (sender is Label label) + { + var picker = SingleOpenHelper.CreateControl(); + var window = new PopupWindow + { + PopupElement = picker + }; + picker.SelectedBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString((label.Content??"#FFFFFF").ToString())); + picker.Canceled += delegate { window.Close(); }; + picker.Confirmed += delegate + { + label.Background = picker.SelectedBrush; + label.Foreground = GetInverseBrush(picker.SelectedBrush); + label.Content = picker.SelectedBrush.ToString(); + + window.Close(); + }; + window.Show(label, false); + } + } + + public SolidColorBrush GetInverseBrush(SolidColorBrush selectedBrush) + { + Color originalColor = selectedBrush.Color; + Color inverseColor = Color.FromRgb((byte)(255 - originalColor.R), + (byte)(255 - originalColor.G), + (byte)(255 - originalColor.B)); + return new SolidColorBrush(inverseColor); + } } \ No newline at end of file