Example #1
0
        public bool GetBoolean(BooleanProperty prop)
        {
            if (!Enum.IsDefined(typeof(BooleanProperty), prop))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("prop", (int)prop, typeof(BooleanProperty));
            }

            bool result;

            last_hresult = VisualStyles.UxThemeGetThemeBool(theme, this.part, this.state, prop, out result);
            return(result);
        }
Example #2
0
        /// <summary>
        ///  [See win32 equivalent.]
        /// </summary>
        public bool GetBoolean(BooleanProperty prop)
        {
            if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)BooleanProperty.Transparent, (int)BooleanProperty.SourceShrink))
            {
                throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(BooleanProperty));
            }

            bool val = false;

            lastHResult = SafeNativeMethods.GetThemeBool(new HandleRef(this, Handle), part, state, (int)prop, ref val);
            return(val);
        }
Example #3
0
        /// <summary>
        ///  [See win32 equivalent.]
        /// </summary>
        public bool GetBoolean(BooleanProperty prop)
        {
            if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)BooleanProperty.Transparent, (int)BooleanProperty.SourceShrink))
            {
                throw new InvalidEnumArgumentException(nameof(prop), (int)prop, typeof(BooleanProperty));
            }

            BOOL val = BOOL.FALSE;

            _lastHResult = GetThemeBool(this, Part, State, (int)prop, ref val);
            return(val.IsTrue());
        }
Example #4
0
        public void GetDefaultValue_NullableArray()
        {
            IBusinessObjectBooleanProperty property = new BooleanProperty(
                CreateParameters(
                    _businessObjectProvider,
                    GetPropertyInfo(typeof(ClassWithValueType <bool>), "NullableArray"),
                    typeof(bool),
                    typeof(bool),
                    new ListInfo(typeof(bool?[]), typeof(bool?)),
                    false,
                    false));

            Assert.That(property.GetDefaultValue(_businessObjectClass), Is.Null);
        }
        private void OnAppClicked()
        {
            hasAccountProperty  = (BooleanProperty)PlayerPropertyManager.Instance.GetProperty("Heeft Bankrekening");
            appointmentProperty = PlayerPropertyManager.Instance.GetProperty <BankAppointmentProperty>("BankAfspraak");

            if (appointmentProperty.Value.ToString().Equals("CreateAccount"))
            {
                appointmentDisplay.GetComponent <RectTransform>().sizeDelta        = new Vector2();
                appointmentDisplay.GetComponent <RectTransform>().anchoredPosition = new Vector2();
                magnifierGameObjectZoom.SetActive(true);
                MainCanvasManager.Instance.OpenCellPhoneScreen(CellPhoneScreen.BankAppointmentSet);
            }
            else
            {
                MainCanvasManager.Instance.OpenCellPhoneScreen(hasAccountProperty.Value ? CellPhoneScreen.BankAccount : CellPhoneScreen.BankAppointment);
            }
        }
Example #6
0
        protected override void Initialize()
        {
            AccountNumberProperty             = new TextProperty(this, AccountNumber);
            AccountNumberProperty.Size        = 15;
            CommentProperty                   = new TextProperty(this, Comment);
            CommentProperty.Size              = 128;
            ModifiedDateProperty              = new DateTimeProperty(this, ModifiedDate);
            ModifiedDateProperty.Required     = true;
            ModifiedDateProperty.Editable     = false;
            OnlineOrderFlagProperty           = new BooleanProperty(this, OnlineOrderFlag);
            OnlineOrderFlagProperty.Required  = true;
            OrderDateProperty                 = new DateProperty(this, OrderDate);
            OrderDateProperty.Required        = true;
            OrderDateProperty.Editable        = false;
            PurchaseOrderNumberProperty       = new TextProperty(this, PurchaseOrderNumber);
            PurchaseOrderNumberProperty.Size  = 25;
            RevisionNumberProperty            = new TinyIntegerProperty(this, RevisionNumber);
            RevisionNumberProperty.Required   = true;
            RevisionNumberProperty.Editable   = false;
            SalesOrderIdProperty              = new IntegerKeyProperty(this, SalesOrderId);
            SalesOrderIdProperty.Required     = true;
            SalesOrderIdProperty.Editable     = false;
            SalesOrderNumberProperty          = new TextProperty(this, SalesOrderNumber);
            SalesOrderNumberProperty.Required = true;
            SalesOrderNumberProperty.Size     = 25;
            SalesOrderNumberProperty.Editable = false;
            ShipDateProperty                  = new DateProperty(this, ShipDate);
            StatusProperty          = new EnumByteProperty(this, Status);
            StatusProperty.Required = true;
            StatusProperty.Size     = 10;
            StatusProperty.EnumType = "sales order status";
            DataObject objCustomer = new SalesOrderCustomerObjectCustomized();

            AddChildObject(Customer, objCustomer);
            DataObject objDetail = new SalesOrderDetailList();

            AddChildObject(Detail, objDetail);
            DataObject objPayment = new SalesOrderPaymentObject();

            AddChildObject(Payment, objPayment);
            DataObject objSales = new SalesOrderSalesObjectCustomized();

            AddChildObject(Sales, objSales);
        }
Example #7
0
        /// <summary>
        /// Eval any boolean property
        /// </summary>
        /// <param name="properties">The set of properties</param>
        /// <returns>true if there is no property or if a property is evaluated to true, fals eotherwise.</returns>
        public bool EvalBooleanProperty(Dictionary <string, object> properties)
        {
            if (BooleanProperty == null)
            {
                return(true);
            }
            if (properties == null)
            {
                return(false);
            }
            string[] items = BooleanProperty.Split(new char[] { '.' });
            if (items.Length != 2)
            {
                return(false);
            }
            string key       = items[0];
            string prop_name = items[1];
            object value;

            if (!properties.TryGetValue(key, out value))
            {
                return(false);
            }
            System.Type type = value.GetType();
            try
            {
                var prop = type.GetProperty(prop_name);
                if (prop == null)
                {
                    return(false);
                }
                if (prop.PropertyType != typeof(bool))
                {
                    return(false);//We expect a Boolean type
                }
                return((System.Boolean)prop.GetValue(value));
            }
            catch (System.Exception)
            {
                return(false);
            }
        }
