diff --git a/DM_Weight.Commons/DM_Weight.Commons.csproj b/DM_Weight.Commons/DM_Weight.Commons.csproj new file mode 100644 index 0000000..467963e --- /dev/null +++ b/DM_Weight.Commons/DM_Weight.Commons.csproj @@ -0,0 +1,13 @@ + + + + net6.0-windows + enable + true + + + + + + + diff --git a/DM_Weight.Commons/ValidatRules/ValidationErrorMappingBehavior.cs b/DM_Weight.Commons/ValidatRules/ValidationErrorMappingBehavior.cs new file mode 100644 index 0000000..fce3c87 --- /dev/null +++ b/DM_Weight.Commons/ValidatRules/ValidationErrorMappingBehavior.cs @@ -0,0 +1,75 @@ +using Microsoft.Xaml.Behaviors; +using System.Collections.ObjectModel; +using System.Windows; +using System.Windows.Controls; + +namespace DM_Weight.Commons.ValidatRules +{ + public class ValidationErrorMappingBehavior : Behavior + { + #region Properties + + public static readonly DependencyProperty ValidationErrorsProperty = + DependencyProperty.Register("ValidationErrors", typeof(ObservableCollection), + typeof(ValidationErrorMappingBehavior), new PropertyMetadata(new ObservableCollection())); + + public ObservableCollection ValidationErrors + { + get { return (ObservableCollection)this.GetValue(ValidationErrorsProperty); } + set { this.SetValue(ValidationErrorsProperty, value); } + } + + public static readonly DependencyProperty HasValidationErrorProperty = DependencyProperty.Register("HasValidationError", + typeof(bool), typeof(ValidationErrorMappingBehavior), new PropertyMetadata(false)); + + public bool HasValidationError + { + get { return (bool)this.GetValue(HasValidationErrorProperty); } + set { this.SetValue(HasValidationErrorProperty, value); } + } + + #endregion + + #region Constructors + + public ValidationErrorMappingBehavior() + : base() + { } + + #endregion + + #region Events & Event Methods + + private void Validation_Error(object sender, ValidationErrorEventArgs e) + { + if (e.Action == ValidationErrorEventAction.Added) + { + this.ValidationErrors.Add(e.Error); + } + else + { + this.ValidationErrors.Remove(e.Error); + } + + this.HasValidationError = this.ValidationErrors.Count > 0; + } + + #endregion + + #region Support Methods + + protected override void OnAttached() + { + base.OnAttached(); + Validation.AddErrorHandler(this.AssociatedObject, Validation_Error); + } + + protected override void OnDetaching() + { + base.OnDetaching(); + Validation.RemoveErrorHandler(this.AssociatedObject, Validation_Error); + } + + #endregion + } +} diff --git a/DM_Weight.sln b/DM_Weight.sln index 7c397af..1e50fcf 100644 --- a/DM_Weight.sln +++ b/DM_Weight.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 17.3.32922.545 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DM_Weight", "DM_Weight\DM_Weight.csproj", "{439FA76B-F874-40DB-BAF2-E3647CD55B10}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DM_Weight.Commons", "DM_Weight.Commons\DM_Weight.Commons.csproj", "{7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,6 +29,18 @@ Global {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x64.Build.0 = Release|x64 {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.ActiveCfg = Debug|x86 {439FA76B-F874-40DB-BAF2-E3647CD55B10}.Release|x86.Build.0 = Debug|x86 + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.ActiveCfg = Debug|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x64.Build.0 = Debug|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.ActiveCfg = Debug|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Debug|x86.Build.0 = Debug|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|Any CPU.Build.0 = Release|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x64.ActiveCfg = Release|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x64.Build.0 = Release|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x86.ActiveCfg = Release|Any CPU + {7F9FA18B-5C28-476E-97D4-B5504B8DEB9B}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DM_Weight/App.config b/DM_Weight/App.config index e9a2333..73292e0 100644 --- a/DM_Weight/App.config +++ b/DM_Weight/App.config @@ -3,7 +3,7 @@ - + - + + + + + + + + + + + + + + - + @@ -23,8 +36,11 @@ + + + - + @@ -41,6 +57,22 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DM_Weight/Views/AccountWindow.xaml.cs b/DM_Weight/Views/AccountWindow.xaml.cs new file mode 100644 index 0000000..08f3686 --- /dev/null +++ b/DM_Weight/Views/AccountWindow.xaml.cs @@ -0,0 +1,51 @@ +using DM_Weight.ViewModels; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DM_Weight.Views +{ + /// + /// AccountWindow.xaml 的交互逻辑 + /// + public partial class AccountWindow : UserControl + { + AccountWindowViewModel vms; + public AccountWindow() + { + InitializeComponent(); + } + /// + /// 药品名称下拉框 + /// + /// + /// + private void ComboBox_KeyUp(object sender, KeyEventArgs e) + { + ComboBox comboBox = sender as ComboBox; + vms.UpdateComboBoxItems(comboBox.Text); + if (this.vms.DrugInfos.Count > 0) + { + comboBox.IsDropDownOpen = true; + } + TextBox textBox = (TextBox)comboBox.Template.FindName("PART_EditableTextBox", comboBox); + textBox.SelectionStart = textBox.Text.Length; + } + + private void UserControl_Loaded(object sender, RoutedEventArgs e) + { + vms = AccountWindowViewModel.vm; + } + } +} diff --git a/DM_Weight/Views/ApplyListWindow.xaml b/DM_Weight/Views/ApplyListWindow.xaml new file mode 100644 index 0000000..8243d31 --- /dev/null +++ b/DM_Weight/Views/ApplyListWindow.xaml @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DM_Weight/Views/ApplyListWindow.xaml.cs b/DM_Weight/Views/ApplyListWindow.xaml.cs new file mode 100644 index 0000000..0eaa07f --- /dev/null +++ b/DM_Weight/Views/ApplyListWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DM_Weight.Views +{ + /// + /// ApplyListWindow.xaml 的交互逻辑 + /// + public partial class ApplyListWindow : UserControl + { + public ApplyListWindow() + { + InitializeComponent(); + } + } +} diff --git a/DM_Weight/Views/ChangeShiftsListWindow.xaml b/DM_Weight/Views/ChangeShiftsListWindow.xaml new file mode 100644 index 0000000..fcab7a8 --- /dev/null +++ b/DM_Weight/Views/ChangeShiftsListWindow.xaml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DM_Weight/Views/ChangeShiftsListWindow.xaml.cs b/DM_Weight/Views/ChangeShiftsListWindow.xaml.cs new file mode 100644 index 0000000..3c5b7fa --- /dev/null +++ b/DM_Weight/Views/ChangeShiftsListWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DM_Weight.Views +{ + /// + /// ChangeShiftsListWindow.xaml 的交互逻辑 + /// + public partial class ChangeShiftsListWindow : UserControl + { + public ChangeShiftsListWindow() + { + InitializeComponent(); + } + } +} diff --git a/DM_Weight/Views/CollectDrugWindow.xaml b/DM_Weight/Views/CollectDrugWindow.xaml new file mode 100644 index 0000000..d8de6ac --- /dev/null +++ b/DM_Weight/Views/CollectDrugWindow.xaml @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DM_Weight/Views/CollectDrugWindow.xaml.cs b/DM_Weight/Views/CollectDrugWindow.xaml.cs new file mode 100644 index 0000000..73f65aa --- /dev/null +++ b/DM_Weight/Views/CollectDrugWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace DM_Weight.Views +{ + /// + /// CollectDrugWindow.xaml 的交互逻辑 + /// + public partial class CollectDrugWindow : UserControl + { + public CollectDrugWindow() + { + InitializeComponent(); + } + } +} diff --git a/DM_Weight/Views/Dialog/ChangeShiftsDialog.xaml b/DM_Weight/Views/Dialog/ChangeShiftsDialog.xaml new file mode 100644 index 0000000..1ee41d0 --- /dev/null +++ b/DM_Weight/Views/Dialog/ChangeShiftsDialog.xaml @@ -0,0 +1,163 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -->