Example #1
0
        protected override void OnGetValue(PropertySpecEventArgs e)
        {
            base.OnGetValue(e);

            var attributeList = new List<Attribute>();
            attributeList.AddRange(e.Property.Attributes.ToList());

            //check all of the attributes: if we find a dynamic one, evaluate it and possibly add/overwrite a static attribute
            foreach (Attribute customAttribute in e.Property.Attributes)
            {
                if (customAttribute is DynamicReadOnlyAttribute)
                {
                    attributeList.RemoveAll(x => x is ReadOnlyAttribute);

                    if (DynamicReadOnlyAttribute.IsDynamicReadOnly(propertyObject, e.Property.Name))
                    {
                        //condition is true: the dynamic attribute should be applied (as static attribute)
                        attributeList.Add(new ReadOnlyAttribute(true)); //add static read only attribute
                    }
                }
            }
            
            e.Property.Attributes = attributeList.ToArray();

            var propertyInfo = propertyObject.GetType().GetProperty(e.Property.Name);
            var value = propertyInfo.GetValue(propertyObject, null);

            var isNestedPropertiesObject = IsNestedExpandablePropertiesObject(propertyInfo);

            // if nested properties object, wrap in DynamicPropertyBag to provide support for things like DynamicReadOnly
            e.Value = isNestedPropertiesObject ? new DynamicPropertyBag(value) : value;
        }
 protected override void OnGetValue(PropertySpecEventArgs e)
 {
     if (dataItemPropertyBag.Properties.Contains(e.Property))
     {
         var descriptor = (dataItemPropertyBag as ICustomTypeDescriptor).GetProperties().Find(e.Property.Name, false);
         e.Value = descriptor.GetValue(dataItemProperties);
     }
     else
     {
         base.OnGetValue(e);
     }
 }
Example #3
0
        void bag_SetValue(object sender, PropertySpecEventArgs e)
        {
            if ((e.Property.Attributes[0]  as ReadOnlyAttribute).IsReadOnly)
            {
                return;
            }

            m_isChangableTable.Remove(e.Property.Name);
            m_isChangableTable.Add(e.Property.Name, true);
            m_propetyTable.Remove(e.Property.Name);
            m_propetyTable.Add(e.Property.Name, e.Value);
        }
 protected override void OnGetValue(PropertySpecEventArgs e)
 {
     if (dataItemPropertyBag.Properties.Contains(e.Property))
     {
         var descriptor = (dataItemPropertyBag as ICustomTypeDescriptor).GetProperties().Find(e.Property.Name,false);
         e.Value = descriptor.GetValue(dataItemProperties);
     }
     else
     {
         base.OnGetValue(e);
     }
 }
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "Title":

                //use the logic and the constraint of the object that is being reflected
                if (!(e.Value.ToString() == null))
                {
                    mTitle = System.Convert.ToString(e.Value);
                }
                else
                {
                    //MessageBox.Show("Not a valid label", "Invalid label", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                    this.Invalidate();
                }
                break;

            case "Subtitle":

                //use the logic and the constraint of the object that is being reflected
                if (!(e.Value.ToString() == null))
                {
                    mSubtitle = System.Convert.ToString(e.Value);
                }
                else
                {
                    //MessageBox.Show("Not a valid label", "Invalid label", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                    this.Invalidate();
                }
                break;

            case "SubType":

                SubType = (SubTypes)Enum.Parse(typeof(SubTypes), e.Value.ToString());
                break;

            case "Observations":

                if (!(e.Value.ToString() == null))
                {
                    mObservation = System.Convert.ToString(e.Value);
                }
                else
                {
                    //MessageBox.Show("Not a valid label", "Invalid label", MessageBoxButtons.OK, MessageBoxIcon.Warning)
                    this.Invalidate();
                }
                break;
            }
        }
Example #6
0
        /* Allows the propertygrid to set new values */
        protected void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Global Labels": e.Value = this.globalLabels; break;

            case "Variables": e.Value = this.globalVariables; break;

            case "Name": e.Value = this.name; break;

            case "Graphic": e.Value = this.graphic; break;
            }
        }
Example #7
0
        /* Allows the propertygrid to set new values */
        protected virtual void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Labels": e.Value = this.localLabels; break;

            case "Variables": e.Value = this.localVariables; break;

            case "Name": e.Value = this.name; break;

            case "nodeType": e.Value = this.XmlNodeType; break;
            }
        }
Example #8
0
        /* Allows the propertygrid to set new values. */
        protected virtual void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Labels": this.localLabels = (List <string>)e.Value; break;

            case "Variables": this.localVariables = (List <double>)e.Value; break;

            case "Name": this.name = (string)e.Value; break;

            case "nodeType": this.XmlNodeType = (string)e.Value; break;
            }
        }
Example #9
0
 void locationBag_GetValue(object sender, PropertySpecEventArgs e)
 {
     if (DB.locationBinding.Current != null)
     {
         DataRowView rowView = ((DataRowView)DB.locationBinding.Current);
         switch (e.Property.Name)
         {
         default:
             e.Value = rowView[e.Property.Name];
             break;
         }
     }
 }
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);

            switch (e.Property.Name)
            {
            case "DisplayArrayLength":
                e.Value = displayLength; break;

            case "VisualizationType":
                e.Value = this.visualization; break;
            }
        }
        private void bag1_SetValue(object sender, PropertySpecEventArgs e)
        {
            if (e.Property.Category == "Registers")
            {
                try
                {
                    uint iValue;
                    if (Settings.Simulator.bShowRegistersInHex)
                    {
                        iValue =
                            uint.Parse((string)e.Value, System.Globalization.NumberStyles.AllowHexSpecifier);
                    }
                    else
                    {
                        iValue = uint.Parse((string)e.Value);
                    }

                    if (e.Property.Name == "PSW")
                    {
                        reg.PSL.PSW = (Registers.Register)iValue;
                    }
                    else if (e.Property.Name == "Cycles")
                    {
                        return;
                    }
                    else
                    {
                        reg[int.Parse(e.Property.Name.Substring(1))] = iValue;
                    }

                    UpdateRegistersDisplay();                     // changing PSW changes the flags too
                }
                catch { }
            }
            else if (e.Property.Category == "VAX11 Flags")
            {
                byte boolValue = (int)e.Value != 0 ? (byte)1 :(byte)0;
                switch (e.Property.Name)
                {
                case "V": reg.PSL.V = boolValue; break;

                case "C": reg.PSL.C = boolValue; break;

                case "N": reg.PSL.N = boolValue; break;

                case "Z": reg.PSL.Z = boolValue; break;
                }
                ;
                UpdateRegistersDisplay();                 // changing the flags changes PSW, PSL too
            }
        }
Example #12
0
        /* Allows the propertygrid to set new values. */
        protected void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "# of Rule Sets":
            {
                if ((int)e.Value > this.numOfRuleSets)
                {
                    for (int i = this.numOfRuleSets; i != (int)e.Value; i++)
                    {
                        this.defaultRSFileNames.Add("");
                    }
                }
                else if ((int)e.Value < this.numOfRuleSets)
                {
                    this.defaultRSFileNames.RemoveRange((int)e.Value,
                                                        (this.numOfRuleSets - (int)e.Value));
                }
                this.numOfRuleSets = (int)e.Value; break;
            }

            case "Max # Rules to Apply": this.maxRulesToApply = (int)e.Value; break;

            case "Max # Rules to Display": this.maxRulesToDisplay = (int)e.Value; break;

            case "Default Verbosity": this.defaultVerbosity = (int)e.Value; break;

            case "Recompile Rules": this.recompileRules = (Boolean)e.Value; break;

            case "Confirm Each User Choice": this.confirmEachUserChoice = (Boolean)e.Value; break;

            case "Keep Search Controller in Main": this.searchControllerInMain = (Boolean)e.Value; break;

            case "Search Controller AutoPlay": this.searchControllerPlayOnStart = (Boolean)e.Value; break;

            case "Get Help from Online": this.getHelpFromOnline = (Boolean)e.Value; break;

            case "Default Layout Algorithm": this.defaultLayoutAlgorithm = (defaultLayoutAlg)e.Value; break;

            case "Default For GenStep - After Normal": this.generationAfterNormal = (nextGenerationSteps)e.Value; break;

            case "Default For GenStep - After Choice": this.generationAfterChoice = (nextGenerationSteps)e.Value; break;

            case "Default For GenStep - After No Rules": this.generationAfterNoRules = (nextGenerationSteps)e.Value; break;

            case "Default For GenStep - AfterCycle Limit": this.generationAfterCycleLimit = (nextGenerationSteps)e.Value; break;

            case "Default For GenStep - After Trigger": this.generationAfterTriggerRule = (nextGenerationSteps)e.Value; break;
            }
        }
Example #13
0
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "Font":
                e.Value = this.Font;
                break;

            case "TextColor":
                e.Value = this.TextColor;
                break;
            }
        }
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "DisplayArrayLength":
                DisplayLength = (int)e.Value; break;

            case "VisualizationType":
                this.visualization = (VisualizationTypes)e.Value;
                ChangeVisualization();
                break;
            }
        }
