From 73de27797a749ba5b3389a063368978a0b04fa23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Mon, 16 May 2022 13:50:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/DeviceConfigModel.cs | 4 + .../NewShopWindowModel.cs | 26 +- .../ShopDeviceConfigViewModel.cs | 47 ++- .../Control/ShopDeviceConfigView.xaml | 82 +++-- .../DialogWindow/NewShopWindow.xaml | 312 ++++++------------ .../DialogWindow/NewShopWindow.xaml.cs | 18 +- BPASmartClient/MainWindow.xaml.cs | 2 +- 7 files changed, 238 insertions(+), 253 deletions(-) diff --git a/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs b/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs index 8301b3ca..49e9d013 100644 --- a/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs +++ b/BPASmartClient.ViewModel/Model/DeviceConfigModel.cs @@ -73,6 +73,10 @@ namespace BPASmartClient.ViewModel.Model private string _mCommunicationModule = string.Empty; + public string CommunicationName { get { return _mCommunicationName; } set { _mCommunicationName = value; OnPropertyChanged(); } } + private string _mCommunicationName = string.Empty; + + } diff --git a/BPASmartClient.ViewModel/NewShopWindowModel.cs b/BPASmartClient.ViewModel/NewShopWindowModel.cs index 7c2e1cc7..cef93844 100644 --- a/BPASmartClient.ViewModel/NewShopWindowModel.cs +++ b/BPASmartClient.ViewModel/NewShopWindowModel.cs @@ -3,7 +3,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BPASmartClient.Helper; using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using Microsoft.Toolkit.Mvvm.Messaging; namespace BPASmartClient.ViewModel { @@ -11,7 +14,28 @@ namespace BPASmartClient.ViewModel { public NewShopWindowModel() { - + CloseWindowCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); }); + CancelCommand = new RelayCommand(() => { WeakReferenceMessenger.Default.Send("", "CloseWindow"); }); + DefineCommand = new RelayCommand(() => + { + ActionManage.GetInstance.Send("ShopPar", new string[] { ShopName, ShopId }); + WeakReferenceMessenger.Default.Send("", "CloseWindow"); + }); } + + public RelayCommand CloseWindowCommand { get; set; } + + public RelayCommand CancelCommand { get; set; } + + public RelayCommand DefineCommand { get; set; } + + public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } } + private string _mShopName; + + public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } } + private string _mShopId; + + + } } diff --git a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs index 51572f95..e7e0de7c 100644 --- a/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs +++ b/BPASmartClient.ViewModel/ShopDeviceConfigViewModel.cs @@ -3,7 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using BPASmartClient.Helper; using Microsoft.Toolkit.Mvvm.ComponentModel; +using Microsoft.Toolkit.Mvvm.Input; +using BPASmartClient.ViewModel.Model; +using System.Collections.ObjectModel; namespace BPASmartClient.ViewModel { @@ -11,9 +15,50 @@ namespace BPASmartClient.ViewModel { public ShopDeviceConfigViewModel() { - //NewCommand = new Action(() => {ActionManager }); + ActionManage.GetInstance.Register(new Action((o) => + { + if (o != null && o is string[] par) + { + if (par.Length == 2) + { + ShopName = par[0]; + ShopId = par[1]; + } + } + }), "ShopPar"); + + ObservableCollection deviceModels = new ObservableCollection(); + ObservableCollection communicationModels = new ObservableCollection(); + communicationModels.Add(new CommunicationModel() { CommunicationName = "通讯1", CommunicationModule = "qidong" }); + deviceModels.Add(new DeviceModel() { DeviceName = "设备1", DeviceId = "10", DeviceModule = "aa", communicationDevcies = communicationModels }); + deviceConfig = new DeviceConfigModel() + { + ShopName = "且时且多", + ShopId = "10", + deviceModels = deviceModels + }; + + NewDeviceCommand = new RelayCommand((o) => + { + + }); } public Action NewCommand { get; set; } + + public RelayCommand NewDeviceCommand { get; set; } + + public string ShopName { get { return _mShopName; } set { _mShopName = value; OnPropertyChanged(); } } + private string _mShopName = "店铺名称"; + + public string ShopId { get { return _mShopId; } set { _mShopId = value; OnPropertyChanged(); } } + private string _mShopId; + + public ObservableCollection deviceConfig = new ObservableCollection(); + + //public DeviceConfigModel deviceConfig { get { return _mdeviceConfig; } set { _mdeviceConfig = value; OnPropertyChanged(); } } + //private DeviceConfigModel _mdeviceConfig; + + } } diff --git a/BPASmartClient/Control/ShopDeviceConfigView.xaml b/BPASmartClient/Control/ShopDeviceConfigView.xaml index a242d89d..c43c33c0 100644 --- a/BPASmartClient/Control/ShopDeviceConfigView.xaml +++ b/BPASmartClient/Control/ShopDeviceConfigView.xaml @@ -7,6 +7,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" + xmlns:vmm="clr-namespace:BPASmartClient.ViewModel.Model;assembly=BPASmartClient.ViewModel" d:DesignHeight="900" d:DesignWidth="1200" mc:Ignorable="d"> @@ -399,32 +400,70 @@ - - - + + + + + + + + + + + + + + - - - - - - - - - + --> + + + + + + @@ -482,7 +522,7 @@ Width="170" HorizontalAlignment="Left" Style="{StaticResource TextBoxStyle}" - Text="{Binding Minute}" /> + Text="{Binding ShopName}" /> + Text="{Binding ShopId}" /> diff --git a/BPASmartClient/DialogWindow/NewShopWindow.xaml b/BPASmartClient/DialogWindow/NewShopWindow.xaml index 37795b52..838849c1 100644 --- a/BPASmartClient/DialogWindow/NewShopWindow.xaml +++ b/BPASmartClient/DialogWindow/NewShopWindow.xaml @@ -8,8 +8,8 @@ xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" Title="NewShopWindow" - Width="850" - Height="450" + Width="400" + Height="300" AllowsTransparency="True" Background="{x:Null}" Opacity="0.8" @@ -85,7 +85,6 @@ - @@ -126,238 +125,111 @@ Visibility="Hidden" />