diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml index 89a3995..8630f29 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml +++ b/SubCabinetSolution/Views/CabinetWindow.xaml @@ -6,7 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="高值耗材柜(科室)" Width="1366" Height="768" @@ -14,7 +13,6 @@ DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}" WindowStartupLocation="CenterScreen" WindowState="Maximized" - WindowStyle="None" mc:Ignorable="d"> @@ -213,7 +211,7 @@ - - + diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml index 89a3995..8630f29 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml +++ b/SubCabinetSolution/Views/CabinetWindow.xaml @@ -6,7 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="高值耗材柜(科室)" Width="1366" Height="768" @@ -14,7 +13,6 @@ DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}" WindowStartupLocation="CenterScreen" WindowState="Maximized" - WindowStyle="None" mc:Ignorable="d"> @@ -213,7 +211,7 @@ - - + diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml.cs b/SubCabinetSolution/Views/CabinetWindow.xaml.cs index 7e32780..a7b9c91 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml.cs +++ b/SubCabinetSolution/Views/CabinetWindow.xaml.cs @@ -1,10 +1,18 @@ -namespace SubCabinetSolution.Views +using GalaSoft.MvvmLight.Messaging; +using SubCabinetSolution.Utils; + +namespace SubCabinetSolution.Views { public partial class CabinetWindow { public CabinetWindow() { InitializeComponent(); + Messenger.Default.Register(this, MessageToken.CloseCabinetWindow, s => + { + new MainWindow().Show(); + Close(); + }); } } } \ No newline at end of file diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml index 89a3995..8630f29 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml +++ b/SubCabinetSolution/Views/CabinetWindow.xaml @@ -6,7 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="高值耗材柜(科室)" Width="1366" Height="768" @@ -14,7 +13,6 @@ DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}" WindowStartupLocation="CenterScreen" WindowState="Maximized" - WindowStyle="None" mc:Ignorable="d"> @@ -213,7 +211,7 @@ - - + diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml.cs b/SubCabinetSolution/Views/CabinetWindow.xaml.cs index 7e32780..a7b9c91 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml.cs +++ b/SubCabinetSolution/Views/CabinetWindow.xaml.cs @@ -1,10 +1,18 @@ -namespace SubCabinetSolution.Views +using GalaSoft.MvvmLight.Messaging; +using SubCabinetSolution.Utils; + +namespace SubCabinetSolution.Views { public partial class CabinetWindow { public CabinetWindow() { InitializeComponent(); + Messenger.Default.Register(this, MessageToken.CloseCabinetWindow, s => + { + new MainWindow().Show(); + Close(); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/Views/ConsumeQueryPage.xaml b/SubCabinetSolution/Views/ConsumeQueryPage.xaml index f0dd0ec..a4431ec 100644 --- a/SubCabinetSolution/Views/ConsumeQueryPage.xaml +++ b/SubCabinetSolution/Views/ConsumeQueryPage.xaml @@ -8,8 +8,6 @@ xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="ConsumeQueryPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding ConsumeQueryPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -139,30 +137,12 @@ ItemsSource="{Binding ConsumeGoodsModels}"> - - - - - - + + + + + + diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml index 89a3995..8630f29 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml +++ b/SubCabinetSolution/Views/CabinetWindow.xaml @@ -6,7 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="高值耗材柜(科室)" Width="1366" Height="768" @@ -14,7 +13,6 @@ DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}" WindowStartupLocation="CenterScreen" WindowState="Maximized" - WindowStyle="None" mc:Ignorable="d"> @@ -213,7 +211,7 @@ - - + diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml.cs b/SubCabinetSolution/Views/CabinetWindow.xaml.cs index 7e32780..a7b9c91 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml.cs +++ b/SubCabinetSolution/Views/CabinetWindow.xaml.cs @@ -1,10 +1,18 @@ -namespace SubCabinetSolution.Views +using GalaSoft.MvvmLight.Messaging; +using SubCabinetSolution.Utils; + +namespace SubCabinetSolution.Views { public partial class CabinetWindow { public CabinetWindow() { InitializeComponent(); + Messenger.Default.Register(this, MessageToken.CloseCabinetWindow, s => + { + new MainWindow().Show(); + Close(); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/Views/ConsumeQueryPage.xaml b/SubCabinetSolution/Views/ConsumeQueryPage.xaml index f0dd0ec..a4431ec 100644 --- a/SubCabinetSolution/Views/ConsumeQueryPage.xaml +++ b/SubCabinetSolution/Views/ConsumeQueryPage.xaml @@ -8,8 +8,6 @@ xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="ConsumeQueryPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding ConsumeQueryPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -139,30 +137,12 @@ ItemsSource="{Binding ConsumeGoodsModels}"> - - - - - - + + + + + + diff --git a/SubCabinetSolution/Views/EmergencyPage.xaml b/SubCabinetSolution/Views/EmergencyPage.xaml index aad3266..a045c6e 100644 --- a/SubCabinetSolution/Views/EmergencyPage.xaml +++ b/SubCabinetSolution/Views/EmergencyPage.xaml @@ -6,8 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="EmergencyPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding EmergencyPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -304,26 +302,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index f877e47..f04a43b 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/App.xaml b/SubCabinetSolution/App.xaml index 7d84139..861cfc6 100644 --- a/SubCabinetSolution/App.xaml +++ b/SubCabinetSolution/App.xaml @@ -18,28 +18,6 @@ - - - - diff --git a/SubCabinetSolution/Model/ConsumableModel.cs b/SubCabinetSolution/Model/ConsumableModel.cs new file mode 100644 index 0000000..a3ff87c --- /dev/null +++ b/SubCabinetSolution/Model/ConsumableModel.cs @@ -0,0 +1,9 @@ +namespace SubCabinetSolution.Model +{ + public class ConsumableModel + { + public string OperatePerson { get; set; } + public string OperateTime { get; set; } + public string BusinessType { get; set; } + } +} \ No newline at end of file diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj index f90a7a4..6a597d8 100644 --- a/SubCabinetSolution/SubCabinetSolution.csproj +++ b/SubCabinetSolution/SubCabinetSolution.csproj @@ -193,6 +193,7 @@ Designer + @@ -206,6 +207,7 @@ + diff --git a/SubCabinetSolution/Utils/DataBaseManager.cs b/SubCabinetSolution/Utils/DataBaseManager.cs index 21137e1..7040ae6 100644 --- a/SubCabinetSolution/Utils/DataBaseManager.cs +++ b/SubCabinetSolution/Utils/DataBaseManager.cs @@ -13,7 +13,7 @@ public MySqlConnection GetConnection() { - MySqlConnection connection = new MySqlConnection(LocalConstant.MysqlConfig); + var connection = new MySqlConnection(LocalConstant.MysqlConfig); connection.Open(); return connection; } diff --git a/SubCabinetSolution/Utils/MessageToken.cs b/SubCabinetSolution/Utils/MessageToken.cs new file mode 100644 index 0000000..68453c5 --- /dev/null +++ b/SubCabinetSolution/Utils/MessageToken.cs @@ -0,0 +1,10 @@ +namespace SubCabinetSolution.Utils +{ + public class MessageToken + { + public const string CloseMainWindow = "2022093001"; + public const string CloseCabinetWindow = "2022101401"; + + public const string ChangeCabinetPage = "2022101402"; + } +} \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs index 669ad99..c07ce7c 100644 --- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs @@ -1,11 +1,15 @@ using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; +using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Views; using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class AdoptionPageViewModel : ViewModelBase { + public RelayCommand GoBackCommand { get; set; } public ObservableCollection SurgeryModels { get; set; } public ObservableCollection SurgeryGoodsModels { get; set; } @@ -38,6 +42,12 @@ Description = null } }; + + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().NavigateTo("CabinetMainPage"); + //Messenger.Default.Send(MessageToken.ChangeCabinetPage); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 2f0cfe3..23ee8a9 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -6,30 +6,30 @@ using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; +using GalaSoft.MvvmLight.Messaging; using GalaSoft.MvvmLight.Views; using Newtonsoft.Json; using SubCabinetSolution.Model; using SubCabinetSolution.Utils; -using SubCabinetSolution.Views; using MessageBox = HandyControl.Controls.MessageBox; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { + private string _currentTime; + public string CurrentTime { - get { return _currentTime; } - set + get => _currentTime; + private set { _currentTime = value; RaisePropertyChanged(() => CurrentTime); } } - private string _currentTime; - - public RelayCommand LoginOutCommand { get; set; } + public RelayCommand LoginOutCommand { get; set; } public List FunctionModels { get; set; } public List SettingsModels { get; set; } @@ -39,7 +39,7 @@ public string MainTopTitle { get => _mainTopTitle; - set + private set { _mainTopTitle = value; RaisePropertyChanged(() => MainTopTitle); @@ -51,7 +51,7 @@ public string MainTopImage { get => _mainTopImage; - set + private set { _mainTopImage = value; RaisePropertyChanged(() => MainTopImage); @@ -92,19 +92,18 @@ showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); showTimer.Start(); - LoginOutCommand = new RelayCommand(LoginOut); + LoginOutCommand = new RelayCommand(() => { Messenger.Default.Send("", MessageToken.CloseCabinetWindow); }); // 初始化左侧功能列表 FunctionModels = DataModelCreator.CreateCabinetViewLeftFuncModels(); // 初始化左侧底部功能列表 SettingsModels = DataModelCreator.CreateCabinetViewBottomFuncModels(); - + FuncSelectedCommand = new RelayCommand(ItemSelectionChanged); SettingsSelectedCommand = new RelayCommand(SettingsSelectionChanged); SearchDataCommand = new RelayCommand(SearchData); // 设置默认值 MainTopImage = FunctionModels[7].Image; MainTopTitle = FunctionModels[7].Title; - // TODO 显示默认功能项数据 } private void ShowCurTimer(object sender, EventArgs e) @@ -112,14 +111,6 @@ CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } - private void LoginOut(CabinetWindow window) - { - //退出 - var mainWindow = new MainWindow(); - mainWindow.Show(); - window.Close(); - } - private void ItemSelectionChanged(object sender) { var functionModel = (FunctionModel)sender; diff --git a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs index 02a28a8..495f41e 100644 --- a/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs +++ b/SubCabinetSolution/ViewModel/GoodsQueryPageViewModel.cs @@ -1,22 +1,32 @@ -using CommonServiceLocator; +using System.Collections.ObjectModel; +using CommonServiceLocator; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using GalaSoft.MvvmLight.Views; +using SubCabinetSolution.Model; namespace SubCabinetSolution.ViewModel { public class GoodsQueryPageViewModel : ViewModelBase { public RelayCommand GoBackCommand { get; set; } + public ObservableCollection ConsumableModels { get; set; } public GoodsQueryPageViewModel() { - this.GoBackCommand = new RelayCommand(GoBack); - } - - private void GoBack() - { - ServiceLocator.Current.GetInstance().GoBack(); + GoBackCommand = new RelayCommand(() => + { + ServiceLocator.Current.GetInstance().GoBack(); + }); + ConsumableModels = new ObservableCollection + { + new ConsumableModel + { + OperatePerson = null, + OperateTime = null, + BusinessType = null + } + }; } } } \ No newline at end of file diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs index 9566d22..78eea5a 100644 --- a/SubCabinetSolution/ViewModel/MainViewModel.cs +++ b/SubCabinetSolution/ViewModel/MainViewModel.cs @@ -135,7 +135,7 @@ reader.Close(); new CabinetWindow().Show(); //通过消息Messenger告诉MainWindow.xaml.cs关闭窗口 - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); return; } @@ -197,7 +197,7 @@ window.CameraPreviewPlayer.SignalToStop(); window.CameraFormsHost.Visibility = Visibility.Collapsed; new CabinetWindow().Show(); - Messenger.Default.Send("CloseWindow", "2022093001"); + Messenger.Default.Send("", MessageToken.CloseMainWindow); }); }; window.CameraFormsHost.Visibility = Visibility.Visible; diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml index 1938adf..c74043f 100644 --- a/SubCabinetSolution/Views/AdoptionPage.xaml +++ b/SubCabinetSolution/Views/AdoptionPage.xaml @@ -5,8 +5,6 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="AdoptionPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding AdoptionPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -32,22 +30,10 @@ ItemsSource="{Binding SurgeryModels}"> - - - - + + + + @@ -69,26 +55,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + @@ -155,7 +126,8 @@ Width="80" Height="30" Background="{StaticResource MainThemeColor}" - BorderThickness="0"> + BorderThickness="0" + Command="{Binding GoBackCommand}"> diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml index 89a3995..8630f29 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml +++ b/SubCabinetSolution/Views/CabinetWindow.xaml @@ -6,7 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:interactivity="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="高值耗材柜(科室)" Width="1366" Height="768" @@ -14,7 +13,6 @@ DataContext="{Binding CabinetWindow, Source={StaticResource Locator}}" WindowStartupLocation="CenterScreen" WindowState="Maximized" - WindowStyle="None" mc:Ignorable="d"> @@ -213,7 +211,7 @@ - - + diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml.cs b/SubCabinetSolution/Views/CabinetWindow.xaml.cs index 7e32780..a7b9c91 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml.cs +++ b/SubCabinetSolution/Views/CabinetWindow.xaml.cs @@ -1,10 +1,18 @@ -namespace SubCabinetSolution.Views +using GalaSoft.MvvmLight.Messaging; +using SubCabinetSolution.Utils; + +namespace SubCabinetSolution.Views { public partial class CabinetWindow { public CabinetWindow() { InitializeComponent(); + Messenger.Default.Register(this, MessageToken.CloseCabinetWindow, s => + { + new MainWindow().Show(); + Close(); + }); } } } \ No newline at end of file diff --git a/SubCabinetSolution/Views/ConsumeQueryPage.xaml b/SubCabinetSolution/Views/ConsumeQueryPage.xaml index f0dd0ec..a4431ec 100644 --- a/SubCabinetSolution/Views/ConsumeQueryPage.xaml +++ b/SubCabinetSolution/Views/ConsumeQueryPage.xaml @@ -8,8 +8,6 @@ xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:widgets="clr-namespace:CSharpToolkit.Widgets;assembly=CSharpToolkit" Title="ConsumeQueryPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding ConsumeQueryPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -139,30 +137,12 @@ ItemsSource="{Binding ConsumeGoodsModels}"> - - - - - - + + + + + + diff --git a/SubCabinetSolution/Views/EmergencyPage.xaml b/SubCabinetSolution/Views/EmergencyPage.xaml index aad3266..a045c6e 100644 --- a/SubCabinetSolution/Views/EmergencyPage.xaml +++ b/SubCabinetSolution/Views/EmergencyPage.xaml @@ -6,8 +6,6 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="EmergencyPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding EmergencyPage, Source={StaticResource Locator}}" mc:Ignorable="d"> @@ -304,26 +302,11 @@ ItemsSource="{Binding SurgeryGoodsModels}"> - - - - - + + + + + diff --git a/SubCabinetSolution/Views/GoodsQueryPage.xaml b/SubCabinetSolution/Views/GoodsQueryPage.xaml index 2b55d87..44851e8 100644 --- a/SubCabinetSolution/Views/GoodsQueryPage.xaml +++ b/SubCabinetSolution/Views/GoodsQueryPage.xaml @@ -6,38 +6,11 @@ xmlns:hc="https://handyorg.github.io/handycontrol" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="GoodsQueryPage" - d:DesignHeight="450" - d:DesignWidth="800" Background="White" DataContext="{Binding GoodsQueryPage, Source={StaticResource Locator}}" mc:Ignorable="d"> - - - @@ -98,35 +72,28 @@ - + - - - - - - - + + + + + + + + + @@ -135,12 +102,7 @@ - - - - - - + @@ -153,31 +115,23 @@ - - - - - - + DockPanel.Dock="Left" + FontSize="16" + FontWeight="Bold" + Foreground="{StaticResource MainThemeColor}" + Text="入库-起" /> - - - - - - - - - - - - - - - + + - - - - - - - + + + - - - - - - - + + + - - - - - - - + + + - - + + +