diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 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 cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index dc5346e..704850b 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -43,14 +43,14 @@
public RelayCommand LoginToMainCommand { get; set; }
public string VersionName { get; set; }
- private MySqlConnection connection;
+ private readonly MySqlConnection _connection;
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel()
{
- this.connection = DataBaseManager.GetInstance().GetConnection();
+ this._connection = DataBaseManager.GetInstance().GetConnection();
this.LoginToMainCommand = new RelayCommand(Login);
this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version;
}
@@ -75,19 +75,19 @@
// PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey);
// Debug.WriteLine(keyModel.data.publicKey);
- if (connection.State == ConnectionState.Open)
+ if (_connection.State == ConnectionState.Open)
{
- string selectUser = "select * from sys_user";
- MySqlCommand cmd = new MySqlCommand(selectUser, connection);
- MySqlDataReader reader = cmd.ExecuteReader();
+ const string selectUser = "select * from sys_user";
+ var cmd = new MySqlCommand(selectUser, _connection);
+ var reader = cmd.ExecuteReader();
while (reader.Read())
{
- string account = reader.GetString("ACCOUNT");
- string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
+ var account = reader.GetString("ACCOUNT");
+ var secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
// TODO 解码得到密码
if (account != _userName || secretKey != _userPassword) continue;
reader.Close();
- CabinetWindow cabinetWindow = new CabinetWindow();
+ var cabinetWindow = new CabinetWindow();
cabinetWindow.Show();
window.Close();
return;
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index dc5346e..704850b 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -43,14 +43,14 @@
public RelayCommand LoginToMainCommand { get; set; }
public string VersionName { get; set; }
- private MySqlConnection connection;
+ private readonly MySqlConnection _connection;
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel()
{
- this.connection = DataBaseManager.GetInstance().GetConnection();
+ this._connection = DataBaseManager.GetInstance().GetConnection();
this.LoginToMainCommand = new RelayCommand(Login);
this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version;
}
@@ -75,19 +75,19 @@
// PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey);
// Debug.WriteLine(keyModel.data.publicKey);
- if (connection.State == ConnectionState.Open)
+ if (_connection.State == ConnectionState.Open)
{
- string selectUser = "select * from sys_user";
- MySqlCommand cmd = new MySqlCommand(selectUser, connection);
- MySqlDataReader reader = cmd.ExecuteReader();
+ const string selectUser = "select * from sys_user";
+ var cmd = new MySqlCommand(selectUser, _connection);
+ var reader = cmd.ExecuteReader();
while (reader.Read())
{
- string account = reader.GetString("ACCOUNT");
- string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
+ var account = reader.GetString("ACCOUNT");
+ var secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
// TODO 解码得到密码
if (account != _userName || secretKey != _userPassword) continue;
reader.Close();
- CabinetWindow cabinetWindow = new CabinetWindow();
+ var cabinetWindow = new CabinetWindow();
cabinetWindow.Show();
window.Close();
return;
diff --git a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
index 8783fba..e9e6734 100644
--- a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
@@ -1,7 +1,32 @@
-namespace SubCabinetSolution.ViewModel
+using System.Collections.ObjectModel;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Model;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
{
- public class SettingsPageViewModel
+ public class SettingsPageViewModel : ViewModelBase
{
-
+ public ObservableCollection UserModels { get; set; }
+ public RelayCommand AddUserCommand { get; set; }
+
+ public SettingsPageViewModel()
+ {
+ this.UserModels = new ObservableCollection
+ {
+ new UserModel("266", "1", "管理员", "admin", "008108899", "2022/7/7 14:53", "已录入", "--", "正常"),
+ new UserModel("268", "0809", "管理员", "0809", "007667643", "2022/7/7 17:22", "已录入", "--", "正常"),
+ new UserModel("267", "77", "管理员", "77", "", "2022/7/7 17:06", "已录入", "--", "正常"),
+ };
+
+ this.AddUserCommand = new RelayCommand(AddUser);
+ }
+
+ private void AddUser()
+ {
+ var addUserDialog = new AddUserDialog();
+ addUserDialog.ShowDialog();
+ }
}
}
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index dc5346e..704850b 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -43,14 +43,14 @@
public RelayCommand LoginToMainCommand { get; set; }
public string VersionName { get; set; }
- private MySqlConnection connection;
+ private readonly MySqlConnection _connection;
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel()
{
- this.connection = DataBaseManager.GetInstance().GetConnection();
+ this._connection = DataBaseManager.GetInstance().GetConnection();
this.LoginToMainCommand = new RelayCommand(Login);
this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version;
}
@@ -75,19 +75,19 @@
// PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey);
// Debug.WriteLine(keyModel.data.publicKey);
- if (connection.State == ConnectionState.Open)
+ if (_connection.State == ConnectionState.Open)
{
- string selectUser = "select * from sys_user";
- MySqlCommand cmd = new MySqlCommand(selectUser, connection);
- MySqlDataReader reader = cmd.ExecuteReader();
+ const string selectUser = "select * from sys_user";
+ var cmd = new MySqlCommand(selectUser, _connection);
+ var reader = cmd.ExecuteReader();
while (reader.Read())
{
- string account = reader.GetString("ACCOUNT");
- string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
+ var account = reader.GetString("ACCOUNT");
+ var secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
// TODO 解码得到密码
if (account != _userName || secretKey != _userPassword) continue;
reader.Close();
- CabinetWindow cabinetWindow = new CabinetWindow();
+ var cabinetWindow = new CabinetWindow();
cabinetWindow.Show();
window.Close();
return;
diff --git a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
index 8783fba..e9e6734 100644
--- a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
@@ -1,7 +1,32 @@
-namespace SubCabinetSolution.ViewModel
+using System.Collections.ObjectModel;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Model;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
{
- public class SettingsPageViewModel
+ public class SettingsPageViewModel : ViewModelBase
{
-
+ public ObservableCollection UserModels { get; set; }
+ public RelayCommand AddUserCommand { get; set; }
+
+ public SettingsPageViewModel()
+ {
+ this.UserModels = new ObservableCollection
+ {
+ new UserModel("266", "1", "管理员", "admin", "008108899", "2022/7/7 14:53", "已录入", "--", "正常"),
+ new UserModel("268", "0809", "管理员", "0809", "007667643", "2022/7/7 17:22", "已录入", "--", "正常"),
+ new UserModel("267", "77", "管理员", "77", "", "2022/7/7 17:06", "已录入", "--", "正常"),
+ };
+
+ this.AddUserCommand = new RelayCommand(AddUser);
+ }
+
+ private void AddUser()
+ {
+ var addUserDialog = new AddUserDialog();
+ addUserDialog.ShowDialog();
+ }
}
}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/ViewModelLocator.cs b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
index 55e0f5c..05121e1 100644
--- a/SubCabinetSolution/ViewModel/ViewModelLocator.cs
+++ b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
@@ -46,6 +46,7 @@
SimpleIoc.Default.Register(); //������Pageҳ
SimpleIoc.Default.Register(); //����Pageҳ
SimpleIoc.Default.Register(); //������ƷPageҳ
+ SimpleIoc.Default.Register(); //����û�Dialog
// ע�ᵼ��Service
var navigationService = this.InitNavigationService();
@@ -112,6 +113,8 @@
public RecentUsePageViewModel RecentUsePage => ServiceLocator.Current.GetInstance();
+ public AddUserDialogViewModel AddUserDialog => ServiceLocator.Current.GetInstance();
+
public static void Cleanup()
{
// TODO Clear the ViewModels
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index dc5346e..704850b 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -43,14 +43,14 @@
public RelayCommand LoginToMainCommand { get; set; }
public string VersionName { get; set; }
- private MySqlConnection connection;
+ private readonly MySqlConnection _connection;
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel()
{
- this.connection = DataBaseManager.GetInstance().GetConnection();
+ this._connection = DataBaseManager.GetInstance().GetConnection();
this.LoginToMainCommand = new RelayCommand(Login);
this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version;
}
@@ -75,19 +75,19 @@
// PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey);
// Debug.WriteLine(keyModel.data.publicKey);
- if (connection.State == ConnectionState.Open)
+ if (_connection.State == ConnectionState.Open)
{
- string selectUser = "select * from sys_user";
- MySqlCommand cmd = new MySqlCommand(selectUser, connection);
- MySqlDataReader reader = cmd.ExecuteReader();
+ const string selectUser = "select * from sys_user";
+ var cmd = new MySqlCommand(selectUser, _connection);
+ var reader = cmd.ExecuteReader();
while (reader.Read())
{
- string account = reader.GetString("ACCOUNT");
- string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
+ var account = reader.GetString("ACCOUNT");
+ var secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
// TODO 解码得到密码
if (account != _userName || secretKey != _userPassword) continue;
reader.Close();
- CabinetWindow cabinetWindow = new CabinetWindow();
+ var cabinetWindow = new CabinetWindow();
cabinetWindow.Show();
window.Close();
return;
diff --git a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
index 8783fba..e9e6734 100644
--- a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
@@ -1,7 +1,32 @@
-namespace SubCabinetSolution.ViewModel
+using System.Collections.ObjectModel;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Model;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
{
- public class SettingsPageViewModel
+ public class SettingsPageViewModel : ViewModelBase
{
-
+ public ObservableCollection UserModels { get; set; }
+ public RelayCommand AddUserCommand { get; set; }
+
+ public SettingsPageViewModel()
+ {
+ this.UserModels = new ObservableCollection
+ {
+ new UserModel("266", "1", "管理员", "admin", "008108899", "2022/7/7 14:53", "已录入", "--", "正常"),
+ new UserModel("268", "0809", "管理员", "0809", "007667643", "2022/7/7 17:22", "已录入", "--", "正常"),
+ new UserModel("267", "77", "管理员", "77", "", "2022/7/7 17:06", "已录入", "--", "正常"),
+ };
+
+ this.AddUserCommand = new RelayCommand(AddUser);
+ }
+
+ private void AddUser()
+ {
+ var addUserDialog = new AddUserDialog();
+ addUserDialog.ShowDialog();
+ }
}
}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/ViewModelLocator.cs b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
index 55e0f5c..05121e1 100644
--- a/SubCabinetSolution/ViewModel/ViewModelLocator.cs
+++ b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
@@ -46,6 +46,7 @@
SimpleIoc.Default.Register(); //������Pageҳ
SimpleIoc.Default.Register(); //����Pageҳ
SimpleIoc.Default.Register(); //������ƷPageҳ
+ SimpleIoc.Default.Register(); //����û�Dialog
// ע�ᵼ��Service
var navigationService = this.InitNavigationService();
@@ -112,6 +113,8 @@
public RecentUsePageViewModel RecentUsePage => ServiceLocator.Current.GetInstance();
+ public AddUserDialogViewModel AddUserDialog => ServiceLocator.Current.GetInstance();
+
public static void Cleanup()
{
// TODO Clear the ViewModels
diff --git a/SubCabinetSolution/Views/AddUserDialog.xaml b/SubCabinetSolution/Views/AddUserDialog.xaml
new file mode 100644
index 0000000..30eeb89
--- /dev/null
+++ b/SubCabinetSolution/Views/AddUserDialog.xaml
@@ -0,0 +1,329 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index dc5346e..704850b 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -43,14 +43,14 @@
public RelayCommand LoginToMainCommand { get; set; }
public string VersionName { get; set; }
- private MySqlConnection connection;
+ private readonly MySqlConnection _connection;
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel()
{
- this.connection = DataBaseManager.GetInstance().GetConnection();
+ this._connection = DataBaseManager.GetInstance().GetConnection();
this.LoginToMainCommand = new RelayCommand(Login);
this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version;
}
@@ -75,19 +75,19 @@
// PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey);
// Debug.WriteLine(keyModel.data.publicKey);
- if (connection.State == ConnectionState.Open)
+ if (_connection.State == ConnectionState.Open)
{
- string selectUser = "select * from sys_user";
- MySqlCommand cmd = new MySqlCommand(selectUser, connection);
- MySqlDataReader reader = cmd.ExecuteReader();
+ const string selectUser = "select * from sys_user";
+ var cmd = new MySqlCommand(selectUser, _connection);
+ var reader = cmd.ExecuteReader();
while (reader.Read())
{
- string account = reader.GetString("ACCOUNT");
- string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
+ var account = reader.GetString("ACCOUNT");
+ var secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
// TODO 解码得到密码
if (account != _userName || secretKey != _userPassword) continue;
reader.Close();
- CabinetWindow cabinetWindow = new CabinetWindow();
+ var cabinetWindow = new CabinetWindow();
cabinetWindow.Show();
window.Close();
return;
diff --git a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
index 8783fba..e9e6734 100644
--- a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
@@ -1,7 +1,32 @@
-namespace SubCabinetSolution.ViewModel
+using System.Collections.ObjectModel;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Model;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
{
- public class SettingsPageViewModel
+ public class SettingsPageViewModel : ViewModelBase
{
-
+ public ObservableCollection UserModels { get; set; }
+ public RelayCommand AddUserCommand { get; set; }
+
+ public SettingsPageViewModel()
+ {
+ this.UserModels = new ObservableCollection
+ {
+ new UserModel("266", "1", "管理员", "admin", "008108899", "2022/7/7 14:53", "已录入", "--", "正常"),
+ new UserModel("268", "0809", "管理员", "0809", "007667643", "2022/7/7 17:22", "已录入", "--", "正常"),
+ new UserModel("267", "77", "管理员", "77", "", "2022/7/7 17:06", "已录入", "--", "正常"),
+ };
+
+ this.AddUserCommand = new RelayCommand(AddUser);
+ }
+
+ private void AddUser()
+ {
+ var addUserDialog = new AddUserDialog();
+ addUserDialog.ShowDialog();
+ }
}
}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/ViewModelLocator.cs b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
index 55e0f5c..05121e1 100644
--- a/SubCabinetSolution/ViewModel/ViewModelLocator.cs
+++ b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
@@ -46,6 +46,7 @@
SimpleIoc.Default.Register(); //������Pageҳ
SimpleIoc.Default.Register(); //����Pageҳ
SimpleIoc.Default.Register(); //������ƷPageҳ
+ SimpleIoc.Default.Register(); //����û�Dialog
// ע�ᵼ��Service
var navigationService = this.InitNavigationService();
@@ -112,6 +113,8 @@
public RecentUsePageViewModel RecentUsePage => ServiceLocator.Current.GetInstance();
+ public AddUserDialogViewModel AddUserDialog => ServiceLocator.Current.GetInstance();
+
public static void Cleanup()
{
// TODO Clear the ViewModels
diff --git a/SubCabinetSolution/Views/AddUserDialog.xaml b/SubCabinetSolution/Views/AddUserDialog.xaml
new file mode 100644
index 0000000..30eeb89
--- /dev/null
+++ b/SubCabinetSolution/Views/AddUserDialog.xaml
@@ -0,0 +1,329 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/Views/AddUserDialog.xaml.cs b/SubCabinetSolution/Views/AddUserDialog.xaml.cs
new file mode 100644
index 0000000..f9c98e1
--- /dev/null
+++ b/SubCabinetSolution/Views/AddUserDialog.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows;
+
+namespace SubCabinetSolution.Views
+{
+ public partial class AddUserDialog : Window
+ {
+ public AddUserDialog()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/.vs/SubCabinetSolution/v17/.suo b/.vs/SubCabinetSolution/v17/.suo
index cbb3f5f..dd7a15b 100644
--- a/.vs/SubCabinetSolution/v17/.suo
+++ b/.vs/SubCabinetSolution/v17/.suo
Binary files differ
diff --git "a/SubCabinetSolution/Images/\345\257\206\347\240\201.png" "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
new file mode 100644
index 0000000..b075f61
--- /dev/null
+++ "b/SubCabinetSolution/Images/\345\257\206\347\240\201.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..055431f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\346\267\273\345\212\240\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\347\224\250\346\210\267.png" "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
new file mode 100644
index 0000000..07ae36f
--- /dev/null
+++ "b/SubCabinetSolution/Images/\347\224\250\346\210\267.png"
Binary files differ
diff --git "a/SubCabinetSolution/Images/\351\224\231\350\257\257.png" "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
new file mode 100644
index 0000000..2f6305a
--- /dev/null
+++ "b/SubCabinetSolution/Images/\351\224\231\350\257\257.png"
Binary files differ
diff --git a/SubCabinetSolution/Model/UserModel.cs b/SubCabinetSolution/Model/UserModel.cs
new file mode 100644
index 0000000..2881d70
--- /dev/null
+++ b/SubCabinetSolution/Model/UserModel.cs
@@ -0,0 +1,31 @@
+namespace SubCabinetSolution.Model
+{
+ public class UserModel
+ {
+ public UserModel(string userId, string userName, string userRole, string userSerialNum, string userCardNum,
+ string registerTime, string faceFeature, string opticalFeature, string userState)
+ {
+ UserId = userId;
+ UserName = userName;
+ UserRole = userRole;
+ UserSerialNum = userSerialNum;
+ UserCardNum = userCardNum;
+ RegisterTime = registerTime;
+ FaceFeature = faceFeature;
+ OpticalFeature = opticalFeature;
+ UserState = userState;
+ }
+
+ public string UserId { get; }
+ public string UserName { get; }
+ public string UserRole { get; }
+ public string UserSerialNum { get; }
+ public string UserCardNum { get; }
+ public string RegisterTime { get; }
+
+ // 虹膜信息
+ public string FaceFeature { get; }
+ public string OpticalFeature { get; }
+ public string UserState { get; }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/SubCabinetSolution.csproj b/SubCabinetSolution/SubCabinetSolution.csproj
index 29b8b67..984a7fb 100644
--- a/SubCabinetSolution/SubCabinetSolution.csproj
+++ b/SubCabinetSolution/SubCabinetSolution.csproj
@@ -155,11 +155,13 @@
+
+
@@ -173,6 +175,9 @@
+
+ AddUserDialog.xaml
+
AdoptionPage.xaml
@@ -218,6 +223,7 @@
MainWindow.xaml
Code
+
@@ -325,5 +331,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
new file mode 100644
index 0000000..a0470b8
--- /dev/null
+++ b/SubCabinetSolution/ViewModel/AddUserDialogViewModel.cs
@@ -0,0 +1,91 @@
+using System.Windows;
+using System.Windows.Media;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
+{
+ public class AddUserDialogViewModel : ViewModelBase
+ {
+ public RelayCommand CloseWindowCommand { get; set; }
+ public RelayCommand AccountTextChangedCommand { get; set; }
+ public RelayCommand InputPasswordChangedCommand { get; set; }
+ public RelayCommand ConfirmPasswordChangedCommand { get; set; }
+ public RelayCommand NameTextChangedCommand { get; set; }
+
+ public AddUserDialogViewModel()
+ {
+ this.CloseWindowCommand = new RelayCommand(CloseWindow);
+ this.AccountTextChangedCommand = new RelayCommand(AccountTextChanged);
+ this.InputPasswordChangedCommand = new RelayCommand(InputPasswordTextChanged);
+ this.ConfirmPasswordChangedCommand = new RelayCommand(ConfirmPasswordTextChanged);
+ this.NameTextChangedCommand = new RelayCommand(NameTextChanged);
+ }
+
+ private void CloseWindow(Window window)
+ {
+ window.Close();
+ }
+
+ private void AccountTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.AccountTextBox.Text.Length > 0)
+ {
+ dialog.AccountTextBox.Background = Brushes.White;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.AccountTextBox.Background = Brushes.Transparent;
+ dialog.AccountHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void InputPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.InputPasswordTextBox.Password.Length > 0)
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.White;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.InputPasswordTextBox.Background = Brushes.Transparent;
+ dialog.InputPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void ConfirmPasswordTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.ConfirmPasswordTextBox.Password.Length > 0)
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.White;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.ConfirmPasswordTextBox.Background = Brushes.Transparent;
+ dialog.ConfirmPasswordHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void NameTextChanged(Window window)
+ {
+ var dialog = (AddUserDialog)window;
+ if (dialog.NameTextBox.Text.Length > 0)
+ {
+ dialog.NameTextBox.Background = Brushes.White;
+ dialog.NameHintTextBlock.Visibility = Visibility.Hidden;
+ }
+ else
+ {
+ dialog.NameTextBox.Background = Brushes.Transparent;
+ dialog.NameHintTextBlock.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
index 7c9e3e8..418fcc8 100644
--- a/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/AdoptionPageViewModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
using GalaSoft.MvvmLight;
using SubCabinetSolution.Model;
@@ -7,11 +6,11 @@
{
public class AdoptionPageViewModel : ViewModelBase
{
- public ObservableCollection SurgeryModelList { get; set; }
+ public ObservableCollection SurgeryModels { get; set; }
public AdoptionPageViewModel()
{
- this.SurgeryModelList = new ObservableCollection
+ this.SurgeryModels = new ObservableCollection
{
new SurgeryModel("赵新明", "妇科", "2022-8-29 12:42:58", "138909"),
new SurgeryModel("郭仕仕", "普外-耳鼻喉科", "2022-8-29 12:43:30", "138848"),
diff --git a/SubCabinetSolution/ViewModel/MainViewModel.cs b/SubCabinetSolution/ViewModel/MainViewModel.cs
index dc5346e..704850b 100644
--- a/SubCabinetSolution/ViewModel/MainViewModel.cs
+++ b/SubCabinetSolution/ViewModel/MainViewModel.cs
@@ -43,14 +43,14 @@
public RelayCommand LoginToMainCommand { get; set; }
public string VersionName { get; set; }
- private MySqlConnection connection;
+ private readonly MySqlConnection _connection;
///
/// Initializes a new instance of the MainViewModel class.
///
public MainViewModel()
{
- this.connection = DataBaseManager.GetInstance().GetConnection();
+ this._connection = DataBaseManager.GetInstance().GetConnection();
this.LoginToMainCommand = new RelayCommand(Login);
this.VersionName = "版本号 Ver " + Application.ResourceAssembly.GetName().Version;
}
@@ -75,19 +75,19 @@
// PublicKeyModel keyModel = JsonConvert.DeserializeObject(publicKey);
// Debug.WriteLine(keyModel.data.publicKey);
- if (connection.State == ConnectionState.Open)
+ if (_connection.State == ConnectionState.Open)
{
- string selectUser = "select * from sys_user";
- MySqlCommand cmd = new MySqlCommand(selectUser, connection);
- MySqlDataReader reader = cmd.ExecuteReader();
+ const string selectUser = "select * from sys_user";
+ var cmd = new MySqlCommand(selectUser, _connection);
+ var reader = cmd.ExecuteReader();
while (reader.Read())
{
- string account = reader.GetString("ACCOUNT");
- string secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
+ var account = reader.GetString("ACCOUNT");
+ var secretKey = reader.GetString("PASSWORD"); //被加盐之后的密码
// TODO 解码得到密码
if (account != _userName || secretKey != _userPassword) continue;
reader.Close();
- CabinetWindow cabinetWindow = new CabinetWindow();
+ var cabinetWindow = new CabinetWindow();
cabinetWindow.Show();
window.Close();
return;
diff --git a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
index 8783fba..e9e6734 100644
--- a/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
+++ b/SubCabinetSolution/ViewModel/SettingsPageViewModel.cs
@@ -1,7 +1,32 @@
-namespace SubCabinetSolution.ViewModel
+using System.Collections.ObjectModel;
+using GalaSoft.MvvmLight;
+using GalaSoft.MvvmLight.Command;
+using SubCabinetSolution.Model;
+using SubCabinetSolution.Views;
+
+namespace SubCabinetSolution.ViewModel
{
- public class SettingsPageViewModel
+ public class SettingsPageViewModel : ViewModelBase
{
-
+ public ObservableCollection UserModels { get; set; }
+ public RelayCommand AddUserCommand { get; set; }
+
+ public SettingsPageViewModel()
+ {
+ this.UserModels = new ObservableCollection
+ {
+ new UserModel("266", "1", "管理员", "admin", "008108899", "2022/7/7 14:53", "已录入", "--", "正常"),
+ new UserModel("268", "0809", "管理员", "0809", "007667643", "2022/7/7 17:22", "已录入", "--", "正常"),
+ new UserModel("267", "77", "管理员", "77", "", "2022/7/7 17:06", "已录入", "--", "正常"),
+ };
+
+ this.AddUserCommand = new RelayCommand(AddUser);
+ }
+
+ private void AddUser()
+ {
+ var addUserDialog = new AddUserDialog();
+ addUserDialog.ShowDialog();
+ }
}
}
\ No newline at end of file
diff --git a/SubCabinetSolution/ViewModel/ViewModelLocator.cs b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
index 55e0f5c..05121e1 100644
--- a/SubCabinetSolution/ViewModel/ViewModelLocator.cs
+++ b/SubCabinetSolution/ViewModel/ViewModelLocator.cs
@@ -46,6 +46,7 @@
SimpleIoc.Default.Register(); //������Pageҳ
SimpleIoc.Default.Register(); //����Pageҳ
SimpleIoc.Default.Register(); //������ƷPageҳ
+ SimpleIoc.Default.Register(); //����û�Dialog
// ע�ᵼ��Service
var navigationService = this.InitNavigationService();
@@ -112,6 +113,8 @@
public RecentUsePageViewModel RecentUsePage => ServiceLocator.Current.GetInstance();
+ public AddUserDialogViewModel AddUserDialog => ServiceLocator.Current.GetInstance();
+
public static void Cleanup()
{
// TODO Clear the ViewModels
diff --git a/SubCabinetSolution/Views/AddUserDialog.xaml b/SubCabinetSolution/Views/AddUserDialog.xaml
new file mode 100644
index 0000000..30eeb89
--- /dev/null
+++ b/SubCabinetSolution/Views/AddUserDialog.xaml
@@ -0,0 +1,329 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/Views/AddUserDialog.xaml.cs b/SubCabinetSolution/Views/AddUserDialog.xaml.cs
new file mode 100644
index 0000000..f9c98e1
--- /dev/null
+++ b/SubCabinetSolution/Views/AddUserDialog.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows;
+
+namespace SubCabinetSolution.Views
+{
+ public partial class AddUserDialog : Window
+ {
+ public AddUserDialog()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml
index e4feaa2..65aaa5a 100644
--- a/SubCabinetSolution/Views/AdoptionPage.xaml
+++ b/SubCabinetSolution/Views/AdoptionPage.xaml
@@ -31,7 +31,7 @@
-
+
@@ -48,7 +48,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/SubCabinetSolution/Views/AddUserDialog.xaml.cs b/SubCabinetSolution/Views/AddUserDialog.xaml.cs
new file mode 100644
index 0000000..f9c98e1
--- /dev/null
+++ b/SubCabinetSolution/Views/AddUserDialog.xaml.cs
@@ -0,0 +1,12 @@
+using System.Windows;
+
+namespace SubCabinetSolution.Views
+{
+ public partial class AddUserDialog : Window
+ {
+ public AddUserDialog()
+ {
+ InitializeComponent();
+ }
+ }
+}
\ No newline at end of file
diff --git a/SubCabinetSolution/Views/AdoptionPage.xaml b/SubCabinetSolution/Views/AdoptionPage.xaml
index e4feaa2..65aaa5a 100644
--- a/SubCabinetSolution/Views/AdoptionPage.xaml
+++ b/SubCabinetSolution/Views/AdoptionPage.xaml
@@ -31,7 +31,7 @@
-
+
@@ -48,7 +48,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file