Example #15
0
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "Font":
                this.Font = e.Value as Font;
                break;

            case "TextColor":
                this.TextColor = (Color)e.Value;
                break;
            }
        }
Example #16
0
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);

            switch (e.Property.Name)
            {
            case "UpperColor":
                e.Value = this.LightColor;
                break;

            case "LowerColor":
                e.Value = this.DarkColor;
                break;
            }
        }
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "ShiftValue":
                e.Value = this.shiftValue; break;

            case "ScalingValue":
                e.Value = this.scalingValue;
                break;

            case "OutputType":
                e.Value = this.outputType; break;
            }
        }
Example #18
0
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "UID":
                e.Value = this.UID.ToString();

                break;

            case "Angle":
                e.Value = this.angle;

                break;
            }
        }
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "Amplitude":
                e.Value = this.mAmplitude; break;

            case "Frequency":
                e.Value = this.mFrequency;
                break;

            case "Function":
                e.Value = this.basicMathFunction; break;
            }
        }
Example #20
0
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "StartValue":
                e.Value = this.startValue; break;

            case "EndValue":
                e.Value = this.endValue;
                break;

            case "ArraySize":
                e.Value = this.arraySize; break;
            }
        }
Example #21
0
        /* Allows the propertygrid to set new values */
        protected virtual void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Labels": e.Value = this.localLabels; break;

            case "Variables": e.Value = this.localVariables; break;

            case "Name": e.Value = this.name; break;

            case "arcType": e.Value = this.XmlArcType; break;

            case "directed": e.Value = this.directed; break;

            case "doubly directed": e.Value = this.doublyDirected; break;
            }
        }
Example #22
0
        /// <summary>
        /// Gets the values of the propertygrid properties
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);

            switch (e.Property.Name)
            {
            case "Amplitude": e.Value = this.amplitude; break;

            case "DataType": e.Value = (AutomataDataType)this.outDataType; break;

            case "Positive": e.Value = this.positive; break;

            case "GrayScale": e.Value = this.grayScale; break;

            case "ArraySize": e.Value = this.arraySize; break;
            }
        }
Example #23
0
 protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
 {
     base.GetPropertyBagValue(sender, e);
     switch (e.Property.Name)
     {
     case "LinkedLayer":
         if (LinkedLayer == null)
         {
             e.Value = Site.Abstract.DefaultLayer;
         }
         else
         {
             e.Value = this.LinkedLayer;
         }
         break;
     }
 }
Example #24
0
        /* Allows the propertygrid to set new values. */
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Labels": this.localLabels = (List <string>)e.Value; break;

            case "Variables": this.localVariables = (List <double>)e.Value; break;

            case "Name": this.name = (string)e.Value; break;

            case "nodeType": this.XmlNodeType = (string)e.Value; break;

            case "contains all local labels": this.containsAllLocalLabels = (Boolean)e.Value; break;

            case "strict degree match": this.strictDegreeMatch = (Boolean)e.Value; break;
            }
        }
Example #25
0
        /* Allows the propertygrid to set new values */
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Labels": e.Value = this.localLabels; break;

            case "Variables": e.Value = this.localVariables; break;

            case "Name": e.Value = this.name; break;

            case "nodeType": e.Value = this.XmlNodeType; break;

            case "contains all local labels": e.Value = this.containsAllLocalLabels; break;

            case "strict degree match": e.Value = this.strictDegreeMatch; break;
            }
        }
Example #26
0
        /// <summary>
        /// Interface for setting the assembler's settings
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bagAssembler_SetValue(object sender, PropertySpecEventArgs e)
        {
            switch (e.Property.Name)
            {
            case "Optimize Code":
                theSettings.Assembler.bOptimaizeCode = (bool)e.Value;
                break;

            case "Save LST file after compile":
                theSettings.Assembler.bSaveLSTFileAfterCompile = (bool)e.Value;
                break;

            default:
                throw new PanicException();
            }
            ;
        }
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "XMin":
                e.Value = this.XMin; break;

            case "XMax":
                e.Value = this.XMax; break;

            case "YMin":
                e.Value = this.YMin; break;

            case "YMax":
                e.Value = this.YMax; break;
            }
        }
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "ShiftValue":
                this.shiftValue = (float)e.Value; break;

            case "ScalingValue":

                this.scalingValue = (float)e.Value;

                break;

            case "OutputType":
                this.outputType = (AutomataDataType)e.Value; break;
            }
        }
