From 15b87f46850c6566f7846b10700f46ab724027dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=AD=B1=E5=82=91?= <840465812@qq.com>
Date: Fri, 2 Aug 2019 14:26:44 +0800
Subject: [PATCH] Add MVVM Base
Add DelegateCommand
Add ViewModelBase
---
MVVM/DelegateCommand.cs | 297 ++++++++++++++++++++++++++++++++++++++++
MVVM/ViewModelBase.cs | 46 +++++++
2 files changed, 343 insertions(+)
create mode 100644 MVVM/DelegateCommand.cs
create mode 100644 MVVM/ViewModelBase.cs
diff --git a/MVVM/DelegateCommand.cs b/MVVM/DelegateCommand.cs
new file mode 100644
index 0000000..3d14b55
--- /dev/null
+++ b/MVVM/DelegateCommand.cs
@@ -0,0 +1,297 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Windows;
+using System.Windows.Input;
+using System.Windows.Threading;
+
+namespace Command
+{
+
+ ///
+ /// Provides an implementation which relays the Execute and CanExecute
+ /// method to the specified delegates.
+ ///
+ public class DelegateCommand : ICommand
+ {
+ #region Static disabled command
+
+ ///
+ /// A instance that does nothing and can never be executed.
+ ///
+ public static readonly DelegateCommand Disabled = new DelegateCommand(() => { }) { IsEnabled = false };
+
+ #endregion Static disabled command
+
+ #region Private data
+
+ private readonly Action