public override bool CanResetValue(object component)
 {
     return(MainName.CanResetValue(component));
 }
Example #2
0
 public override bool CanResetValue(object component)
 {
     return(_propDesc.CanResetValue(component));
 }
 public override bool CanResetValue(object component)
 {
     return(subProperty.CanResetValue(parentProperty.GetValue(component)));
 }
 public override bool CanResetValue(object component)
 {
     return(parent.CanResetValue(component));
 }
 public override bool CanResetValue(object component)
 {
     return(_descriptor.CanResetValue(component));
 }
 public override bool CanResetValue(object component)
 {
     return(m_basePropertyDescriptor.CanResetValue(component));
 }
Example #7
0
 public override bool CanResetValue(object component)
 {
     return(baseDescriptor.CanResetValue(GetWrappedComponent(component)));
 }
            public void SetValue(IDesignerSerializationManager manager, string resourceName, object value, bool forceInvariant, bool shouldSerializeInvariant, bool ensureInvariant, bool applyingCachedResources)
            {
                if ((value == null) || value.GetType().IsSerializable)
                {
                    if (forceInvariant)
                    {
                        if (this.ReadCulture.Equals(CultureInfo.InvariantCulture))
                        {
                            if (shouldSerializeInvariant)
                            {
                                this.Writer.AddResource(resourceName, value);
                            }
                        }
                        else
                        {
                            Hashtable resourceSet = this.GetResourceSet(CultureInfo.InvariantCulture);
                            if (shouldSerializeInvariant)
                            {
                                resourceSet[resourceName] = value;
                            }
                            else
                            {
                                resourceSet.Remove(resourceName);
                            }
                            this.invariantCultureResourcesDirty = true;
                        }
                    }
                    else
                    {
                        switch (this.CompareWithParentValue(resourceName, value))
                        {
                        case CompareValue.Different:
                            this.Writer.AddResource(resourceName, value);
                            break;

                        case CompareValue.New:
                            if (!ensureInvariant)
                            {
                                bool flag  = true;
                                bool flag2 = false;
                                PropertyDescriptor descriptor = (PropertyDescriptor)manager.Context[typeof(PropertyDescriptor)];
                                if (descriptor != null)
                                {
                                    ExpressionContext context = (ExpressionContext)manager.Context[typeof(ExpressionContext)];
                                    if ((context != null) && (context.Expression is CodePropertyReferenceExpression))
                                    {
                                        flag  = descriptor.ShouldSerializeValue(context.Owner);
                                        flag2 = !descriptor.CanResetValue(context.Owner);
                                    }
                                }
                                if (flag)
                                {
                                    this.Writer.AddResource(resourceName, value);
                                    if (flag2)
                                    {
                                        this.GetResourceSet(CultureInfo.InvariantCulture)[resourceName] = value;
                                        this.invariantCultureResourcesDirty = true;
                                    }
                                }
                                break;
                            }
                            this.GetResourceSet(CultureInfo.InvariantCulture)[resourceName] = value;
                            this.invariantCultureResourcesDirty = true;
                            this.Writer.AddResource(resourceName, value);
                            break;
                        }
                    }
                    if (!applyingCachedResources)
                    {
                        this.AddCacheEntry(manager, resourceName, value, false, forceInvariant, shouldSerializeInvariant, ensureInvariant);
                    }
                }
            }
 public override bool CanResetValue(object component)
 {
     return(descriptor.CanResetValue(extender));
 }
 public override bool CanResetValue(object ignored)
 {
     return(_property.CanResetValue(_component));
 }