Example #29
0
        /// <summary>
        /// Allows the propertygrid to access/set the properties of this shape
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "Alignment":
                this.stringAlignment = (StringAlignment)e.Value; this.Invalidate(); break;

            case "ShowPage":
                this.ShowPage = (bool)e.Value; this.Invalidate(); break;

            case "Font":
                this.Font = (Font)e.Value; this.Invalidate(); break;

            case "TextColor":
                this.TextColor = (Color)e.Value; this.Invalidate(); break;
            }
        }
Example #30
0
        protected override void GetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.GetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "PlotColor":
                e.Value = this.plotColor; break;

            case "PlotWindowWidth":
                e.Value = this.plotWindowWidth; break;

            case "PlotWindowHeight":
                e.Value = this.plotWindowHeight; break;

            case "ScalingFactor":
                e.Value = this.scalingFactor; break;
            }
        }
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "XMin":
                this.XMin = (int)e.Value; break;

            case "XMax":
                this.XMax = (int)e.Value; break;

            case "YMin":
                this.YMin = (int)e.Value; break;

            case "YMax":
                this.yMax = (int)e.Value; break;
            }
        }
Example #32
0
        protected override void SetPropertyBagValue(object sender, PropertySpecEventArgs e)
        {
            base.SetPropertyBagValue(sender, e);
            switch (e.Property.Name)
            {
            case "PlotColor":
                this.PlotColor = (Color)e.Value; break;

            case "PlotWindowWidth":
                this.PlotWindowWidth = (int)e.Value; break;

            case "PlotWindowHeight":
                this.PlotWindowHeight = (int)e.Value; break;

            case "ScalingFactor":
                this.ScalingFactor = (float)e.Value; break;
            }
        }
Example #33
0
        protected override void OnSetValue(PropertySpecEventArgs e)
        {
            base.OnSetValue(e);

            propertyObject.GetType().GetProperty(e.Property.Name).SetValue(propertyObject,e.Value,null);
        }
        protected void ctrlSlider_Scroll(object sender, System.EventArgs e)
        {
            try
            {
                if(m_PropertySpec != null)
                {
                    double dblVal = CalculateValueFromSlider();

                    PropertySpecEventArgs args = new PropertySpecEventArgs(m_PropertySpec, Convert.ChangeType(dblVal, Type.GetType(m_PropertySpec.TypeName)));
                    OnSetValue(args);
                    txtValue.Text = dblVal.ToString();

                    m_dblCurrentValue = dblVal;
                }
            }
            catch(System.Exception ex)
            {
                string strVal = ex.Message; //Freaking error CS0168
                //System.Windows.Forms.MessageBox.Show(this, ex.Message, "Slider Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
            catch
            {}
        }
        protected void ctrlValue_Changed(object sender, System.EventArgs e)
        {
            try
            {
                if(txtValue.Text.Trim().Length == 0)
                    throw new System.Exception("Invalid property value for '" + this.PropertyName + "', you must specify a value.");

                if(m_PropertySpec != null)
                {
                    double dblVal = Convert.ToDouble(txtValue.Text);

                    PropertySpecEventArgs args = new PropertySpecEventArgs(m_PropertySpec, Convert.ChangeType(dblVal, Type.GetType(m_PropertySpec.TypeName)));
                    OnSetValue(args);
                    SetSliderValue(dblVal);

                    m_dblCurrentValue = dblVal;
                }
            }
            catch(System.Exception ex)
            {
                //System.Windows.Forms.MessageBox.Show(this, ex.Message, "Slider Error", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                string strVal = ex.Message; //Freaking error CS0168

                //Lets reset the value back to the one in the slider.
                txtValue.Text = m_dblCurrentValue.ToString();
            }
            catch
            {}
        }
 /// <summary>
 /// Raises the SetValue event.
 /// </summary>
 /// <param name="e">A PropertySpecEventArgs that contains the event data.</param>
 protected virtual void OnSetValue(PropertySpecEventArgs e)
 {
     if(SetValue != null)
         SetValue(this, e);
 }
        public void GetValues()
        {
            if(m_PropertySpec != null)
            {
                PropertySpecEventArgs args = new PropertySpecEventArgs(m_PropertySpec, 0);
                OnGetValue(args);

                double dblValue = Convert.ToDouble(args.Value);
                SetSliderValue(dblValue);
            }
        }
        protected void OnGetPropValue(object sender, PropertySpecEventArgs e)
        {
            try
            {
                int iIndex = int.Parse(e.Property.PropertyName);

                VortexAnimatTools.DataObjects.Physical.RigidBodies.MuscleAttachment doAttach = (VortexAnimatTools.DataObjects.Physical.RigidBodies.MuscleAttachment) List[iIndex];
                e.Value = doAttach.Name;
            }
            catch(Exception ex)
            {}
        }