applelon 2 years ago
parent
commit
a699f1ee8f
4 changed files with 66 additions and 4 deletions
  1. +2
    -2
      HBLConsole.MORKD/HBLConsole.MORKD.csproj
  2. +0
    -1
      HBLConsole.Model/KeepParameter/BatchingInfoPar.cs
  3. +7
    -1
      HBLConsole/View/DebugView.xaml
  4. +57
    -0
      HBLConsole/ViewModel/DebugViewModel.cs

+ 2
- 2
HBLConsole.MORKD/HBLConsole.MORKD.csproj View File

@@ -12,10 +12,10 @@

<ItemGroup>
<Reference Include="BPA.Message">
<HintPath>..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll</HintPath>
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Message.dll</HintPath>
</Reference>
<Reference Include="BPA.Models">
<HintPath>..\..\..\..\BPACommon_output\net5.0\BPA.Models.dll</HintPath>
<HintPath>..\..\..\..\..\..\BPACommon_output\net5.0\BPA.Models.dll</HintPath>
</Reference>
</ItemGroup>



+ 0
- 1
HBLConsole.Model/KeepParameter/BatchingInfoPar.cs View File

@@ -4,7 +4,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.Models;

namespace HBLConsole.Model
{


+ 7
- 1
HBLConsole/View/DebugView.xaml View File

@@ -212,7 +212,13 @@
Command="{Binding SimOrderCommand}"
Content="模拟订单"
Style="{StaticResource ButtonStyle}" />

<Button Margin="0,0,10,0" x:Name="button_loop"
Command="{Binding LoopSimOrderCommand}"
CommandParameter="{Binding ElementName=button_loop,Path=Content}"
Content="{Binding LoopButton,Mode=TwoWay,NotifyOnTargetUpdated=True}"
Foreground="{Binding LoopColor, Mode=TwoWay, NotifyOnTargetUpdated=True}"
Style="{StaticResource ButtonStyle}" />
<Button
Margin="0,0,10,0"
Command="{Binding InitCommand}"


+ 57
- 0
HBLConsole/ViewModel/DebugViewModel.cs View File

@@ -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"));


}
}

Loading…
Cancel
Save