diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index da199d1..a3bc06a 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 da199d1..a3bc06a 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 1d5d84a..fbacd2e 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -1,29 +1,28 @@ -using GalaSoft.MvvmLight; +using System; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Threading; +using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using SubCabinetSolution.Model; using SubCabinetSolution.Views; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Windows; -using System.Windows.Documents; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { - public string _currentTime; - public string CurrentTime { get { return _currentTime; } set { _currentTime = value; - RaisePropertyChanged(); + RaisePropertyChanged(() => CurrentTime); } } + private string _currentTime; + public RelayCommand LoginOutCommand { get; set; } public List FunctionModelList { get; set; } @@ -31,13 +30,12 @@ public CabinetViewModel() { - // DispatcherTimer showTimer = new DispatcherTimer(); - // showTimer.Tick += ShowCurTimer; //起个Timer一直获取当前时间 - // showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); - // showTimer.Start(); - _currentTime = "2022/08/25 23:25:50"; - this.LoginOutCommand = new RelayCommand(LoginOut); + DispatcherTimer showTimer = new DispatcherTimer(); + showTimer.Tick += ShowCurTimer; //起个Timer一直获取当前时间 + showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); + showTimer.Start(); + this.LoginOutCommand = new RelayCommand(LoginOut); // 初始化左侧功能列表 this.FunctionModelList = new List { @@ -50,7 +48,6 @@ new FunctionModel("/Images/文档查询.png", "查询"), new FunctionModel("/Images/主页.png", "主页") }; - // 初始化左侧底部功能列表 this.SettingsModelList = new List { @@ -62,11 +59,7 @@ private void ShowCurTimer(object sender, EventArgs e) { - //获得年月日 - string date = DateTime.Now.ToString("yyyy/MM/dd"); - //获得时分秒 - string time = DateTime.Now.ToString("HH:mm:ss"); - this._currentTime = date + " " + time; + this.CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } private void LoginOut(CabinetWindow window) diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo index da199d1..a3bc06a 100644 --- a/.vs/SubCabinetSolution/v17/.suo +++ b/.vs/SubCabinetSolution/v17/.suo Binary files differ diff --git a/SubCabinetSolution/ViewModel/CabinetViewModel.cs b/SubCabinetSolution/ViewModel/CabinetViewModel.cs index 1d5d84a..fbacd2e 100644 --- a/SubCabinetSolution/ViewModel/CabinetViewModel.cs +++ b/SubCabinetSolution/ViewModel/CabinetViewModel.cs @@ -1,29 +1,28 @@ -using GalaSoft.MvvmLight; +using System; +using System.Collections.Generic; +using System.Windows; +using System.Windows.Threading; +using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Command; using SubCabinetSolution.Model; using SubCabinetSolution.Views; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Windows; -using System.Windows.Documents; namespace SubCabinetSolution.ViewModel { public class CabinetViewModel : ViewModelBase { - public string _currentTime; - public string CurrentTime { get { return _currentTime; } set { _currentTime = value; - RaisePropertyChanged(); + RaisePropertyChanged(() => CurrentTime); } } + private string _currentTime; + public RelayCommand LoginOutCommand { get; set; } public List FunctionModelList { get; set; } @@ -31,13 +30,12 @@ public CabinetViewModel() { - // DispatcherTimer showTimer = new DispatcherTimer(); - // showTimer.Tick += ShowCurTimer; //起个Timer一直获取当前时间 - // showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); - // showTimer.Start(); - _currentTime = "2022/08/25 23:25:50"; - this.LoginOutCommand = new RelayCommand(LoginOut); + DispatcherTimer showTimer = new DispatcherTimer(); + showTimer.Tick += ShowCurTimer; //起个Timer一直获取当前时间 + showTimer.Interval = new TimeSpan(0, 0, 0, 1, 0); + showTimer.Start(); + this.LoginOutCommand = new RelayCommand(LoginOut); // 初始化左侧功能列表 this.FunctionModelList = new List { @@ -50,7 +48,6 @@ new FunctionModel("/Images/文档查询.png", "查询"), new FunctionModel("/Images/主页.png", "主页") }; - // 初始化左侧底部功能列表 this.SettingsModelList = new List { @@ -62,11 +59,7 @@ private void ShowCurTimer(object sender, EventArgs e) { - //获得年月日 - string date = DateTime.Now.ToString("yyyy/MM/dd"); - //获得时分秒 - string time = DateTime.Now.ToString("HH:mm:ss"); - this._currentTime = date + " " + time; + this.CurrentTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"); } private void LoginOut(CabinetWindow window) diff --git a/SubCabinetSolution/Views/CabinetWindow.xaml b/SubCabinetSolution/Views/CabinetWindow.xaml index a36cce1..320ad9e 100644 --- a/SubCabinetSolution/Views/CabinetWindow.xaml +++ b/SubCabinetSolution/Views/CabinetWindow.xaml @@ -67,7 +67,7 @@ Color="#E8F2FB" /> - + @@ -136,8 +136,10 @@ - - + + @@ -191,7 +193,8 @@ - + @@ -242,8 +245,8 @@ Margin="10,0,0,0" Source="/Images/人脸识别.png" /> @@ -356,7 +359,42 @@ - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file