diff --git a/BPASmartClient/MainWindow.xaml b/BPASmartClient/MainWindow.xaml
index 2563e92f..563cef32 100644
--- a/BPASmartClient/MainWindow.xaml
+++ b/BPASmartClient/MainWindow.xaml
@@ -96,6 +96,7 @@
+
diff --git a/BPASmartClient/MainWindow.xaml.cs b/BPASmartClient/MainWindow.xaml.cs
index b3914800..08b5368a 100644
--- a/BPASmartClient/MainWindow.xaml.cs
+++ b/BPASmartClient/MainWindow.xaml.cs
@@ -35,14 +35,13 @@ namespace BPASmartClient
{
InitializeComponent();
Initialize();
- ThreadManage.GetInstance().Start(new Action(() =>
- {
- new MainConsole().Start();
- }), "启动主控制台");
-
}
- public void Initialize()
+ #region 私有
+ ///
+ /// 初始化
+ ///
+ private void Initialize()
{
this.ButClose.Click += (o,e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o,e) =>
@@ -56,20 +55,16 @@ namespace BPASmartClient
}
this.DragMove();
};
- MenuItem_Click(new MenuItem() {Tag= "LogView",Header="日志监视" },null);
- }
-
- private void Button_Click(object sender, RoutedEventArgs e)
- {
- //new Demo_MakeCoffeeEvent() { Id = 1 }.Publish();
- //new DRCoffee_MakeCoffeeEvent() { Id = 1, DrinkCode= DrCoffeeDrinksCode.两杯意式浓缩 }.Publish();
- //new DRCoffee_CoffeeCommCmdEvent() { Id = 1,CommCmd = DrCoffeeCommCmd.冲煮系统快速冲洗指令}.Publish();
+ MenuItem_Click(new MenuItem() { Tag = "LogView",Header = "日志监视" },null);
- MorkOrderPush morkOrderPush = new MorkOrderPush() { DeviceId=2};
- var temp=BPAPackage.Make(morkOrderPush, 12, BPA.Message.Enum.DeviceClientType.MORKS);
- Plugin.GetInstance().GetPlugin().Publish("DOWN/MORKS/ORDER/12", temp.Serialize());
+ ThreadManage.GetInstance().Start(new Action(() =>
+ {
+ new MainConsole().Start();
+ }),"启动主控制台");
}
+ #endregion
+ #region Click
///
/// 菜单切换栏
///
@@ -80,31 +75,57 @@ namespace BPASmartClient
if (sender is MenuItem)
{
Type type = Type.GetType($"BPASmartClient.Control.{(sender as MenuItem).Tag?.ToString()}");
- if (type == null)
- {
- switch ((sender as MenuItem).Tag?.ToString())
- {
- case "Close":
- this.Close();
- break;
- case "IOT":
- BrowserHelper.OpenDefaultBrowserUrl("http://iot.black-pa.com");
- break;
- }
- return;
- }
+ if (type == null){MenuClick((sender as MenuItem).Tag?.ToString());return; }
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
- Title.Text = (sender as MenuItem).Header?.ToString()+"界面";
+ Title.Text = (sender as MenuItem).Header?.ToString() + "界面";
+ }
+ }
+ catch (Exception ex)
+ {
+ MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]");
+ }
+ }
+ #endregion
+
+ #region 公用
+ ///
+ /// 菜单点击
+ ///
+ ///
+ public void MenuClick(string name)
+ {
+ try
+ {
+ switch (name)
+ {
+ case "Close":
+ this.Close();
+ break;
+ case "IOT":
+ BrowserHelper.OpenDefaultBrowserUrl("http://iot.black-pa.com");
+ break;
}
}
catch (Exception ex)
{
- MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类,描述:[{ex.Message}]");
+ MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuClick(),描述:[{ex.Message}]");
}
}
+ #endregion
+ #region 临时测试代码
+ private void Button_Click(object sender,RoutedEventArgs e)
+ {
+ //new Demo_MakeCoffeeEvent() { Id = 1 }.Publish();
+ //new DRCoffee_MakeCoffeeEvent() { Id = 1, DrinkCode= DrCoffeeDrinksCode.两杯意式浓缩 }.Publish();
+ //new DRCoffee_CoffeeCommCmdEvent() { Id = 1,CommCmd = DrCoffeeCommCmd.冲煮系统快速冲洗指令}.Publish();
+
+ MorkOrderPush morkOrderPush = new MorkOrderPush() { DeviceId = 2 };
+ var temp = BPAPackage.Make(morkOrderPush,12,BPA.Message.Enum.DeviceClientType.MORKS);
+ Plugin.GetInstance().GetPlugin().Publish("DOWN/MORKS/ORDER/12",temp.Serialize());
+ }
private void Button_Click_1(object sender,RoutedEventArgs e)
{
@@ -113,5 +134,8 @@ namespace BPASmartClient
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn,this,"我是标题","我是消息内容!我是消息内容!我是消息内容!我是消息内容!");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success,this,"我是标题","我是消息内容!我是消息内容!我是消息内容!我是消息内容!");
}
+ #endregion
+
+
}
}