Example #11
0
        public void ImageListComponentModelTest()
        {
            PropertyDescriptor colordepth_prop       = TypeDescriptor.GetProperties(typeof(ImageList))["ColorDepth"];
            PropertyDescriptor imagesize_prop        = TypeDescriptor.GetProperties(typeof(ImageList))["ImageSize"];
            PropertyDescriptor transparentcolor_prop = TypeDescriptor.GetProperties(typeof(ImageList))["TransparentColor"];

            // create a blank ImageList
            ImageList il = new ImageList();

            // test its defaults
#if NET_2_0
            Assert.IsTrue(colordepth_prop.ShouldSerializeValue(il), "1");
            Assert.IsTrue(colordepth_prop.CanResetValue(il), "2");
            Assert.IsTrue(imagesize_prop.ShouldSerializeValue(il), "3");
            Assert.IsTrue(imagesize_prop.CanResetValue(il), "4");
            Assert.IsTrue(transparentcolor_prop.ShouldSerializeValue(il), "5");
            Assert.IsTrue(transparentcolor_prop.CanResetValue(il), "6");

            // test what happens when we set the transparent color to LightGray
            il.TransparentColor = Color.LightGray;
            Assert.IsFalse(transparentcolor_prop.ShouldSerializeValue(il), "7");
            Assert.IsFalse(transparentcolor_prop.CanResetValue(il), "8");

            // test what happens when we set the depth to something other than the default
            il.ColorDepth = ColorDepth.Depth16Bit;
            Assert.IsTrue(colordepth_prop.ShouldSerializeValue(il), "9");
            Assert.IsTrue(colordepth_prop.CanResetValue(il), "10");
            // same test for ImageSize
            il.ImageSize = new Size(32, 32);
            Assert.IsTrue(imagesize_prop.ShouldSerializeValue(il), "11");
            Assert.IsTrue(imagesize_prop.CanResetValue(il), "12");

            // create an ImageList containing an image
            il = new ImageList();
            il.Images.Add(Image.FromFile("M.gif"));

            Assert.IsFalse(colordepth_prop.ShouldSerializeValue(il), "13");
            Assert.IsFalse(colordepth_prop.CanResetValue(il), "14");
            Assert.IsFalse(imagesize_prop.ShouldSerializeValue(il), "15");
            Assert.IsFalse(imagesize_prop.CanResetValue(il), "16");
            Assert.IsTrue(transparentcolor_prop.ShouldSerializeValue(il), "17");
            Assert.IsTrue(transparentcolor_prop.CanResetValue(il), "18");

            // test what happens when we set the transparent color to LightGray
            il.TransparentColor = Color.LightGray;
            Assert.IsFalse(transparentcolor_prop.ShouldSerializeValue(il), "19");
            Assert.IsFalse(transparentcolor_prop.CanResetValue(il), "20");

            // test what happens when we set the depth to something other than the default
            il.ColorDepth = ColorDepth.Depth16Bit;
            Assert.IsFalse(colordepth_prop.ShouldSerializeValue(il), "21");
            Assert.IsFalse(colordepth_prop.CanResetValue(il), "22");

            // same test for ImageSize
            il.ImageSize = new Size(32, 32);
            Assert.IsFalse(imagesize_prop.ShouldSerializeValue(il), "23");
            Assert.IsFalse(imagesize_prop.CanResetValue(il), "24");
#else
            Assert.IsFalse(colordepth_prop.ShouldSerializeValue(il), "1");
            Assert.IsFalse(colordepth_prop.CanResetValue(il), "2");
            Assert.IsFalse(imagesize_prop.ShouldSerializeValue(il), "3");
            Assert.IsFalse(imagesize_prop.CanResetValue(il), "4");
            Assert.IsTrue(transparentcolor_prop.ShouldSerializeValue(il), "5");
            Assert.IsFalse(transparentcolor_prop.CanResetValue(il), "6");

            // test what happens when we set the transparent color to LightGray
            il.TransparentColor = Color.LightGray;
            Assert.IsFalse(transparentcolor_prop.ShouldSerializeValue(il), "7");
            Assert.IsFalse(transparentcolor_prop.CanResetValue(il), "8");

            // test what happens when we set the depth to something other than the default
            il.ColorDepth = ColorDepth.Depth16Bit;
            Assert.IsTrue(colordepth_prop.ShouldSerializeValue(il), "9");
            Assert.IsTrue(colordepth_prop.CanResetValue(il), "10");

            // same test for ImageSize
            il.ImageSize = new Size(32, 32);
            Assert.IsTrue(imagesize_prop.ShouldSerializeValue(il), "11");
            Assert.IsFalse(imagesize_prop.CanResetValue(il), "12");

            // create an ImageList containing an image
            il = new ImageList();
            il.Images.Add(Image.FromFile("M.gif"));

            Assert.IsFalse(colordepth_prop.ShouldSerializeValue(il), "13");
            Assert.IsFalse(colordepth_prop.CanResetValue(il), "14");
            Assert.IsFalse(imagesize_prop.ShouldSerializeValue(il), "15");
            Assert.IsFalse(imagesize_prop.CanResetValue(il), "16");
            Assert.IsTrue(transparentcolor_prop.ShouldSerializeValue(il), "17");
            Assert.IsFalse(transparentcolor_prop.CanResetValue(il), "18");

            // test what happens when we set the transparent color to LightGray
            il.TransparentColor = Color.LightGray;
            Assert.IsFalse(transparentcolor_prop.ShouldSerializeValue(il), "19");
            Assert.IsFalse(transparentcolor_prop.CanResetValue(il), "20");

            // test what happens when we set the depth to something other than the default
            il.ColorDepth = ColorDepth.Depth16Bit;
            Assert.IsTrue(colordepth_prop.ShouldSerializeValue(il), "21");
            Assert.IsTrue(colordepth_prop.CanResetValue(il), "22");

            // same test for ImageSize
            il.ImageSize = new Size(32, 32);
            Assert.IsTrue(imagesize_prop.ShouldSerializeValue(il), "23");
            Assert.IsFalse(imagesize_prop.CanResetValue(il), "24");
#endif
        }
Example #12
0
 public void CanResetValue_ReturnsFalse()
 {
     Assert.IsFalse(_descriptor.CanResetValue(_vm));
 }
Example #13
0
 public override bool CanResetValue(object component)
 {
     return(property.CanResetValue(extender));
 }
Example #14
0
 public override bool CanResetValue(object component)
 {
     return(_originalDescriptor != null && _originalDescriptor.CanResetValue(component));
 }
 protected override bool ComputeCanResetValue()
 {
     return(PropertyDescriptor.CanResetValue(SelectedObject) &&
            !PropertyDescriptor.IsReadOnly);
 }
Example #16
0
        public override bool CanResetValue(object component)
        {
            object parentValue = Parent.GetValue(component);

            return(parentValue != null && Child.CanResetValue(parentValue));
        }
 public override bool CanResetValue(object component)
 {
     return(innerProp.CanResetValue(GetRowView(component)));
 }
Example #18
0
 public override bool CanResetValue(object component)
 {
     return(property.CanResetValue(CorrectExtender(component)));
 }
 public override bool CanResetValue(object component)
 {
     return(Property.CanResetValue(component));
 }
Example #20
0
 public override bool CanResetValue(object component) => _basePropertyDescriptor.CanResetValue(component);
 public override bool CanResetValue(object component)
 {
     return(_originalPropertyDescriptor.CanResetValue(_originalComponent));
 }
Example #22
0
 public override bool CanResetValue(object component)
 {
     return(pd.CanResetValue(((Node)component).Drv));
 }
Example #23
0
 public override bool CanResetValue(object component)
 {
     return(myInnerDescriptor.CanResetValue(myInnerElement));
 }
 public override bool CanResetValue(object component) => _descriptor.CanResetValue(component);
Example #25
0
 public override bool CanResetValue(object o)
 {
     return(descriptor.CanResetValue(o));
 }
Example #26
0
            public override bool CanResetValue(object component)
            {
                bool canResetValue = descriptor.CanResetValue(component);

                return(canResetValue);
            }
Example #27
0
 public override bool CanResetValue(object component)
 {
     return(_originalPropertyDescriptor.CanResetValue(ExtractAvailableGameViewModel(component)));
 }
Example #28
0
 override public bool CanResetValue(object obj)
 {
     return(_pd.CanResetValue(obj));
 }
Example #29
0
 public override bool CanResetValue(object component)
 {
     return(_property.CanResetValue(_target));
 }
Example #30
0
 override public bool CanResetValue(object component)
 {
     return(_pd.CanResetValue(component));
 }