feat:颜色选择修正

master
sunhonglei 7 months ago
parent 494bd8bd78
commit 5dac03bb20
  1. 3
      ViewModel/Configuration/SettingBaseVM.cs
  2. 105
      ViewModel/Configuration/SettingsPages/ModelColorSetPageVM.cs
  3. 4
      ViewModel/Configuration/SettingsPages/SettingsVM.cs
  4. 44
      Views/Configuration/SettingPages/ModelColorSetPage.xaml
  5. 2
      Views/Configuration/SettingPages/ModelColorSetPage.xaml.cs
  6. 1
      Views/Grading/DiamondSelect.xaml

@ -1,3 +1,4 @@
using SparkClient.ViewModel.BaseWindow;
using SparkClient.ViewModel.Configuration.SettingsPages;
using System.Windows.Input;
@ -20,5 +21,7 @@ public class SettingBaseVM : BaseViewModel
public void Save(object param)
{
CustomSetContent.SaveUpdate(param);
ModelColorSetContent.SaveUpdate(param);
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
}

@ -1,7 +1,106 @@
using SparkClient.Model.Helper;
namespace SparkClient.ViewModel.Configuration.SettingsPages;
public class ModelColorSetPageVM
public class ModelColorSetPageVM : BaseViewModel
{
private string _FACET_COLOR;
private string _BORDER_COLOR;
private string _SELECTED_FACET_COLOR;
private string _SELECTED_BORDER_COLOR;
private string _SELECTED_TYPE_COLOR;
private string _SELECTED_FONT_COLOR;
private string _RULER_COLOR;
private string _ARROW_COLOR;
private string _BLEMISH_FACET_COLOR;
private string _TABLE_FACET_COLOR;
private string _UPPER_MAIN_FACET_COLOR;
private string _STAR_FACET_COLOR;
private string _UPPER_GIRDLE_FACET_COLOR;
private string _GIRDLE_FACET_COLOR;
private string _PAVILION_MAIN_FACET_COLOR;
private string _LOWER_GIRDLE_FACET_COLOR;
private string _CULET_COLOR;
public string FACET_COLOR { get { return _FACET_COLOR; } set { _FACET_COLOR = value; OnPropertyChanged(nameof(FACET_COLOR)); } }
public string BORDER_COLOR { get { return _BORDER_COLOR; } set { _BORDER_COLOR = value; OnPropertyChanged(nameof(BORDER_COLOR)); } }
public string SELECTED_FACET_COLOR { get { return _SELECTED_FACET_COLOR; } set { _SELECTED_FACET_COLOR = value; OnPropertyChanged(nameof(SELECTED_FACET_COLOR)); } }
public string SELECTED_BORDER_COLOR { get { return _SELECTED_BORDER_COLOR; } set { _SELECTED_BORDER_COLOR = value; OnPropertyChanged(nameof(SELECTED_BORDER_COLOR)); } }
public string SELECTED_TYPE_COLOR { get { return _SELECTED_TYPE_COLOR; } set { _SELECTED_TYPE_COLOR = value; OnPropertyChanged(nameof(SELECTED_TYPE_COLOR)); } }
public string SELECTED_FONT_COLOR { get { return _SELECTED_FONT_COLOR; } set { _SELECTED_FONT_COLOR = value; OnPropertyChanged(nameof(SELECTED_FONT_COLOR)); } }
public string RULER_COLOR { get { return _RULER_COLOR; } set { _RULER_COLOR = value; OnPropertyChanged(nameof(RULER_COLOR)); } }
public string ARROW_COLOR { get { return _ARROW_COLOR; } set { _ARROW_COLOR = value; OnPropertyChanged(nameof(ARROW_COLOR)); } }
public string BLEMISH_FACET_COLOR { get { return _BLEMISH_FACET_COLOR; } set { _BLEMISH_FACET_COLOR = value; OnPropertyChanged(nameof(BLEMISH_FACET_COLOR)); } }
public string TABLE_FACET_COLOR { get { return _TABLE_FACET_COLOR; } set { _TABLE_FACET_COLOR = value; OnPropertyChanged(nameof(TABLE_FACET_COLOR)); } }
public string UPPER_MAIN_FACET_COLOR { get { return _UPPER_MAIN_FACET_COLOR; } set { _UPPER_MAIN_FACET_COLOR = value; OnPropertyChanged(nameof(UPPER_MAIN_FACET_COLOR)); } }
public string STAR_FACET_COLOR { get { return _STAR_FACET_COLOR; } set { _STAR_FACET_COLOR = value; OnPropertyChanged(nameof(STAR_FACET_COLOR)); } }
public string UPPER_GIRDLE_FACET_COLOR { get { return _UPPER_GIRDLE_FACET_COLOR; } set { _UPPER_GIRDLE_FACET_COLOR = value; OnPropertyChanged(nameof(UPPER_GIRDLE_FACET_COLOR)); } }
public string GIRDLE_FACET_COLOR { get { return _GIRDLE_FACET_COLOR; } set { _GIRDLE_FACET_COLOR = value; OnPropertyChanged(nameof(GIRDLE_FACET_COLOR)); } }
public string PAVILION_MAIN_FACET_COLOR { get { return _PAVILION_MAIN_FACET_COLOR; } set { _PAVILION_MAIN_FACET_COLOR = value; OnPropertyChanged(nameof(PAVILION_MAIN_FACET_COLOR)); } }
public string LOWER_GIRDLE_FACET_COLOR { get { return _LOWER_GIRDLE_FACET_COLOR; } set { _LOWER_GIRDLE_FACET_COLOR = value; OnPropertyChanged(nameof(LOWER_GIRDLE_FACET_COLOR)); } }
public string CULET_COLOR { get { return _CULET_COLOR; } set { _CULET_COLOR = value; OnPropertyChanged(nameof(CULET_COLOR)); } }
private Dictionary<string, string> colors;
public ModelColorSetPageVM()
{
InitSetting();
}
private void InitSetting()
{
colors = new Dictionary<string, string>();
colors.Add("FACET_COLOR", "面部颜色");
colors.Add("BORDER_COLOR", "边框颜色");
colors.Add("SELECTED_FACET_COLOR", "选中面颜色");
colors.Add("SELECTED_BORDER_COLOR", "选中面边框颜色");
colors.Add("SELECTED_TYPE_COLOR", "选中面同类面颜色");
colors.Add("SELECTED_FONT_COLOR", "选中面文字信息颜色");
colors.Add("RULER_COLOR", "标识线条颜色");
colors.Add("ARROW_COLOR", "正方向标记颜色");
colors.Add("BLEMISH_FACET_COLOR", "瑕疵面颜色");
colors.Add("TABLE_FACET_COLOR", "台面颜色");
colors.Add("UPPER_MAIN_FACET_COLOR", "风筝面颜色");
colors.Add("STAR_FACET_COLOR", "星刻面颜色");
colors.Add("UPPER_GIRDLE_FACET_COLOR", "上腰面颜色");
colors.Add("GIRDLE_FACET_COLOR", "腰面颜色");
colors.Add("PAVILION_MAIN_FACET_COLOR", "亭部主刻面颜色");
colors.Add("LOWER_GIRDLE_FACET_COLOR", "下腰面颜色");
colors.Add("CULET_COLOR", "底面颜色");
foreach (var color in colors)
{
setColor(color.Key);
}
}
public void SaveUpdate(object param)
{
DataBaseHelper.BeginTransaction();
foreach(var color in colors)
{
updateDataBase(color.Key);
}
DataBaseHelper.commit();
}
private void updateDataBase(string SETTING_ID)
{
Type type = this.GetType();
Settings colorData = new Settings()
{
Key = SETTING_ID,
ItemName = colors[SETTING_ID],
Value = (string)type.GetProperty(SETTING_ID).GetValue(this),
};
colorData.insert();
}
private void setColor(string SETTING_ID)
{
var value = Settings.SelectValueByName("SETTING_ID");
if (value == null || string.IsNullOrEmpty(value))
{
value = "#FF000000";
}
Type type = this.GetType();
type.GetProperty(SETTING_ID).SetValue(this, value);
}
}

@ -101,8 +101,6 @@ namespace SparkClient.ViewModel.Configuration.SettingsPages
MultilingualHelper.setLanguage(_languageId);
updateDataBase();
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
private void updateDataBase()
{
@ -184,7 +182,7 @@ namespace SparkClient.ViewModel.Configuration.SettingsPages
}
}
}
class Settings
public class Settings
{
private static string TABLE_NAME = "SETTING";

@ -21,7 +21,7 @@
<Setter Property="FontSize" Value="16" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="Padding" Value="0 0 10 0" />
</Style>
</Style>
<!-- <Style x:Key="CheckBoxStyle" TargetType="CheckBox"> -->
<!-- <Setter Property="VerticalAlignment" Value="Center" /> -->
<!-- <Setter Property="FontSize" Value="16" /> -->
@ -29,7 +29,7 @@
<!-- <Setter Property="Padding" Value="0 0 10 0" /> -->
<!-- <Setter Property="Margin" Value="0 5" /> -->
<!-- </Style> -->
</Border.Resources>
<Grid>
<Grid.RowDefinitions>
@ -40,7 +40,7 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Border Grid.Row="0" Style="{StaticResource BorderRowStyle}">
<Grid>
<Grid.ColumnDefinitions>
@ -60,7 +60,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetMainFaceColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
@ -68,7 +68,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetMainBorderColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding BORDER_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
</Grid>
</Grid>
@ -99,7 +99,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetSelectedColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding SELECTED_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="2" Row="0">
<Grid.ColumnDefinitions>
@ -107,7 +107,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetSelectedBorderColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding SELECTED_BORDER_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="4" Row="0">
<Grid.ColumnDefinitions>
@ -115,7 +115,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetSelectedTypeColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding SELECTED_TYPE_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="0" Row="2">
<Grid.ColumnDefinitions>
@ -123,7 +123,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetSelectedTextColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Center" Content="{Binding SELECTED_FONT_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" Height="28" VerticalAlignment="Top" />
</Grid>
<Grid Grid.Column="2" Row="2">
<Grid.ColumnDefinitions>
@ -131,7 +131,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetSelectedLineColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding RULER_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="4" Row="2">
<Grid.ColumnDefinitions>
@ -139,7 +139,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetSelectedPosdColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding ARROW_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
</Grid>
</Grid>
@ -166,13 +166,13 @@
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="250"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Row="0">
<Grid Grid.Column="0" Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetErrorColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding BLEMISH_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="2" Row="0">
<Grid.ColumnDefinitions>
@ -180,7 +180,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetTableColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding TABLE_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="4" Row="0">
<Grid.ColumnDefinitions>
@ -188,7 +188,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetUpperColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding UPPER_MAIN_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="0" Row="2">
<Grid.ColumnDefinitions>
@ -196,7 +196,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetStarColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding STAR_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="2" Row="2">
<Grid.ColumnDefinitions>
@ -204,7 +204,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetUpperGirdleColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding UPPER_GIRDLE_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="4" Row="2">
<Grid.ColumnDefinitions>
@ -212,7 +212,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetGirdleColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding GIRDLE_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="0" Row="4">
<Grid.ColumnDefinitions>
@ -220,7 +220,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetPavilionColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding PAVILION_MAIN_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="2" Row="4">
<Grid.ColumnDefinitions>
@ -228,7 +228,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetLowerGirdleColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding LOWER_GIRDLE_FACET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
<Grid Grid.Column="4" Row="4">
<Grid.ColumnDefinitions>
@ -236,11 +236,11 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Label Grid.Column="0" FontSize="14" Content="{StaticResource SystemSettingModelSetCuletColor}" HorizontalAlignment="Right" Width="150" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
<Label Grid.Column="1" FontSize="14" Background="#FF000000" HorizontalAlignment="Left" Content="{Binding CULET_COLOR}" Width="100" MouseLeftButtonDown="LabelsColor_OnMouseLeftButtonDown" />
</Grid>
</Grid>
</Grid>
</Border>
</Grid>
</Border>

@ -27,7 +27,7 @@ public partial class ModelColorSetPage
picker.Confirmed += delegate
{
label.Background = picker.SelectedBrush;
label.Foreground = GetInverseBrush(picker.SelectedBrush);
label.Foreground = picker.SelectedBrush;
label.Content = picker.SelectedBrush.ToString();
window.Close();

@ -44,6 +44,7 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" Background="#ebeef5"></GridSplitter>
<Border Grid.Column="2" Background="#F7F7F7" Opacity="0.9">
<ItemsControl ItemsSource="{Binding Buttons2}">
<ItemsControl.ItemsPanel>

Loading…
Cancel
Save