]> O.S.I.I.S - jp/crow.git/commitdiff
Command class creation
authorjpbruyere <jp.bruyere@hotmail.com>
Sat, 20 Aug 2016 16:58:31 +0000 (18:58 +0200)
committerjpbruyere <jp.bruyere@hotmail.com>
Thu, 1 Sep 2016 10:44:39 +0000 (12:44 +0200)
Crow.csproj
src/Command.cs [new file with mode: 0644]

index 5c6cb9e3c96dc43ff33fe72837687c7930e1322c..70b7d79900f7fdb8fc4ee6dd594d6e9bee558bd2 100644 (file)
     <Compile Include="src\GraphicObjects\TemplatedGroup.cs" />
     <Compile Include="src\GraphicObjects\MenuItem.cs" />
     <Compile Include="src\GraphicObjects\Menu.cs" />
+    <Compile Include="src\Command.cs" />
   </ItemGroup>
   <ItemGroup>
     <Reference Include="System" />
diff --git a/src/Command.cs b/src/Command.cs
new file mode 100644 (file)
index 0000000..35a7fac
--- /dev/null
@@ -0,0 +1,69 @@
+//
+//  Command.cs
+//
+//  Author:
+//       Jean-Philippe Bruyère <jp.bruyere@hotmail.com>
+//
+//  Copyright (c) 2016 jp
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+using System;
+using System.Xml.Serialization;
+using System.ComponentModel;
+
+namespace Crow
+{
+       public class Command : IValueChange
+       {
+               #region IValueChange implementation
+               public event EventHandler<ValueChangeEventArgs> ValueChanged;
+               public virtual void NotifyValueChanged(string MemberName, object _value)
+               {
+                       ValueChanged.Raise(this, new ValueChangeEventArgs(MemberName, _value));
+               }
+               #endregion
+
+               #region CTOR
+               public Command ()
+               {
+               }
+               #endregion
+
+               string caption;
+               bool isEnabled;
+
+
+               [XmlAttributeAttribute()][DefaultValue(true)]
+               public virtual bool IsEnabled {
+                       get { return isEnabled; }
+                       set {
+                               if (isEnabled == value)
+                                       return;
+                               isEnabled = value;
+                               NotifyValueChanged ("IsEnabled", isEnabled);
+                       }
+               }
+               [XmlAttributeAttribute()][DefaultValue("Unamed Command")]
+               public virtual string Caption {
+                       get { return caption; }
+                       set {
+                               if (caption == value)
+                                       return;
+                               caption = value;
+                               NotifyValueChanged ("Caption", caption);
+
+                       }
+               }
+       }
+}