Example #8
0
        private GeoVectorHotSpot dirWidthHotSpot, dirHeightHotSpot; // Hotspot für Richtung

        public ShowPropertyPicture(Picture picture, IFrame Frame) : base(Frame)
        {
            this.picture        = picture;
            attributeProperties = picture.GetAttributeProperties(Frame);
            base.resourceId     = "Picture.Object";

            location = new GeoPointProperty("Picture.Location", Frame, true);
            location.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetRefPoint);
            location.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetRefPoint);
            location.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyLocationWithMouse);
            width = new LengthProperty("Picture.Width", Frame, true);
            width.GetLengthEvent += new LengthProperty.GetLengthDelegate(OnGetWidth);
            width.SetLengthEvent += new LengthProperty.SetLengthDelegate(OnSetWidth);
            height = new LengthProperty("Picture.Height", Frame, true);
            height.GetLengthEvent += new LengthProperty.GetLengthDelegate(OnGetHeight);
            height.SetLengthEvent += new LengthProperty.SetLengthDelegate(OnSetHeight);
            dirWidth = new GeoVectorProperty("Picture.DirWidth", Frame, true);
            dirWidth.GetGeoVectorEvent    += new GeoVectorProperty.GetGeoVectorDelegate(OnGetDirWidth);
            dirWidth.SetGeoVectorEvent    += new GeoVectorProperty.SetGeoVectorDelegate(OnSetDirWidth);
            dirWidth.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyDirWidthWithMouse);
            dirHeight = new GeoVectorProperty("Picture.DirHeight", Frame, true);
            dirHeight.GetGeoVectorEvent    += new GeoVectorProperty.GetGeoVectorDelegate(OnGetDirHeight);
            dirHeight.SetGeoVectorEvent    += new GeoVectorProperty.SetGeoVectorDelegate(OnSetDirHeight);
            dirHeight.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyDirHeightWithMouse);
            path = new StringProperty(picture.Path, "Picture.Path");
            path.GetStringEvent += new StringProperty.GetStringDelegate(OnGetPath);
            path.SetStringEvent += new StringProperty.SetStringDelegate(OnSetPath);
            path.SetContextMenu("MenuId.Picture.Path", this);
            keepAspectRatio = new BooleanProperty("Picture.KeepAspectRatio", "YesNo.Values");
            double p = picture.DirectionWidth.Length / picture.Bitmap.Width * picture.Bitmap.Height / picture.DirectionHeight.Length;

            keepAspectRatio.BooleanValue         = Math.Abs(1.0 - p) < 1e-6;
            keepAspectRatio.BooleanChangedEvent += new BooleanChangedDelegate(OnKeepAspectRatioChanged);
            rectangular = new BooleanProperty("Picture.Rectangular", "YesNo.Values");
            rectangular.BooleanValue         = Precision.IsPerpendicular(picture.DirectionWidth, picture.DirectionHeight, false);
            rectangular.BooleanChangedEvent += new BooleanChangedDelegate(OnRectangularChanged);
            dirWidthHotSpot           = new GeoVectorHotSpot(dirWidth);
            dirWidthHotSpot.Position  = picture.Location + picture.DirectionWidth;
            dirHeightHotSpot          = new GeoVectorHotSpot(dirHeight);
            dirHeightHotSpot.Position = picture.Location + picture.DirectionHeight;
        }
Example #9
0
        /// <summary>
        /// Indicates whether to skip analyzis on the given document.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <returns>Returns true to skip analysis on the document.</returns>
        public override bool SkipAnalysisForDocument(ICodeDocument document)
        {
            Param.RequireNotNull(document, "document");

            // Get the property indicating whether to analyze designer files.
            BooleanProperty analyzeDesignerFilesProperty = this.GetSetting(
                document.Settings, CsParser.AnalyzeDesignerFilesProperty) as BooleanProperty;

            // Default the setting to true if it does not exist.
            bool analyzeDesignerFiles = true;

            if (analyzeDesignerFilesProperty != null)
            {
                analyzeDesignerFiles = analyzeDesignerFilesProperty.Value;
            }

            if (analyzeDesignerFiles || !document.SourceCode.Name.EndsWith(".Designer.cs", StringComparison.OrdinalIgnoreCase))
            {
                // Get the property indicating whether to analyze generated files.
                BooleanProperty analyzerGeneratedFilesProperty = this.GetSetting(
                    document.Settings, CsParser.AnalyzeGeneratedFilesProperty) as BooleanProperty;

                // Default the setting to false if it does not exist.
                bool analyzeGeneratedFiles = false;
                if (analyzerGeneratedFilesProperty != null)
                {
                    analyzeGeneratedFiles = analyzerGeneratedFilesProperty.Value;
                }

                if (analyzeGeneratedFiles ||
                    (!document.SourceCode.Name.EndsWith(".g.cs", StringComparison.OrdinalIgnoreCase) &&
                     !document.SourceCode.Name.EndsWith(".generated.cs", StringComparison.OrdinalIgnoreCase)))
                {
                    // This document should be analyzed.
                    return(false);
                }
            }

            return(true);
        }
Example #10
0
        public void TestMethod1()
        {
            BooleanProperty <int> bp = new BooleanProperty <int>();

            Assert.AreEqual(false, bp.Get(1));

            bp.Set(1, true);
            Assert.AreEqual(true, bp.Get(1));

            bp.Set(1, false);
            Assert.AreEqual(false, bp.Get(1));
            bp.Set(1, true);
            Assert.AreEqual(true, bp.Get(1));

            bp.Set(1, false);
            Assert.AreEqual(false, bp.Get(1));
            bp.Set(1, true);
            Assert.AreEqual(true, bp.Get(1));

            bp.Set(1, false);
            Assert.AreEqual(false, bp.Get(1));
        }
Example #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DocumentationRulesConfiguration"/> class.
        /// </summary>
        /// <param name="file">
        /// The file to get the configuration for.
        /// </param>
        public DocumentationRulesConfiguration(IPsiSourceFile file)
        {
            this.settings = new StyleCopSettings(StyleCopCoreFactory.Create()).GetSettings(file.ToProjectFile());

            // Default for this property is false
            BooleanProperty property = this.GetStyleCopRuleProperty <BooleanProperty>("IgnorePrivates");

            this.IgnorePrivates = property == null ? false : property.Value;

            // Default for this property is true
            property           = this.GetStyleCopRuleProperty <BooleanProperty>("IncludeFields");
            this.RequireFields = property == null ? true : property.Value;

            // Default for this property is false
            property             = this.GetStyleCopRuleProperty <BooleanProperty>("IgnoreInternals");
            this.IgnoreInternals = property == null ? false : property.Value;

            StringProperty stringProperty = this.GetStyleCopRuleProperty <StringProperty>("CompanyName");

            this.CompanyName = stringProperty != null ? stringProperty.Value : string.Empty;

            stringProperty = this.GetStyleCopRuleProperty <StringProperty>("Copyright");
            this.Copyright = stringProperty != null ? stringProperty.Value : string.Empty;
        }
Example #12
0
        /// <summary>
        /// Determines whether a property is enabled in StyleCop settings.
        /// Default to true if property isn't defined in StyleCop settings.
        /// </summary>
        /// <param name="propertyName">
        /// The property.
        /// </param>
        /// <returns>
        /// <c>true</c> if the property is enabled; otherwise, <c>false</c>.
        /// </returns>
        protected bool IsPropertyEnabled(string propertyName)
        {
            if (this.analyzerSettingsProperties == null)
            {
                return(true);
            }

            BooleanProperty property = this.analyzerSettingsProperties[propertyName + "#Enabled"] as BooleanProperty;

            if (property != null)
            {
                return(property.Value);
            }

            PropertyDescriptor <bool> defaultPropertyDecriptor =
                this.analyzerSettingsProperties.AddIn.PropertyDescriptors[propertyName + "#Enabled"] as PropertyDescriptor <bool>;

            if (defaultPropertyDecriptor != null)
            {
                return(defaultPropertyDecriptor.DefaultValue);
            }

            return(true);
        }
        /// <summary>
        /// Gets whether the stylecop rule specified is enabled.
        /// </summary>
        /// <param name="ruleId">
        /// The Rule.Id, this is its qualified name.
        /// </param>
        /// <returns>
        /// True if the rule is enabled in the Settings.StyleCop file otherwise false.
        /// </returns>
        public bool GetStyleCopRuleEnabled(string ruleId)
        {
            bool returnValue = false;

            if (this.settings != null)
            {
                ICollection <AddInPropertyCollection> analyzerSettings = this.settings.AnalyzerSettings;
                foreach (AddInPropertyCollection addInPropertyCollection in analyzerSettings)
                {
                    if (addInPropertyCollection.AddIn.Id == AnalyzerName)
                    {
                        BooleanProperty property = addInPropertyCollection[ruleId + "#Enabled"] as BooleanProperty;

                        if (property != null)
                        {
                            returnValue = property.Value;
                            break;
                        }
                    }
                }
            }

            return(returnValue);
        }
 protected override void Initialize()
 {
     AccountNumberProperty = new TextProperty(this, AccountNumber);
     AccountNumberProperty.Size = 15;
     CommentProperty = new TextProperty(this, Comment);
     CommentProperty.Size = 128;
     ModifiedDateProperty = new DateTimeProperty(this, ModifiedDate);
     ModifiedDateProperty.Required = true;
     ModifiedDateProperty.Editable = false;
     OnlineOrderFlagProperty = new BooleanProperty(this, OnlineOrderFlag);
     OnlineOrderFlagProperty.Required = true;
     OrderDateProperty = new DateProperty(this, OrderDate);
     OrderDateProperty.Required = true;
     OrderDateProperty.Editable = false;
     PurchaseOrderNumberProperty = new TextProperty(this, PurchaseOrderNumber);
     PurchaseOrderNumberProperty.Size = 25;
     RevisionNumberProperty = new TinyIntegerProperty(this, RevisionNumber);
     RevisionNumberProperty.Required = true;
     RevisionNumberProperty.Editable = false;
     SalesOrderIdProperty = new IntegerKeyProperty(this, SalesOrderId);
     SalesOrderIdProperty.Required = true;
     SalesOrderIdProperty.Editable = false;
     SalesOrderNumberProperty = new TextProperty(this, SalesOrderNumber);
     SalesOrderNumberProperty.Required = true;
     SalesOrderNumberProperty.Size = 25;
     SalesOrderNumberProperty.Editable = false;
     ShipDateProperty = new DateProperty(this, ShipDate);
     StatusProperty = new EnumByteProperty(this, Status);
     StatusProperty.Required = true;
     StatusProperty.Size = 10;
     StatusProperty.EnumType = "sales order status";
     DataObject objCustomer = new SalesOrderCustomerObjectCustomized();
     AddChildObject(Customer, objCustomer);
     DataObject objDetail = new SalesOrderDetailList();
     AddChildObject(Detail, objDetail);
     DataObject objPayment = new SalesOrderPaymentObject();
     AddChildObject(Payment, objPayment);
     DataObject objSales = new SalesOrderSalesObjectCustomized();
     AddChildObject(Sales, objSales);
 }
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">The tab control object.</param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the cache setting.
            this.writeCachePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor <bool>;

            this.writeCacheParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                            BooleanProperty;

            var mergedWriteCacheProperty = this.tabControl.MergedSettings == null
                                               ? null
                                               : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                           BooleanProperty;

            this.enableCache.Checked = mergedWriteCacheProperty == null ? this.writeCachePropertyDescriptor.DefaultValue : mergedWriteCacheProperty.Value;

            this.autoUpdateCheckPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["AutoCheckForUpdate"] as PropertyDescriptor <bool>;

            this.autoUpdateParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as
                                            BooleanProperty;

            var mergedAutoUpdateProperty = this.tabControl.MergedSettings == null
                                               ? null
                                               : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as
                                           BooleanProperty;

            this.autoUpdateCheckBox.Checked = mergedAutoUpdateProperty == null ? this.autoUpdateCheckPropertyDescriptor.DefaultValue : mergedAutoUpdateProperty.Value;

            this.daysToCheckPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["DaysToCheckForUpdates"] as PropertyDescriptor <int>;

            this.daysToCheckParentProperty = this.tabControl.ParentSettings == null
                                                 ? null
                                                 : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                             IntProperty;

            var mergedDaysToCheckProperty = this.tabControl.MergedSettings == null
                                                ? null
                                                : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                            IntProperty;

            this.daysMaskedTextBox.Text = mergedDaysToCheckProperty == null
                                              ? this.daysToCheckPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                              : mergedDaysToCheckProperty.Value.ToString(CultureInfo.InvariantCulture);

            this.maxViolationCountPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["MaxViolationCount"] as PropertyDescriptor <int>;

            this.maxViolationCountParentProperty = this.tabControl.ParentSettings == null
                                                       ? null
                                                       : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                   as IntProperty;

            var mergedMaxViolationCountProperty = this.tabControl.MergedSettings == null
                                                      ? null
                                                      : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                  as IntProperty;

            this.maxViolationCountMaskedTextBox.Text = mergedMaxViolationCountProperty == null
                                                           ? this.maxViolationCountPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                                           : mergedMaxViolationCountProperty.Value.ToString(CultureInfo.InvariantCulture);

            // Culture
            this.culturePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["Culture"] as PropertyDescriptor <string>;

            this.cultureParentProperty = this.tabControl.ParentSettings == null
                                             ? null
                                             : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            var mergedCultureProperty = this.tabControl.MergedSettings == null
                                            ? null
                                            : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            this.cultureComboBox.SelectedIndex =
                this.cultureComboBox.FindStringExact(
                    mergedCultureProperty == null
                        ? this.culturePropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                        : mergedCultureProperty.Value.ToString(CultureInfo.InvariantCulture));

            this.SetBoldState();

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
Example #16
0
this.SetValue(BooleanProperty, value);
Example #17
0
        /// <summary>
        /// Sets the bold state of the given rule item based on it current status.
        /// </summary>
        /// <param name="ruleNode">
        /// The node containing the rule to set.
        /// </param>
        /// <returns>
        /// Returns true if the item is bolded, false otherwise.
        /// </returns>
        private bool DetectBoldStateForRule(TreeNode ruleNode)
        {
            Param.AssertNotNull(ruleNode, "ruleNode");

            // Extract the analyzer from the parent of this rule.
            SourceAnalyzer analyzer = null;
            TreeNode analyzerNode = ruleNode.Parent;
            while (analyzerNode != null)
            {
                analyzer = analyzerNode.Tag as SourceAnalyzer;
                if (analyzer != null)
                {
                    break;
                }

                analyzerNode = analyzerNode.Parent;
            }

            Debug.Assert(analyzer != null, "The rule node does not have a parent analyzer node.");

            Rule rule = ruleNode.Tag as Rule;
            bool overridden = false;

            if (analyzer != null)
            {
                // Create a property representing the current value of the selection.
                string propertyName = rule.Name + "#Enabled";
                BooleanProperty localValue = new BooleanProperty(analyzer, propertyName, ruleNode.Checked);

                // Compare this with the parent value.
                overridden = this.tabControl.SettingsComparer.IsAddInSettingOverwritten(analyzer, propertyName, localValue);
            }

            // Set the bold state depending upon whether the setting is overriden.
            SetBoldState(ruleNode, overridden, this.analyzeTree);

            return overridden;
        }
        /// <summary>
        /// Refreshes the merged override state of properties on the page.
        /// </summary>
        public void RefreshSettingsOverrideState()
        {
            this.writeCacheParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            this.autoUpdateParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            this.daysToCheckParentProperty = this.tabControl.ParentSettings == null
                                                 ? null
                                                 : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                                   IntProperty;

            this.maxViolationCountParentProperty = this.tabControl.ParentSettings == null
                                                       ? null
                                                       : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                         as IntProperty;

            this.cultureParentProperty = this.tabControl.ParentSettings == null
                                             ? null
                                             : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            this.SetBoldState();
        }
    /// <summary>
    /// Initializes the options panel values just before the panel is shown to user for the first time.
    /// </summary>
    /// <returns>The options panel widget.</returns>
    /// <remarks>Will only be called if the user really gets to see the options panel.</remarks>
    public override Control CreatePanelWidget()
    {
      // Get the write cache setting.
      this.writeCachePropertyDescriptor = this.SettingsHandler.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor<bool>;

      this.writeCacheParentProperty = this.SettingsHandler.ParentSettings == null
                                        ? null
                                        : this.SettingsHandler.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                          BooleanProperty;

      BooleanProperty mergedWriteCacheProperty = this.SettingsHandler.MergedSettings == null
                                                  ? null
                                                  : this.SettingsHandler.MergedSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                    BooleanProperty;

      this.enableCacheCheckBox.Active = mergedWriteCacheProperty == null ? this.writeCachePropertyDescriptor.DefaultValue : mergedWriteCacheProperty.Value;

      // Errors As Warnings
      this.violationsAsErrorsPropertyDescriptor = this.SettingsHandler.Core.PropertyDescriptors["ViolationsAsErrors"] as PropertyDescriptor<bool>;

      this.violationsAsErrorsParentProperty = this.SettingsHandler.ParentSettings == null
                                          ? null
                                          : this.SettingsHandler.ParentSettings.GlobalSettings.GetProperty(this.violationsAsErrorsPropertyDescriptor.PropertyName) as
                                            BooleanProperty;

      BooleanProperty mergedViolationsAsErrorsProperty = this.SettingsHandler.MergedSettings == null
                                                          ? null
                                                          : this.SettingsHandler.MergedSettings.GlobalSettings.GetProperty(
                                                           this.violationsAsErrorsPropertyDescriptor.PropertyName) as BooleanProperty;

      this.violationsAsErrorsCheckBox.Active = mergedViolationsAsErrorsProperty == null
                                                    ? this.violationsAsErrorsPropertyDescriptor.DefaultValue
                                                    : mergedViolationsAsErrorsProperty.Value;

      // Get the max violation count setting
      this.maxViolationCountPropertyDescriptor = this.SettingsHandler.Core.PropertyDescriptors["MaxViolationCount"] as PropertyDescriptor<int>;

      this.maxViolationCountParentProperty = this.SettingsHandler.ParentSettings == null
                                              ? null
                                              : this.SettingsHandler.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName) as
                                                IntProperty;

      IntProperty mergedMaxViolationCountProperty = this.SettingsHandler.MergedSettings == null
                                                      ? null
                                                      : this.SettingsHandler.MergedSettings.GlobalSettings.GetProperty(
                                                      this.maxViolationCountPropertyDescriptor.PropertyName) as IntProperty;

      this.maxViolationCountSpinButton.Value = Convert.ToDouble(mergedMaxViolationCountProperty == null
                                                ? this.maxViolationCountPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                                : mergedMaxViolationCountProperty.Value.ToString(CultureInfo.InvariantCulture));

      // Get the culture setting
      this.culturePropertyDescriptor = this.SettingsHandler.Core.PropertyDescriptors["Culture"] as PropertyDescriptor<string>;

      this.cultureParentProperty = this.SettingsHandler.ParentSettings == null
                                    ? null
                                    : this.SettingsHandler.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

      StringProperty mergedCultureProperty = this.SettingsHandler.MergedSettings == null
                                              ? null
                                              : this.SettingsHandler.MergedSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as
                                                StringProperty;

      int cultureComboBoxIndex = this.cultureComboBoxValues.IndexOf(mergedCultureProperty == null
                                  ? this.culturePropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                  : mergedCultureProperty.Value.ToString(CultureInfo.InvariantCulture));
      Gtk.TreeIter cultureIter;
      this.cultureComboBox.Model.IterNthChild(out cultureIter, cultureComboBoxIndex);
      this.cultureComboBox.SetActiveIter(cultureIter);

      return base.CreatePanelWidget();
    }
Example #20
0
 public bool GetBoolean(BooleanProperty prop)
 {
     throw null;
 }
Example #21
0
 public int UxThemeGetThemeBool(IntPtr hTheme, int iPartId, int iStateId, BooleanProperty prop, out bool result) => throw new InvalidOperationException();
		public bool GetBoolean (BooleanProperty prop)
		{
			if (!Enum.IsDefined (typeof (BooleanProperty), prop))
				throw new System.ComponentModel.InvalidEnumArgumentException ("prop", (int)prop, typeof (BooleanProperty));

			bool result;
			last_hresult = VisualStyles.UxThemeGetThemeBool (theme, this.part, this.state, prop, out result);
			return result;
		}
Example #23
0
 public PrivateComputerProperties()
     : base(2)
 {
     this.version         = new IntProperty(this, UnsafeNativeMethods.PROPID_PC_VERSION);
     this.activeDirectory = new BooleanProperty(this, UnsafeNativeMethods.PROPID_PC_DS_ENABLED);
 }
		public PlayerShip(int DefaultWidth, int DefaultHeight)
		{
			this.DefaultWidth = DefaultWidth;
			this.DefaultHeight = DefaultHeight;

			this.GoodEgo = new StarShip { Animations.Spawn_BigGun(0, 0) };

			this.GoodEgoY = DefaultHeight - 20;
			this.EvilEgoY = 60;

			GoodEgo.y = GoodEgoY;

			this.EvilEgo = new StarShip { Animations.Spawn_UFO(0, 0) };

			EvilEgo.y = EvilEgoY;

			this.EvilMode = new BooleanProperty();


			this.GodMode.LinkTo(this.GoodEgo.GodMode);
			this.GodMode.LinkTo(this.EvilEgo.GodMode);









			this.GoodEgo.PositionChanged +=
				delegate
				{
					var EvilModePending = true;

					if (this.GoodEgo.x < DefaultWidth)
						if (this.GoodEgo.x > 0)
						{
							EvilModePending = false;
						}

					if (this.GoodEgo.MoveToTarget.Value.x > DefaultWidth / 2)
						EvilEgo.TeleportTo(this.GoodEgo.x - DefaultWidth, EvilEgoY);
					else
						EvilEgo.TeleportTo(this.GoodEgo.x + DefaultWidth, EvilEgoY);


					EvilMode.Value = EvilModePending;

					if (this.GoodEgo.x > DefaultWidth * 0.5)
					{
						this.GoodEgo.MoveToTarget.Value.x -= DefaultWidth * 2;
						this.GoodEgo.x -= DefaultWidth * 2;
					}

					if (this.GoodEgo.x < -DefaultWidth * 0.5)
					{
						this.GoodEgo.MoveToTarget.Value.x += DefaultWidth * 2;
						this.GoodEgo.x += DefaultWidth * 2;
					}
				};


			GoodEgo.TweenMoveTo(DefaultWidth / 2, GoodEgoY);


			GoodEgo.MaxStep = 12;
			EvilEgo.MaxStep = 12;

		}
Example #25
0
        /// <summary>
        /// Refreshes the merged override state of properties on the page.
        /// </summary>
        public void RefreshSettingsOverrideState()
        {
            this.parentProperty = this.tabControl.ParentSettings == null ?
                null :
                this.tabControl.ParentSettings.GlobalSettings.GetProperty("WriteCache") as BooleanProperty;

            this.SetBoldState();
        }
Example #26
0
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">The tab control object.</param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the cache setting.
            PropertyDescriptor<bool> descriptor = this.tabControl.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor<bool>;

            this.parentProperty = this.tabControl.ParentSettings == null ?
                null :
                this.tabControl.ParentSettings.GlobalSettings.GetProperty(descriptor.PropertyName) as BooleanProperty;

            BooleanProperty mergedProperty = this.tabControl.MergedSettings == null ?
                null :
                this.tabControl.MergedSettings.GlobalSettings.GetProperty(descriptor.PropertyName) as BooleanProperty;

            this.enableCache.Checked = mergedProperty == null ? descriptor.DefaultValue : mergedProperty.Value;

            this.SetBoldState();

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
Example #27
0
 public PrivateComputerProperties()
     : base(2)
 {
     this.version = new IntProperty(this, UnsafeNativeMethods.PROPID_PC_VERSION);
     this.activeDirectory = new BooleanProperty(this, UnsafeNativeMethods.PROPID_PC_DS_ENABLED);
 }
 private void StoreAddinProperties(StyleCopAddIn addIn)
 {
     ICollection<Microsoft.StyleCop.PropertyDescriptor> propertyDescriptors = addIn.PropertyDescriptors;
     if ((propertyDescriptors != null) && (propertyDescriptors.Count > 0))
     {
         List<BooleanProperty> list = new List<BooleanProperty>(propertyDescriptors.Count);
         foreach (Microsoft.StyleCop.PropertyDescriptor descriptor in propertyDescriptors)
         {
             if ((descriptor.PropertyType == PropertyType.Boolean) && descriptor.DisplaySettings)
             {
                 PropertyDescriptor<bool> propertyDescriptor = (PropertyDescriptor<bool>) descriptor;
                 if (string.IsNullOrEmpty(descriptor.FriendlyName))
                 {
                     throw new ArgumentException(Strings.PropertyFriendlyNameNotSet);
                 }
                 if (string.IsNullOrEmpty(descriptor.Description))
                 {
                     throw new ArgumentException(Strings.PropertyDescriptionNotSet);
                 }
                 BooleanProperty property = new BooleanProperty(propertyDescriptor, propertyDescriptor.DefaultValue);
                 this.InitializePropertyState(addIn, property);
                 list.Add(property);
             }
         }
         this.properties.Add(addIn, list.ToArray());
     }
 }
 public ReadOnlyBoundToBooleanRule(Property targetProperty, BooleanProperty sourceProperty, bool inverse)
     : this(targetProperty.Name, sourceProperty.Name, inverse)
 {
 }
 public bool GetBoolean(BooleanProperty prop)
 {
     if (!System.Windows.Forms.ClientUtils.IsEnumValid(prop, (int) prop, 0x899, 0x8a5))
     {
         throw new InvalidEnumArgumentException("prop", (int) prop, typeof(BooleanProperty));
     }
     bool pfVal = false;
     this.lastHResult = System.Windows.Forms.SafeNativeMethods.GetThemeBool(new HandleRef(this, this.Handle), this.part, this.state, (int) prop, ref pfVal);
     return pfVal;
 }
		public virtual void Visit(BooleanProperty mapping)
		{
		}
 public bool GetBoolean(BooleanProperty prop)
 {
 }
		public int UxThemeGetThemeBool (IntPtr hTheme, int iPartId, int iStateId, BooleanProperty prop, out bool result)
		{
			int retval;
			int hresult = UXTheme.GetThemeBool (hTheme, iPartId, iStateId, (int)prop, out retval);

			result = retval == 0 ? false : true;
			return hresult;
		}
		public int UxThemeGetThemeBool (IntPtr hTheme, int iPartId, int iStateId, BooleanProperty prop, out bool result)
		{
			result = false;
			return (int)S.S_FALSE;
		}
 public void Visit(BooleanProperty mapping)
 {
     Increment("boolean");
 }
Example #36
0
		public virtual void Visit(BooleanProperty property) { }
        /// <include file='doc\VisualStyleRenderer.uex' path='docs/doc[@for="VisualStyleRenderer.GetBoolean"]/*' />
        /// <devdoc>
        ///    <para>
        ///       [See win32 equivalent.]
        ///    </para>
        /// </devdoc>
        public bool GetBoolean(BooleanProperty prop) {
            if (!ClientUtils.IsEnumValid(prop, (int)prop, (int)BooleanProperty.Transparent, (int)BooleanProperty.SourceShrink)){
                throw new InvalidEnumArgumentException("prop", (int)prop, typeof(BooleanProperty));
            }

            bool val = false;
            lastHResult = SafeNativeMethods.GetThemeBool(new HandleRef(this, Handle), part, state, (int)prop, ref val);
            return val;
        }
Example #38
0
        /// <summary>
        /// 解析普通属性
        /// </summary>
        private void ResolveDefaultProperty()
        {
            var errorFalg = false;
            /* [0] 属性定义行 */
            /* 属性定义样式 */

            /*
             *  int,float,string,bool: TYPE#PROPERTY_NAME(类型#属性名称#特殊设置)
             */
            var propertyRaw = scriptRawData.GetRow(0);
            /* 读取一次属性后,到下一个属性步进值,需要根据当前属性数据占用范围来计算 */
            /* 像Array或Array2D这样的数据占用的宽度会更大 */
            var dataSourceColumnIndex = 0;

            for (var columnIndex = 0; columnIndex < propertyRaw.Length; columnIndex++)
            {
                var propertyRawData = propertyRaw[columnIndex];
                var propertyData    = propertyRawData.Split(Helper.SETTING_SPLIT);
                if (propertyData[0].Equals(RawData.FILLING_DATA))
                {
                    continue;
                }
                /* 整竖行都是空,则忽略该竖行 */
                var columnIsEmpty = true;
                for (var y = 0; y < scriptRawData.height; y++)
                {
                    columnIsEmpty &= string.IsNullOrEmpty(scriptRawData[columnIndex, y]);
                    if (!columnIsEmpty)
                    {
                        break;
                    }
                }
                if (columnIsEmpty)
                {
                    dataSourceColumnIndex++;
                    continue;
                }
                if (string.IsNullOrEmpty(propertyRawData))
                {
                    continue;
                }
                var property = default(IProperty);
                var range    = new RawRange(1, dataSourceColumnIndex, 1, scriptRawData.height - 1);
                /* @开头,为自定义类型 */
                if (propertyData[0].StartsWith("@"))
                {
                    property = new DynamicProperty();
                }
                else
                {
                    /* 基础模式 */
                    if (generateData.scriptSetting.scriptObjectDataType == ScriptObjectDataType.BASE)
                    {
                        /* 数组模式 */
                        if (propertyData.Length == 3 && int.TryParse(propertyData[2], out var width))
                        {
                            switch (propertyData[0])
                            {
                            case "int":
                                property = new IntArrayProperty();
                                break;

                            case "float":
                                property = new FloatArrayProperty();
                                break;

                            case "string":
                                property = new StringArrayProperty();
                                break;

                            case "bool":
                                property = new BooleanArrayProperty();
                                break;

                            default: throw new System.Exception($"\"{generateData.loadFilePath}\"未定义类型\"{propertyData[0]}\"");
                            }
                            range.width = Convert.ToInt32(width);
                            /* 为了适应数据宽度超过属性栏宽度 */
                            columnIndex += range.width - 1;
                        }
                        /* 字典模式 */
                        else if (propertyData.Length == 3 && propertyData[2].ToLower().StartsWith("key"))
                        {
                            switch (propertyData[0])
                            {
                            case "int":
                                property = new IntKeyProperty();
                                break;

                            case "float":
                                property = new FloatKeyProperty();
                                break;

                            case "string":
                                property = new StringKeyProperty();
                                break;

                            default: throw new System.Exception($"\"{generateData.loadFilePath}\"未定义类型\"{propertyData[0]}\"");
                            }
                        }
                        /* 普通模式 */
                        else
                        {
                            switch (propertyData[0])
                            {
                            case "int":
                                property = new IntProperty();
                                break;

                            case "float":
                                property = new FloatProperty();
                                break;

                            case "string":
                                property = new StringProperty();
                                break;

                            case "bool":
                                property = new BooleanProperty();
                                break;

                            default: throw new System.Exception($"\"{generateData.loadFilePath}\"未定义类型\"{propertyData[0]}\"");
                            }
                        }
                    }
                    /* 二维数组模式 */
                    else if (generateData.scriptSetting.scriptObjectDataType == ScriptObjectDataType.ARRAY2D)
                    {
                        switch (propertyData[0])
                        {
                        case "int":
                            property = new IntArray2DProperty();
                            break;

                        case "float":
                            property = new FloatArray2DProperty();
                            break;

                        case "string":
                            property = new StringArray2DProperty();
                            break;

                        case "bool":
                            property = new BooleanArray2DProperty();
                            break;

                        default: throw new System.Exception($"\"{generateData.loadFilePath}\"未定义类型\"{propertyData[0]}\"");
                        }
                        range.width = Convert.ToInt32(propertyData[2]);
                    }
                    else if (generateData.scriptSetting.scriptObjectDataType == ScriptObjectDataType.ARRAY2DWITHNAME)
                    {
                        switch (propertyData[0])
                        {
                        case "int":
                            property = new IntArray2DWithnameProperty();
                            break;

                        case "float":
                            property = new FloatArray2DWithnameProperty();
                            break;

                        case "string":
                            property = new StringArray2DWithnameProperty();
                            break;

                        case "bool":
                            property = new BooleanArray2DWithnameProperty();
                            break;

                        default: throw new System.Exception($"\"{generateData.loadFilePath}\"未定义类型\"{propertyData[0]}\"");
                        }
                        /* +1为名称占用宽度 */
                        range.width = Convert.ToInt32(propertyData[2]) + 1;
                    }
                    else
                    {
                        throw new System.Exception($"未定义的类型\"{generateData.scriptSetting.scriptObjectDataType}\"");
                    }
                }
                property.InitProperty(propertyData, scriptRawData.GetRangeRawData(range));
                if (recordPropertyMap.ContainsKey(property.propertyName))
                {
                    CSVLoaderWindow.window.ShowNotification(new GUIContent($"文件\"{generateData.scriptSetting.scriptName}\"存在相同属性名称{property.propertyName}"));
                    generateData.SetState(BlockState.ERROR);
                    errorFalg = true;
                    break;
                }
                recordPropertyMap.Add(property.propertyName, property);
                dataSourceColumnIndex += range.width;

                if (property is DynamicProperty)
                {
                    // var dynamicProperty = property as DynamicProperty;
                    // generateData.dynamicDataMap.Add(dynamicProperty.dynamicTypeFullname, new GenerateData());
                    // generateData.dynamicDataList
                    // var dynamicPropertyInfo = new DynamicPropertyInfo();
                    // dynamicPropertyInfo.dynamicProperty = dynamicProperty;
                    // dynamicPropertyInfo.hasScripts = generateData.CheckHaveSameScript(dynamicProperty.dynamicTypeFullname, false);
                }
            }

            /* true: 字典模式 */

            var dictionaryFlag = false;

            foreach (var property in recordPropertyMap.Values)
            {
                if (property is IDictionaryKey)
                {
                    dictionaryFlag = true;
                    break;
                }
            }
            if (dictionaryFlag)
            {
                var keyCount = 0;
                foreach (var property in recordPropertyMap.Values)
                {
                    if (!(property is IDictionaryKey))
                    {
                        continue;
                    }
                    var key = property as IDictionaryKey;
                    if (key.keyFlag)
                    {
                        keyCount++;
                    }
                }
                if (keyCount <= 0)
                {
                    throw new System.Exception($"\"{generateData.csvFileInfo.Name}\"为字典类型,但未选择key");
                }
                else if (keyCount > 1)
                {
                    throw new System.Exception($"\"{generateData.csvFileInfo.Name}\"定义了多个属性作为key");
                }
            }
            if (!errorFalg)
            {
                GenerateScriptContent();
            }
        }
        /// <summary>
        /// Initializes the page.
        /// </summary>
        /// <param name="propertyControl">The tab control object.</param>
        public void Initialize(PropertyControl propertyControl)
        {
            Param.AssertNotNull(propertyControl, "propertyControl");

            this.tabControl = propertyControl;

            // Get the cache setting.
            this.writeCachePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["WriteCache"] as PropertyDescriptor<bool>;

            this.writeCacheParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            var mergedWriteCacheProperty = this.tabControl.MergedSettings == null
                                               ? null
                                               : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.writeCachePropertyDescriptor.PropertyName) as
                                                 BooleanProperty;

            this.enableCache.Checked = mergedWriteCacheProperty == null ? this.writeCachePropertyDescriptor.DefaultValue : mergedWriteCacheProperty.Value;

            this.autoUpdateCheckPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["AutoCheckForUpdate"] as PropertyDescriptor<bool>;

            this.autoUpdateParentProperty = this.tabControl.ParentSettings == null
                                                ? null
                                                : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as
                                                  BooleanProperty;

            var mergedAutoUpdateProperty = this.tabControl.MergedSettings == null
                                               ? null
                                               : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.autoUpdateCheckPropertyDescriptor.PropertyName) as
                                                 BooleanProperty;

            this.autoUpdateCheckBox.Checked = mergedAutoUpdateProperty == null ? this.autoUpdateCheckPropertyDescriptor.DefaultValue : mergedAutoUpdateProperty.Value;

            this.daysToCheckPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["DaysToCheckForUpdates"] as PropertyDescriptor<int>;

            this.daysToCheckParentProperty = this.tabControl.ParentSettings == null
                                                 ? null
                                                 : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                                   IntProperty;

            var mergedDaysToCheckProperty = this.tabControl.MergedSettings == null
                                                ? null
                                                : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.daysToCheckPropertyDescriptor.PropertyName) as
                                                  IntProperty;

            this.daysMaskedTextBox.Text = mergedDaysToCheckProperty == null
                                              ? this.daysToCheckPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                              : mergedDaysToCheckProperty.Value.ToString(CultureInfo.InvariantCulture);

            this.maxViolationCountPropertyDescriptor = this.tabControl.Core.PropertyDescriptors["MaxViolationCount"] as PropertyDescriptor<int>;

            this.maxViolationCountParentProperty = this.tabControl.ParentSettings == null
                                                       ? null
                                                       : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                         as IntProperty;

            var mergedMaxViolationCountProperty = this.tabControl.MergedSettings == null
                                                      ? null
                                                      : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.maxViolationCountPropertyDescriptor.PropertyName)
                                                        as IntProperty;

            this.maxViolationCountMaskedTextBox.Text = mergedMaxViolationCountProperty == null
                                                           ? this.maxViolationCountPropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                                                           : mergedMaxViolationCountProperty.Value.ToString(CultureInfo.InvariantCulture);

            // Culture
            this.culturePropertyDescriptor = this.tabControl.Core.PropertyDescriptors["Culture"] as PropertyDescriptor<string>;

            this.cultureParentProperty = this.tabControl.ParentSettings == null
                                             ? null
                                             : this.tabControl.ParentSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            var mergedCultureProperty = this.tabControl.MergedSettings == null
                                            ? null
                                            : this.tabControl.MergedSettings.GlobalSettings.GetProperty(this.culturePropertyDescriptor.PropertyName) as StringProperty;

            this.cultureComboBox.SelectedIndex =
                this.cultureComboBox.FindStringExact(
                    mergedCultureProperty == null
                        ? this.culturePropertyDescriptor.DefaultValue.ToString(CultureInfo.InvariantCulture)
                        : mergedCultureProperty.Value.ToString(CultureInfo.InvariantCulture));

            this.SetBoldState();

            // Reset the dirty flag to false now.
            this.dirty = false;
            this.tabControl.DirtyChanged();
        }
    /// <summary>
    /// Checks if the given detailed settings property is overridden 
    /// </summary>
    /// <param name="iter">Tree iterator to use.</param>
    /// <param name="propertyAddInPair">Property addin pair to check.</param>
    /// <param name="isChecked">Is checked value.</param>
    /// <returns>Property friendly name with appropriate markup.</returns>
    private string DetectDetailsSettingsBoldState(Gtk.TreeIter iter, PropertyAddInPair propertyAddInPair, bool isChecked)
    {
      // Create a property representing the current value of the selection.
      BooleanProperty localValue = new BooleanProperty((PropertyDescriptor<bool>)propertyAddInPair.Property.PropertyDescriptor, isChecked);

      // Compare this with the parent value.
      bool overridden = this.SettingsHandler.SettingsComparer.IsAddInSettingOverwritten(propertyAddInPair.AddIn, propertyAddInPair.Property.PropertyName, localValue);

      return GetBoldMarkup(propertyAddInPair.Property.FriendlyName, overridden);
    }
Example #41
0
        /// <summary>
        /// Sets the bold state of the given properties node based on its current status.
        /// </summary>
        /// <param name="propertyNode">
        /// The node containing the properties.
        /// </param>
        private void DetectBoldStateForDetails(TreeNode propertyNode)
        {
            Param.AssertNotNull(propertyNode, "propertyNode");

            PropertyAddInPair propertyAddInPair = (PropertyAddInPair)propertyNode.Tag;

            bool overriden = false;

            // Create a property representing the current value of the selection.
            BooleanProperty localValue = new BooleanProperty((PropertyDescriptor<bool>)propertyAddInPair.Property.PropertyDescriptor, propertyNode.Checked);

            // Compare this with the parent value.
            overriden = this.tabControl.SettingsComparer.IsAddInSettingOverwritten(propertyAddInPair.AddIn, propertyAddInPair.Property.PropertyName, localValue);

            // Set the bold state depending upon whether the setting is overriden.
            SetBoldState(propertyNode, overriden, this.detailsTree);
        }
    /// <summary>
    /// Sets the check state for the given property.
    /// </summary>
    /// <param name="addIn">
    /// The addin that owns the property.
    /// </param>
    /// <param name="property">
    /// The property.
    /// </param>
    private void InitializePropertyState(StyleCopAddIn addIn, BooleanProperty property)
    {
      Param.AssertNotNull(addIn, "addIn");
      Param.AssertNotNull(property, "property");

      BooleanProperty mergedProperty = addIn.GetSetting(this.SettingsHandler.MergedSettings, property.PropertyName) as BooleanProperty;
      if (mergedProperty == null)
      {
        property.Value = property.DefaultValue;
      }
      else
      {
        property.Value = mergedProperty.Value;
      }
    }
Example #43
0
 public bool GetBoolean(BooleanProperty prop)
 {
 }
        protected override void Initialize()
        {
            SalesOrderIdProperty = new IntegerKeyProperty(this, SalesOrderId)
            {
                Required = true,
                Editable = false,
                IsKey    = true,
            };
            SalesOrderNumberProperty = new TextProperty(this, SalesOrderNumber)
            {
                Required = true,
                Size     = 25,
                Editable = false,
            };
            OrderDateProperty = new DateProperty(this, OrderDate)
            {
                Required = true,
                Editable = false,
            };
            StatusProperty = new EnumByteProperty(this, Status)
            {
                Required = true,
                EnumType = "sales order status",
            };
            OnlineOrderFlagProperty = new BooleanProperty(this, OnlineOrderFlag)
            {
                Required = true,
            };
            PurchaseOrderNumberProperty = new TextProperty(this, PurchaseOrderNumber)
            {
                Size = 25,
            };
            AccountNumberProperty = new TextProperty(this, AccountNumber)
            {
                Size = 15,
            };
            ShipDateProperty = new DateProperty(this, ShipDate)
            {
            };
            CommentProperty = new TextProperty(this, Comment)
            {
                Size = 128,
            };
            RevisionNumberProperty = new TinyIntegerProperty(this, RevisionNumber)
            {
                Required = true,
                Editable = false,
            };
            ModifiedDateProperty = new DateTimeProperty(this, ModifiedDate)
            {
                Required = true,
                Editable = false,
            };
            DataObject objCustomer = ServiceProvider.GetService <SalesOrderCustomerObject>();

            AddChildObject(Customer, objCustomer);
            DataObject objDetail = ServiceProvider.GetService <SalesOrderDetailList>();

            AddChildObject(Detail, objDetail);
            DataObject objPayment = ServiceProvider.GetService <SalesOrderPaymentObject>();

            AddChildObject(Payment, objPayment);
            DataObject objSales = ServiceProvider.GetService <SalesOrderSalesObject>();

            AddChildObject(Sales, objSales);
        }
Example #45
0
        /// <summary>
        /// Saves the given boolean property into the given node.
        /// </summary>
        /// <param name="rootNode">The node under which to store the new property node.</param>
        /// <param name="property">The property to save.</param>
        /// <param name="propertyName">The name of the property.</param>
        /// <returns>Returns true if the property was written.</returns>
        private static bool SaveBooleanProperty(
            XmlNode rootNode, BooleanProperty property, string propertyName)
        {
            Param.AssertNotNull(rootNode, "rootNode");
            Param.AssertNotNull(property, "property");
            Param.AssertValidString(propertyName, "propertyName");

            // Create and append the root node for this property.
            XmlNode propertyNode = rootNode.OwnerDocument.CreateElement("BooleanProperty");
            rootNode.AppendChild(propertyNode);

            XmlAttribute propertyNameAttribute = rootNode.OwnerDocument.CreateAttribute("Name");
            propertyNameAttribute.Value = propertyName;
            propertyNode.Attributes.Append(propertyNameAttribute);

            // Add the value.
            propertyNode.InnerText = property.Value.ToString();

            return true;
        }
 private void InitializePropertyState(StyleCopAddIn addIn, BooleanProperty property)
 {
     BooleanProperty setting = addIn.GetSetting(this.tabControl.MergedSettings, property.PropertyName) as BooleanProperty;
     if (setting == null)
     {
         property.Value = property.DefaultValue;
     }
     else
     {
         property.Value = setting.Value;
     }
 }
 private void DetectBoldStateForDetails(TreeNode propertyNode)
 {
     PropertyAddInPair tag = (PropertyAddInPair) propertyNode.Tag;
     bool bolded = false;
     BooleanProperty localProperty = new BooleanProperty((PropertyDescriptor<bool>) tag.Property.PropertyDescriptor, propertyNode.Checked);
     bolded = this.tabControl.SettingsComparer.IsAddInSettingOverwritten(tag.AddIn, tag.Property.PropertyName, localProperty);
     SetBoldState(propertyNode, bolded, this.detailsTree);
 }
Example #48
0
        private void InitializeWriteLine()
        {
            // show fps
            var fps = new TextField {
                textColor = 0xff0000, x = DefaultControlWidth / 2
            }.AttachTo(this).Do(t => EgoView.FramesPerSecondChanged += () => t.text = "fps: " + EgoView.FramesPerSecond);


            var dumperbg = new Shape().AttachTo(this);

            dumperbg.graphics.beginFill(0, 0.5);
            dumperbg.graphics.drawRect(0, DefaultControlHeight / 4, DefaultControlWidth, DefaultControlHeight / 2);

            var dumper = new TextField
            {
                width        = DefaultControlWidth,
                height       = DefaultControlHeight / 2,
                textColor    = 0xffff00,
                mouseEnabled = false,
                y            = DefaultControlHeight / 4,
            }.AttachTo(this);

            WriteLineControl = dumper;
            var dumper_queue = new Queue <string>();

            Action Update =
                delegate
            {
                dumper.text = "";

                foreach (var v in dumper_queue)
                {
                    dumper.appendText(v + Environment.NewLine);
                }
                ;
            };

            WriteLine =
                text =>
            {
                dumper_queue.Enqueue(text);

                while (dumper_queue.Count > 10)
                {
                    dumper_queue.Dequeue();
                }

                if (dumper.visible)
                {
                    Update();
                }
            };

            BooleanProperty CheatMode = true;

            CheatMode.ValueChangedTo +=
                value =>
            {
                dumperbg.visible        = value;
                dumper.visible          = value;
                fps.visible             = value;
                Keyboard_Cheats.Enabled = value;
            };

            if (global::ScriptCoreLib.ActionScript.flash.system.Capabilities.isDebugger)
            {
                var ButtonT = new KeyboardButton(stage)
                {
                    Groups = new[]
                    {
                        MovementArrows[Keyboard.T],
                    },
                    Up = CheatMode.Toggle
                };

                this.EgoView.WriteLine = this.WriteLine;
            }

            CheatMode.Toggle();
        }
    /// <summary>
    /// Checks if the given analyzer rule setting is overridden.
    /// </summary>
    /// <param name="analyzer">Source analyzer of the rule to check.</param>
    /// <param name="ruleToCheck">The rule that should be checked.</param>
    /// <param name="isChecked">Is the check box checked or unchecked?</param>
    /// <param name="hasOverriddenChilds">Value that is used for cells that don't have a analyzer.</param>
    /// <returns>True if the rule is overridden, false otherwise.</returns>
    private bool DetectRuleOverride(SourceAnalyzer analyzer, Rule ruleToCheck, bool isChecked, bool hasOverriddenChilds)
    {
      bool overridden = false;

      if (analyzer != null)
      {
        // Create a property representing the current value of the selection.
        string propertyName = ruleToCheck.Name + "#Enabled";
        BooleanProperty localValue = new BooleanProperty(analyzer, propertyName, isChecked);

        // Compare this with the parent value.
        overridden = this.SettingsHandler.SettingsComparer.IsAddInSettingOverwritten(analyzer, propertyName, localValue);
      }
      else
      {
        overridden = hasOverriddenChilds;
      }

      return overridden;
    }
 private bool DetectBoldStateForRule(TreeNode ruleNode)
 {
     SourceAnalyzer propertyContainer = null;
     for (TreeNode node = ruleNode.Parent; node != null; node = node.Parent)
     {
         propertyContainer = node.Tag as SourceAnalyzer;
         if (propertyContainer != null)
         {
             break;
         }
     }
     Rule tag = ruleNode.Tag as Rule;
     bool bolded = false;
     if (propertyContainer != null)
     {
         string propertyName = tag.Name + "#Enabled";
         BooleanProperty localProperty = new BooleanProperty(propertyContainer, propertyName, ruleNode.Checked);
         bolded = this.tabControl.SettingsComparer.IsAddInSettingOverwritten(propertyContainer, propertyName, localProperty);
     }
     SetBoldState(ruleNode, bolded, this.analyzeTree);
     return bolded;
 }
    /// <summary>
    /// Stores the properties for the given add-in.
    /// </summary>
    /// <param name="addIn">
    /// The add-in.
    /// </param>
    private void StoreAddinProperties(StyleCopAddIn addIn)
    {
      Param.AssertNotNull(addIn, "addIn");

      ICollection<PropertyDescriptor> addInPropertyDescriptors = addIn.PropertyDescriptors;
      if (addInPropertyDescriptors != null && addInPropertyDescriptors.Count > 0)
      {
        List<BooleanProperty> storedProperties = new List<BooleanProperty>(addInPropertyDescriptors.Count);

        foreach (PropertyDescriptor propertyDescriptor in addInPropertyDescriptors)
        {
          if (propertyDescriptor.PropertyType == PropertyType.Boolean && propertyDescriptor.DisplaySettings)
          {
            PropertyDescriptor<bool> booleanPropertyDescriptor = (PropertyDescriptor<bool>)propertyDescriptor;

            // Ensure that the property has a friendly name and a description.
            if (string.IsNullOrEmpty(propertyDescriptor.FriendlyName))
            {
              throw new ArgumentException("The friendly name of the property has not been set.");
            }

            if (string.IsNullOrEmpty(propertyDescriptor.Description))
            {
              throw new ArgumentException("The property description has not been set.");
            }

            BooleanProperty storedProperty = new BooleanProperty(booleanPropertyDescriptor, booleanPropertyDescriptor.DefaultValue);

            this.InitializePropertyState(addIn, storedProperty);

            storedProperties.Add(storedProperty);
          }
        }

        this.properties.Add(addIn, storedProperties.ToArray());
      }
    }
 private static bool SaveBooleanProperty(XmlNode rootNode, BooleanProperty property, string propertyName)
 {
     XmlNode newChild = rootNode.OwnerDocument.CreateElement("BooleanProperty");
     rootNode.AppendChild(newChild);
     XmlAttribute node = rootNode.OwnerDocument.CreateAttribute("Name");
     node.Value = propertyName;
     newChild.Attributes.Append(node);
     newChild.InnerText = property.Value.ToString();
     return true;
 }