|
|
|
@ -39,7 +39,8 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
private List<ButtonViewModel> _buttons2; |
|
|
|
private List<ButtonViewModel> _buttons2; |
|
|
|
private ICommand ChangeDiamondTypeCommand; |
|
|
|
private ICommand ChangeDiamondTypeCommand; |
|
|
|
private ICommand StartGradingCommand; |
|
|
|
private ICommand StartGradingCommand; |
|
|
|
public List<ButtonViewModel> Buttons { |
|
|
|
public List<ButtonViewModel> Buttons |
|
|
|
|
|
|
|
{ |
|
|
|
get { return _buttons; } |
|
|
|
get { return _buttons; } |
|
|
|
set |
|
|
|
set |
|
|
|
{ |
|
|
|
{ |
|
|
|
@ -83,9 +84,9 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "round", IsEnabled = true, ImageName = "round.png", ButtonName = MultilingualHelper.getString("圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "round", IsEnabled = true, ImageName = "round.png", ButtonName = MultilingualHelper.getString("圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Hexagon", IsEnabled = false, ImageName = "Hexagon.png", ButtonName = MultilingualHelper.getString("六边形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Hexagon", IsEnabled = false, ImageName = "Hexagon.png", ButtonName = MultilingualHelper.getString("六边形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "cushion", IsEnabled = false, ImageName = "Cushion.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.png", ButtonName = MultilingualHelper.getString("梨形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Pear", IsEnabled = true, ImageName = "Pear.png", ButtonName = MultilingualHelper.getString("梨形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Princess", IsEnabled = false, ImageName = "Princess.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 = true, ImageName = "oval.png", ButtonName = MultilingualHelper.getString("椭圆形") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Emerald", IsEnabled = false, ImageName = "Emerald.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.png", ButtonName = MultilingualHelper.getString("异形钻") }); |
|
|
|
buttonInfos.Add(new ButtonInfo() { Type = "Odd", IsEnabled = false, ImageName = "Odd.png", ButtonName = MultilingualHelper.getString("异形钻") }); |
|
|
|
return buttonInfos; |
|
|
|
return buttonInfos; |
|
|
|
@ -107,19 +108,63 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
[Log] |
|
|
|
[Log] |
|
|
|
public void ChangeDiamondType(object type) |
|
|
|
public void ChangeDiamondType(object type) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (type!= null) |
|
|
|
// 非空处理 |
|
|
|
{ |
|
|
|
if (type == null) return; |
|
|
|
foreach (var item in Buttons.Where(x => x.Type == type)) |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前点选钻石形状 |
|
|
|
|
|
|
|
string selectedType = type.ToString(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 恢复所有按钮状态,并高亮当前选中的按钮 |
|
|
|
|
|
|
|
foreach (var item in Buttons) |
|
|
|
{ |
|
|
|
{ |
|
|
|
item.IsHighlighted = true; |
|
|
|
item.IsHighlighted = item.Type == selectedType; |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化按键集 |
|
|
|
List<ButtonViewModel> tempButtons2 = new List<ButtonViewModel>(); |
|
|
|
List<ButtonViewModel> tempButtons2 = new List<ButtonViewModel>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 设置二级图片按钮路径 |
|
|
|
|
|
|
|
string basePath = "pack://application:,,,/Resource/Images/UIResource/Diamond/"; |
|
|
|
|
|
|
|
Func<string, BitmapImage> getBitmap = (fileName) => new BitmapImage(new Uri(basePath + fileName, UriKind.RelativeOrAbsolute)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 根据选中类型生成右侧按钮 |
|
|
|
|
|
|
|
switch (selectedType.ToLower()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
case "round": |
|
|
|
|
|
|
|
// 圆形钻石 |
|
|
|
|
|
|
|
AddRoundButtons(tempButtons2, getBitmap); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "pear": |
|
|
|
|
|
|
|
// 梨形钻石 |
|
|
|
|
|
|
|
AddPearButtons(tempButtons2, getBitmap); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case "oval": |
|
|
|
|
|
|
|
// 椭圆形钻石 |
|
|
|
|
|
|
|
AddOvalButtons(tempButtons2, getBitmap); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
// 默认圆形 |
|
|
|
|
|
|
|
AddRoundButtons(tempButtons2, getBitmap); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Buttons2 = tempButtons2; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 圆形二级界面按键加载处理 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="buttons">当前页面按键</param> |
|
|
|
|
|
|
|
/// <param name="getBitmap">图片路径</param> |
|
|
|
|
|
|
|
private void AddRoundButtons(List<ButtonViewModel> buttons, Func<string, BitmapImage> getBitmap) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 运行模式为实验室模式 |
|
|
|
if (Common.RunMode == 0) |
|
|
|
if (Common.RunMode == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/round_P8-P8.png", UriKind.RelativeOrAbsolute)); |
|
|
|
var bitmap_p8p8 = getBitmap("round_P8-P8.png"); |
|
|
|
ButtonViewModel button = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}; |
|
|
|
buttons.Add(new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap_p8p8, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
tempButtons2.Add(button); |
|
|
|
} |
|
|
|
}else if (Common.RunMode == 1) |
|
|
|
// 运行模式为工厂模式 |
|
|
|
|
|
|
|
else if (Common.RunMode == 1) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/Diamond/round_P8-P8.png", UriKind.RelativeOrAbsolute)); |
|
|
|
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/Diamond/round_P8-P8.png", UriKind.RelativeOrAbsolute)); |
|
|
|
var bitmap_p8p8s1 = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/Diamond/round_P8-P8-S1.png", UriKind.RelativeOrAbsolute)); |
|
|
|
var bitmap_p8p8s1 = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/Diamond/round_P8-P8-S1.png", UriKind.RelativeOrAbsolute)); |
|
|
|
@ -138,15 +183,66 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
new ButtonViewModel() { Text = "P8-P8 Stage 8", ImageSource = bitmap_p8p8s8, Type = "ROUND P8 P8 S8", Command = StartGradingCommand, IsFocused = true}, |
|
|
|
new ButtonViewModel() { Text = "P8-P8 Stage 8", ImageSource = bitmap_p8p8s8, Type = "ROUND P8 P8 S8", Command = StartGradingCommand, IsFocused = true}, |
|
|
|
new ButtonViewModel() { Text = "P8-P8 Stage 9", ImageSource = bitmap, Type = "ROUND P8 P8 S9", Command = StartGradingCommand, IsFocused = true}, |
|
|
|
new ButtonViewModel() { Text = "P8-P8 Stage 9", ImageSource = bitmap, Type = "ROUND P8 P8 S9", Command = StartGradingCommand, IsFocused = true}, |
|
|
|
new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}, |
|
|
|
new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}, |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
listBtn.ForEach(e => buttons.Add(e)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
listBtn.ForEach(e => tempButtons2.Add(e)); |
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 梨形二级界面按键加载处理 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="buttons">当前页面按键</param> |
|
|
|
|
|
|
|
/// <param name="getBitmap">图片路径</param> |
|
|
|
|
|
|
|
private void AddPearButtons(List<ButtonViewModel> buttons, Func<string, BitmapImage> getBitmap) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 运行模式为实验室模式 |
|
|
|
|
|
|
|
if (Common.RunMode == 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO 待二级图片作成后替换,以及后续检测处理追加 |
|
|
|
|
|
|
|
var bitmap_p8p8 = getBitmap("pear_P8-P8.png"); |
|
|
|
|
|
|
|
buttons.Add(new ButtonViewModel { Text = "Pear Stage 1", ImageSource = bitmap_p8p8, Type = "PEAR S1", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 追加按钮2 |
|
|
|
|
|
|
|
//var bitmap_p8p8s2 = getBitmap("pear_P8-P8-S2.png"); |
|
|
|
|
|
|
|
//buttons.Add(new ButtonViewModel { Text = "Pear Stage 2", ImageSource = bitmap_p8p8s2, Type = "PEAR S2", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 运行模式为工厂模式 |
|
|
|
|
|
|
|
else if (Common.RunMode == 1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO 待二级图片作成后替换,以及后续检测处理追加 |
|
|
|
|
|
|
|
var bitmap_p8p8 = getBitmap("pear_P8-P8.png"); |
|
|
|
|
|
|
|
buttons.Add(new ButtonViewModel { Text = "Pear Stage 1", ImageSource = bitmap_p8p8, Type = "PEAR S1", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO 虚拟追加按钮2 |
|
|
|
|
|
|
|
var bitmap_p8p8s2 = getBitmap("pear_P8-P8.png"); |
|
|
|
|
|
|
|
buttons.Add(new ButtonViewModel { Text = "Pear Stage 2", ImageSource = bitmap_p8p8, Type = "PEAR S2", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Buttons2 = tempButtons2; |
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 椭圆形二级界面按键加载处理 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="buttons">当前页面按键</param> |
|
|
|
|
|
|
|
/// <param name="getBitmap">图片路径</param> |
|
|
|
|
|
|
|
private void AddOvalButtons(List<ButtonViewModel> buttons, Func<string, BitmapImage> getBitmap) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// 运行模式为实验室模式 |
|
|
|
|
|
|
|
if (Common.RunMode == 0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO 待二级图片作成后替换,以及后续检测处理追加 |
|
|
|
|
|
|
|
var bitmap_p8p8 = getBitmap("oval_P8-P8.png"); |
|
|
|
|
|
|
|
buttons.Add(new ButtonViewModel { Text = "Oval Stage 1", ImageSource = bitmap_p8p8, Type = "OVAL S1", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 运行模式为工厂模式 |
|
|
|
|
|
|
|
else if (Common.RunMode == 1) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO 待二级图片作成后替换,以及后续检测处理追加 |
|
|
|
|
|
|
|
var bitmap_p8p8 = getBitmap("oval_P8-P8.png"); |
|
|
|
|
|
|
|
buttons.Add(new ButtonViewModel { Text = "Oval Stage 1", ImageSource = bitmap_p8p8, Type = "OVAL S1", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO 虚拟追加按钮2 |
|
|
|
|
|
|
|
var bitmap_p8p8s2 = getBitmap("oval_P8-P8.png"); |
|
|
|
|
|
|
|
buttons.Add(new ButtonViewModel { Text = "Oval Stage 2", ImageSource = bitmap_p8p8, Type = "OVAL S2", Command = StartGradingCommand, IsFocused = true }); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -489,7 +585,8 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
public async void DoStartGrading(object param) |
|
|
|
public async void DoStartGrading(object param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
LoadingDialog loading = new LoadingDialog(DiamondCode); |
|
|
|
LoadingDialog loading = new LoadingDialog(DiamondCode); |
|
|
|
try { |
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
if (param != null) |
|
|
|
if (param != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
AlgorithmResultEntity parameter = new AlgorithmResultEntity(); |
|
|
|
AlgorithmResultEntity parameter = new AlgorithmResultEntity(); |
|
|
|
@ -514,7 +611,8 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var tcs = new TaskCompletionSource<bool>(); |
|
|
|
var tcs = new TaskCompletionSource<bool>(); |
|
|
|
var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => { |
|
|
|
var progressTask = Task.Run(() => Application.Current.Dispatcher.Invoke(() => |
|
|
|
|
|
|
|
{ |
|
|
|
loading.Closed += (s, e) => tcs.SetResult(true); |
|
|
|
loading.Closed += (s, e) => tcs.SetResult(true); |
|
|
|
loading.ShowDialog(); |
|
|
|
loading.ShowDialog(); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -790,7 +888,8 @@ public class ButtonViewModel : BaseViewModel |
|
|
|
|
|
|
|
|
|
|
|
public Brush BackgroundColor |
|
|
|
public Brush BackgroundColor |
|
|
|
{ |
|
|
|
{ |
|
|
|
get { |
|
|
|
get |
|
|
|
|
|
|
|
{ |
|
|
|
return _background; |
|
|
|
return _background; |
|
|
|
} |
|
|
|
} |
|
|
|
set |
|
|
|
set |
|
|
|
|