|
|
@ -3,11 +3,8 @@ using SparkClient.Model.Entity.ApiEntity; |
|
|
|
using SparkClient.Model.Helper; |
|
|
|
using SparkClient.Model.Helper; |
|
|
|
using SparkClient.ViewModel.BaseWindow; |
|
|
|
using SparkClient.ViewModel.BaseWindow; |
|
|
|
using SparkClient.Views.Dialog; |
|
|
|
using SparkClient.Views.Dialog; |
|
|
|
using System; |
|
|
|
|
|
|
|
using System.Data; |
|
|
|
using System.Data; |
|
|
|
using System.Diagnostics.Metrics; |
|
|
|
|
|
|
|
using System.DirectoryServices.ActiveDirectory; |
|
|
|
|
|
|
|
using System.Reflection.Metadata; |
|
|
|
|
|
|
|
using System.Windows; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
using System.Windows.Media.Imaging; |
|
|
@ -16,9 +13,10 @@ using Microsoft.Data.Sqlite; |
|
|
|
using SparkClient.Model.Entity; |
|
|
|
using SparkClient.Model.Entity; |
|
|
|
using SparkClient.Model.Services; |
|
|
|
using SparkClient.Model.Services; |
|
|
|
using MessageBox = System.Windows.MessageBox; |
|
|
|
using MessageBox = System.Windows.MessageBox; |
|
|
|
using System.Runtime.CompilerServices; |
|
|
|
|
|
|
|
using System.Text; |
|
|
|
using System.Text; |
|
|
|
using System.IO; |
|
|
|
using System.IO; |
|
|
|
|
|
|
|
using System.Windows.Media; |
|
|
|
|
|
|
|
using Color = System.Windows.Media.Color; |
|
|
|
|
|
|
|
|
|
|
|
namespace SparkClient.ViewModel.Grading; |
|
|
|
namespace SparkClient.ViewModel.Grading; |
|
|
|
|
|
|
|
|
|
|
@ -60,7 +58,7 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
List<ButtonInfo> buttonInfos = GetButtonInfos(); |
|
|
|
List<ButtonInfo> buttonInfos = GetButtonInfos(); |
|
|
|
foreach (var buttonInfo in buttonInfos) |
|
|
|
foreach (var buttonInfo in buttonInfos) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/" + buttonInfo.ImageName, UriKind.RelativeOrAbsolute)); |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/" + buttonInfo.ImageName, UriKind.RelativeOrAbsolute)); |
|
|
|
ButtonViewModel button = new ButtonViewModel() { Text = buttonInfo.ButtonName, ImageSource = bitmap, Type = buttonInfo.Type, Command = ChangeDiamondTypeCommand ,IsEnabled= buttonInfo.IsEnabled, IsHighlighted = false}; |
|
|
|
ButtonViewModel button = new ButtonViewModel() { Text = buttonInfo.ButtonName, ImageSource = bitmap, Type = buttonInfo.Type, Command = ChangeDiamondTypeCommand ,IsEnabled= buttonInfo.IsEnabled, IsHighlighted = false}; |
|
|
|
tempButtons.Add(button); |
|
|
|
tempButtons.Add(button); |
|
|
|
} |
|
|
|
} |
|
|
@ -70,14 +68,14 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
private List<ButtonInfo> GetButtonInfos() |
|
|
|
private List<ButtonInfo> GetButtonInfos() |
|
|
|
{ |
|
|
|
{ |
|
|
|
List<ButtonInfo> buttonInfos = new List<ButtonInfo>(); |
|
|
|
List<ButtonInfo> buttonInfos = new List<ButtonInfo>(); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "round", IsEnabled = true, ImageName = "round_3x.png", ButtonName = MultilingualHelper.getString("圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "round", IsEnabled = true, ImageName = "round.png", ButtonName = MultilingualHelper.getString("圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Heart", IsEnabled = false, ImageName = "Heart-shaped.png", ButtonName = MultilingualHelper.getString("心形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Heart", IsEnabled = false, ImageName = "Heart.png", ButtonName = MultilingualHelper.getString("心形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "cushion", IsEnabled = false, ImageName = "Cushion-shaped.png", ButtonName = MultilingualHelper.getString("枕形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "cushion", IsEnabled = false, ImageName = "Cushion.png", ButtonName = MultilingualHelper.getString("枕形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Pear", IsEnabled = false, ImageName = "Pear-shaped.png", ButtonName = MultilingualHelper.getString("梨形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Pear", IsEnabled = false, ImageName = "Pear.png", ButtonName = MultilingualHelper.getString("梨形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Princess", IsEnabled = false, ImageName = "Princess-shaped.png", ButtonName = MultilingualHelper.getString("公主方形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Princess", IsEnabled = false, ImageName = "Princess.png", ButtonName = MultilingualHelper.getString("公主方形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "oval", IsEnabled = false, ImageName = "oval.png", ButtonName = MultilingualHelper.getString("椭圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "oval", IsEnabled = false, ImageName = "oval.png", ButtonName = MultilingualHelper.getString("椭圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Emerald", IsEnabled = false, ImageName = "Emerald-shape.png", ButtonName = MultilingualHelper.getString("祖母绿形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Emerald", IsEnabled = false, ImageName = "Emerald.png", ButtonName = MultilingualHelper.getString("祖母绿形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Odd", IsEnabled = false, ImageName = "Odd-shaped.png", ButtonName = MultilingualHelper.getString("异形钻") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Odd", IsEnabled = false, ImageName = "Odd.png", ButtonName = MultilingualHelper.getString("异形钻") }); |
|
|
|
return buttonInfos; |
|
|
|
return buttonInfos; |
|
|
|
} |
|
|
|
} |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
@ -102,7 +100,7 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
item.IsHighlighted = true; |
|
|
|
item.IsHighlighted = true; |
|
|
|
}; |
|
|
|
}; |
|
|
|
List<ButtonViewModel> tempButtons2 = new List<ButtonViewModel>(); |
|
|
|
List<ButtonViewModel> tempButtons2 = new List<ButtonViewModel>(); |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/round_P8-P8.png", UriKind.RelativeOrAbsolute)); |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/round_P8-P8.png", UriKind.RelativeOrAbsolute)); |
|
|
|
ButtonViewModel button = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "round P8 P8", Command = StartGradingCommand }; |
|
|
|
ButtonViewModel button = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "round P8 P8", Command = StartGradingCommand }; |
|
|
|
tempButtons2.Add(button); |
|
|
|
tempButtons2.Add(button); |
|
|
|
Buttons2 = tempButtons2; |
|
|
|
Buttons2 = tempButtons2; |
|
|
@ -381,7 +379,8 @@ public class ButtonViewModel : BaseViewModel |
|
|
|
private int _col; |
|
|
|
private int _col; |
|
|
|
private bool _isEnabled; |
|
|
|
private bool _isEnabled; |
|
|
|
private bool _isHighlighted; |
|
|
|
private bool _isHighlighted; |
|
|
|
|
|
|
|
private Brush _foreground; |
|
|
|
|
|
|
|
private Brush _background; |
|
|
|
|
|
|
|
|
|
|
|
public string Text |
|
|
|
public string Text |
|
|
|
{ |
|
|
|
{ |
|
|
@ -446,6 +445,66 @@ public class ButtonViewModel : BaseViewModel |
|
|
|
{ |
|
|
|
{ |
|
|
|
_isHighlighted = value; |
|
|
|
_isHighlighted = value; |
|
|
|
OnPropertyChanged(nameof(IsHighlighted)); |
|
|
|
OnPropertyChanged(nameof(IsHighlighted)); |
|
|
|
|
|
|
|
UpdateStyles(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Brush ForegroundColor |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return _foreground; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_foreground = value; |
|
|
|
|
|
|
|
OnPropertyChanged(nameof(ForegroundColor)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Brush BackgroundColor |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get { |
|
|
|
|
|
|
|
return _background; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_background = value; |
|
|
|
|
|
|
|
OnPropertyChanged(nameof(BackgroundColor)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateStyles() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (IsHighlighted) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 高亮状态的样式 |
|
|
|
|
|
|
|
LinearGradientBrush linearGradientBrush = new LinearGradientBrush( |
|
|
|
|
|
|
|
new GradientStopCollection() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new GradientStop(Color.FromRgb(64, 177, 255), 0), // #61bde2 |
|
|
|
|
|
|
|
new GradientStop(Color.FromRgb(60, 156, 230), 1) // #53abd9 |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Point(0, 0), // StartPoint |
|
|
|
|
|
|
|
new Point(0, 1) // EndPoint |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
BackgroundColor = linearGradientBrush; |
|
|
|
|
|
|
|
ForegroundColor = new SolidColorBrush(Color.FromRgb(255, 255, 255)); |
|
|
|
|
|
|
|
string path = _imageSource.UriSource.AbsolutePath; |
|
|
|
|
|
|
|
if (!path.Contains("_select.png")) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
path = path.Replace(".png", "_select.png"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ImageSource = new BitmapImage(new Uri("pack://application:,,," + path)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 默认状态的样式 |
|
|
|
|
|
|
|
BackgroundColor = new SolidColorBrush(Color.FromRgb(235, 238, 245)); |
|
|
|
|
|
|
|
ForegroundColor = Brushes.Black; |
|
|
|
|
|
|
|
string path = _imageSource.UriSource.AbsolutePath.Replace("_select.png", ".png"); |
|
|
|
|
|
|
|
ImageSource = new BitmapImage(new Uri("pack://application:,,," + path)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |