|
|
@@ -14,6 +14,7 @@ using System.Reflection; |
|
|
|
using System.Collections.Concurrent; |
|
|
|
using HBLConsole.Attributes; |
|
|
|
using System.Collections.ObjectModel; |
|
|
|
using System.Windows.Media; |
|
|
|
|
|
|
|
namespace HBLConsole.ViewModel |
|
|
|
{ |
|
|
@@ -45,6 +46,42 @@ namespace HBLConsole.ViewModel |
|
|
|
{ |
|
|
|
ActionOperate.GetInstance.Send("InitCommand"); |
|
|
|
}); |
|
|
|
|
|
|
|
LoopSimOrderCommand = new RelayCommand(() => |
|
|
|
{ |
|
|
|
LoopButton = LoopButton == "循环跑单" ? "停止跑单" : "循环跑单"; |
|
|
|
|
|
|
|
}); |
|
|
|
ThreadOperate.GetInstance.StartLong(new Action(() => |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
System.Windows.Application.Current.Dispatcher.BeginInvoke((Action)async delegate |
|
|
|
{ |
|
|
|
if (IsLoop && !IsLoopzc) |
|
|
|
{ |
|
|
|
IsLoopzc = true; |
|
|
|
if (simOrderVisibleDatas.ElementAt(0).IsSelected) |
|
|
|
simOrderVisibleDatas.ElementAt(0).Loc = (ushort)(new Random().Next(1,6)); |
|
|
|
|
|
|
|
ActionOperate.GetInstance.Send("SimOrder",new SimOrderData() |
|
|
|
{ |
|
|
|
NoodleLoc = simOrderVisibleDatas.ElementAt(0).Loc, |
|
|
|
SoupLoc = simOrderVisibleDatas.ElementAt(1).Loc, |
|
|
|
BowlLoc = 10, |
|
|
|
}); |
|
|
|
await Task.Delay(50000); |
|
|
|
IsLoopzc = false; |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
Thread.Sleep(1000); |
|
|
|
}),"循环订单"); |
|
|
|
} |
|
|
|
|
|
|
|
static DebugViewModel() |
|
|
@@ -64,9 +101,29 @@ namespace HBLConsole.ViewModel |
|
|
|
|
|
|
|
public RelayCommand InitCommand { get; set; } |
|
|
|
|
|
|
|
public RelayCommand LoopSimOrderCommand { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public static ObservableCollection<SimOrderVisibleData> simOrderVisibleDatas { get; set; } = new ObservableCollection<SimOrderVisibleData>(); |
|
|
|
|
|
|
|
public static bool IsLoop = false; |
|
|
|
public static bool IsLoopzc = false; |
|
|
|
|
|
|
|
public static string LoopButton |
|
|
|
{ |
|
|
|
get { return _LoopButton; } |
|
|
|
set |
|
|
|
{ |
|
|
|
_LoopButton = value; |
|
|
|
if (value != "循环跑单") { IsLoop = true; LoopColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("Red")); } |
|
|
|
else { IsLoop = false; LoopColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00c2f4")); } |
|
|
|
OnStaticPropertyChanged(); |
|
|
|
} |
|
|
|
} |
|
|
|
private static string _LoopButton = "循环跑单"; |
|
|
|
public static Brush LoopColor { get { return _LoopColor; } set { _LoopColor = value; OnStaticPropertyChanged(); } } |
|
|
|
private static Brush _LoopColor = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#00c2f4")); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |