public JazzPropertyCommand(JazzGraphContainer container,
                                   T thing, string property, P newValue, bool extendable)
            : base(container)
        {
            this.mThing    = thing;
            this.mPropName = property;
            this.mProperty = typeof(T).GetProperty(property);
            if (this.mProperty == null)
            {
                throw new ArgumentException(typeof(T).Name + "." + property +
                                            " does not exist or is inaccessible.", "property");
            }
            object oldVal = this.mProperty.GetValue(this.mThing, null);

            if (typeof(P).IsPrimitive)
            {
                this.mOldVal = (P)Convert.ChangeType(oldVal, typeof(P));
            }
            else
            {
                this.mOldVal = (P)oldVal;
            }
            this.mNewVal     = newValue;
            this.bExtendable = extendable;
        }
Esempio n. 2
0
 public JazzCommand(JazzGraphContainer container)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     this.mContainer = container;
 }
Esempio n. 3
0
 public NameCommand(JazzGraphContainer container,
                    string newName, bool extendable)
 {
     this.mContainer  = container;
     this.mOldName    = container.mName;
     this.mNewName    = newName;
     this.bExtendable = extendable;
     this.SetLabel();
 }
Esempio n. 4
0
 public JazzCommand(JazzGraphContainer container,
                    bool groupWithPrevCommand, string label)
     : base(groupWithPrevCommand, label)
 {
     if (container == null)
     {
         throw new ArgumentNullException("container");
     }
     this.mContainer = container;
 }
Esempio n. 5
0
        public bool RemoveJazzGraph(JazzGraphContainer jgc)
        {
            if (jgc == null)
            {
                return(false);
            }
            int index = jgc.Index;

            for (int i = this.Graphs.Count - 1; i >= 0; i--)
            {
                jgc = this.Graphs[i];
                if (jgc.Index == index)
                {
                    this.Graphs.RemoveAt(i);
                    return(true);
                }
            }
            return(false);
        }