Пример #1
0
        private string SetComboBoxState(string[] configNames, IPropertyStorage storage, ComboBox box, string propertyName, string defaultValue)
        {
            string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;

            box.SelectedItem = result;
            return(result);
        }
Пример #2
0
 public override void Load(string[] configNames, IPropertyStorage storage)
 {
   object result = storage.GetProperties(false, configNames, propertyName, defaultValue);
   if (result != null)
   {
     box.CheckState = CheckStateOfBool((bool)result);
   }
   else
   {
     box.CheckState = CheckState.Indeterminate;
   }
 }
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            object result = storage.GetProperties(false, configNames, propertyName, defaultValue);

            if (result != null)
            {
                box.CheckState = CheckStateOfBool((bool)result);
            }
            else
            {
                box.CheckState = CheckState.Indeterminate;
            }
        }
Пример #4
0
        /// <summary>
        /// Load the textbox string from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool   anyFound;
            bool   indeterminate;
            string text = storage.GetProperties <string>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.Text = (text == null ? "" : text);
            }
            else
            {
                box.Text = TextIndeterminate;
            }
        }
Пример #5
0
        /// <summary>
        /// Load the negated checkbox state from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool anyFound;
            bool indeterminate;
            bool result = storage.GetProperties <bool>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.CheckState = CheckBoxProperty.CheckStateFromBool(!result);
            }
            else
            {
                box.CheckState = CheckState.Indeterminate;
            }
        }
Пример #6
0
        static private void LoadTrackBarProperties(TrackBar trackBar, string name, string[] configNames, IPropertyStorage storage)
        {
            bool anyFound, indeterminate;
            var  selection = storage.GetProperties(false, configNames, name, "out", out anyFound, out indeterminate);
            int  value;

            if (!indeterminate && Int32.TryParse(selection, out value) &&
                value >= trackBar.Minimum && value <= trackBar.Maximum)
            {
                trackBar.Value = value;
            }
            else
            {
                trackBar.Value = 0; // default: low
            }
        }
Пример #7
0
        /// <summary>
        /// Load project file properties and represent them in the UI.
        /// IMPORTANT:
        ///   The defaults must match what the build script expect as defaults!!! This way, not representing a
        ///   property in the project file is equivalent to it having the default.
        /// </summary>
        /// <param name="configNames"></param>
        /// <param name="storage"></param>
        public void LoadProperties(string[] configNames, IPropertyStorage storage)
        {
            bool propertiesChangedOnLoad = false;

            SetGlobalComboBoxState(storage, AssemblyModeDropDown, AssemblyModeName, "0");

            foreach (var prop in properties)
            {
                Contract.Assume(prop != null);

                prop.Load(configNames, storage);
            }

            EnableDisableRuntimeDependentUI();

            var runtimeCheckingLevel = SetComboBoxState(configNames, storage, RuntimeCheckingLevelDropDown, RuntimeCheckingLevelName, "Full");

            if (runtimeCheckingLevel == "RequiresAlways")
            {
                // fixup backwards compatible string
                RuntimeCheckingLevelDropDown.SelectedItem = "ReleaseRequires";
                propertiesChangedOnLoad = true;
            }


            EnableDisableStaticDependentUI();

            EnableDisableBaseLineUI();

            EnableDisableBackgroundDependentUI();

            EnableDisableCacheDependendUI();

            bool   anyFound, indeterminate;
            string contractReferenceAssemblySelection = storage.GetProperties(false, configNames, ContractReferenceAssemblyName, "(none)", out anyFound, out indeterminate);

            if (!indeterminate)
            {
                if (!anyFound)
                {
                    bool anyFound2, indeterminate2;

                    // check for legacy
                    var legacyBuildContractReferenceAssembly = storage.GetProperties(false, configNames, BuildContractReferenceAssemblyName, false, out anyFound2, out indeterminate2);
                    if (anyFound2 && !indeterminate2)
                    {
                        if (legacyBuildContractReferenceAssembly)
                        {
                            // TODO remove property
                            contractReferenceAssemblySelection = "Build";
                            // make sure properties are changed!!!
                            propertiesChangedOnLoad = true;
                        }
                        else
                        {
                            contractReferenceAssemblySelection = "DoNotBuild";
                            propertiesChangedOnLoad            = true;
                        }
                    }
                }
                ContractReferenceAssemblySelection.SelectedItem = contractReferenceAssemblySelection;
            }
            else
            {
                ContractReferenceAssemblySelection.SelectedItem = null;
            }

            // Load the track bar properties
            LoadTrackBarProperties(WarningLevelTrackBar, WarningLevelName, configNames, storage);

            EnableDisableContractReferenceDependentUI();


            if (propertiesChangedOnLoad)
            {
                this.PropertiesChanged();
                SaveProperties(configNames, storage);
            }
        }
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;

            box.Text = result;
        }
Пример #9
0
 public override void Load(string[] configNames, IPropertyStorage storage)
 {
   string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;
   box.Text = result;
 }
Пример #10
0
        // Initialize the UI from the property storage
        public void LoadProperties(string[] configNames, IPropertyStorage storage)
        {
            this.useContractsCheck.CheckState            = CheckState.Unchecked;
            this.produceContractAssemblyCheck.CheckState = CheckState.Unchecked;
            this.useVerifier.CheckState                  = CheckState.Unchecked;
            this.publicPreconditions.CheckState          = CheckState.Unchecked;
            this.allOtherPreAndPostConditions.CheckState = CheckState.Unchecked;
            this.assumes.CheckState           = CheckState.Unchecked;
            this.invariants.CheckState        = CheckState.Unchecked;
            this.publicContracts.CheckState   = CheckState.Unchecked;
            this.allOtherContracts.CheckState = CheckState.Unchecked;
            this.nonNullByDefault.CheckState  = CheckState.Unchecked;
            this.checkContracts.CheckState    = CheckState.Unchecked;
            this.checkPurity.CheckState       = CheckState.Unchecked;

            // contracts checkbox.
            object propUseContracts = storage.GetProperties(true, configNames, "UseContracts", false);

            if (propUseContracts != null)
            {
                this.useContractsCheck.Checked            = (bool)propUseContracts;
                this.publicPreconditions.Checked          = true;
                this.allOtherPreAndPostConditions.Checked = true;
                this.assumes.Checked           = true;
                this.invariants.Checked        = true;
                this.publicContracts.Checked   = true;
                this.allOtherContracts.Checked = true;
                this.checkContracts.Checked    = true;
            }

            // produce contract assembly checkbox
            object produceContractAssembly = storage.GetProperties(true, configNames, "ProduceContractAssembly", false);

            if (produceContractAssembly != null)
            {
                this.produceContractAssemblyCheck.Checked = (bool)produceContractAssembly;
            }

            // verifier checkbox.
            object propUseVerifier = storage.GetProperties(true, configNames, "Verify", false);

            if (propUseVerifier != null)
            {
                this.useVerifier.Checked = (bool)propUseVerifier;
            }

            // verifier options
            object propVerifierOptions = storage.GetProperties(true, configNames, "ProgramVerifierCommandLineOptions", "");

            if (propVerifierOptions != null)
            {
                this.verifyopts.Text = (string)propVerifierOptions;
            }

            //non null default checkbox
            object referenceTypesAreNonNullByDefault = storage.GetProperties(true, configNames, "ReferenceTypesAreNonNullByDefault", false);

            if (referenceTypesAreNonNullByDefault != null)
            {
                this.nonNullByDefault.Checked = (bool)referenceTypesAreNonNullByDefault;
            }

            //contract admissibility checkbox
            object checkAdmissibility = storage.GetProperties(true, configNames, "CheckContractAdmissibility", true);

            if (checkAdmissibility != null)
            {
                this.checkContracts.Checked = (bool)checkAdmissibility;
            }

            //method purity checkbox
            object checkPurity = storage.GetProperties(true, configNames, "CheckPurity", false);

            if (checkPurity != null)
            {
                this.checkPurity.Checked = (bool)checkPurity;
            }

            // other checkboxes
            string disableString = storage.GetProperties(true, configNames, "DisabledContractFeatures", "") as string;

            if (disableString != null)
            {
                string[] disableList = disableString.Split(';');
                foreach (string ds in disableList)
                {
                    switch (ds)
                    {
                    case "ac":
                    case "assumechecks":
                        this.assumes.Checked = false;
                        break;

                    case "dc":
                    case "defensivechecks":
                        this.publicPreconditions.Checked = false;
                        break;

                    case "gcc":
                    case "guardedclasseschecks":
                        this.invariants.Checked = false;
                        break;

                    case "ic":
                    case "internalchecks":
                        this.allOtherPreAndPostConditions.Checked = false;
                        break;

                    case "icm":
                    case "internalcontractsmetadata":
                        this.allOtherContracts.Checked = false;
                        break;

                    case "pcm":
                    case "publiccontractsmetadata":
                        this.publicContracts.Checked = false;
                        break;
                    }
                }
            }
        }
Пример #11
0
    // Initialize the UI from the property storage
    public void LoadProperties(string[] configNames, IPropertyStorage storage)
    {
      this.useContractsCheck.CheckState = CheckState.Unchecked;
      this.produceContractAssemblyCheck.CheckState = CheckState.Unchecked;
      this.useVerifier.CheckState = CheckState.Unchecked;
      this.publicPreconditions.CheckState = CheckState.Unchecked;
      this.allOtherPreAndPostConditions.CheckState = CheckState.Unchecked;
      this.assumes.CheckState = CheckState.Unchecked;
      this.invariants.CheckState = CheckState.Unchecked;
      this.publicContracts.CheckState = CheckState.Unchecked;
      this.allOtherContracts.CheckState = CheckState.Unchecked;
      this.nonNullByDefault.CheckState = CheckState.Unchecked;
      this.checkContracts.CheckState = CheckState.Unchecked;
      this.checkPurity.CheckState = CheckState.Unchecked;

      // contracts checkbox.
      object propUseContracts = storage.GetProperties(true, configNames, "UseContracts", false);
      if (propUseContracts != null){
        this.useContractsCheck.Checked = (bool)propUseContracts;
        this.publicPreconditions.Checked = true;
        this.allOtherPreAndPostConditions.Checked = true;
        this.assumes.Checked = true;
        this.invariants.Checked = true;
        this.publicContracts.Checked = true;
        this.allOtherContracts.Checked = true;
        this.checkContracts.Checked = true;
      }

      // produce contract assembly checkbox
      object produceContractAssembly = storage.GetProperties(true, configNames, "ProduceContractAssembly", false);
      if (produceContractAssembly != null)
        this.produceContractAssemblyCheck.Checked = (bool)produceContractAssembly;

      // verifier checkbox.
      object propUseVerifier = storage.GetProperties(true, configNames, "Verify", false);
      if (propUseVerifier != null)
        this.useVerifier.Checked = (bool)propUseVerifier;

      // verifier options
      object propVerifierOptions = storage.GetProperties(true, configNames, "ProgramVerifierCommandLineOptions", "");
      if (propVerifierOptions != null)
        this.verifyopts.Text = (string)propVerifierOptions;

      //non null default checkbox
      object referenceTypesAreNonNullByDefault = storage.GetProperties(true, configNames, "ReferenceTypesAreNonNullByDefault", false);
      if (referenceTypesAreNonNullByDefault != null)
        this.nonNullByDefault.Checked = (bool)referenceTypesAreNonNullByDefault;

      //contract admissibility checkbox
      object checkAdmissibility = storage.GetProperties(true, configNames, "CheckContractAdmissibility", true);
      if (checkAdmissibility != null)
        this.checkContracts.Checked = (bool)checkAdmissibility;

      //method purity checkbox
      object checkPurity = storage.GetProperties(true, configNames, "CheckPurity", false);
      if (checkPurity != null)
        this.checkPurity.Checked = (bool)checkPurity;

      // other checkboxes
      string disableString = storage.GetProperties(true, configNames, "DisabledContractFeatures", "") as string;
      if (disableString != null){
        string[] disableList = disableString.Split(';');
        foreach (string ds in disableList){
          switch (ds){
            case "ac":
            case "assumechecks":
              this.assumes.Checked = false;
              break;
            case "dc":
            case "defensivechecks":
              this.publicPreconditions.Checked = false;
              break;
            case "gcc":
            case "guardedclasseschecks":
              this.invariants.Checked = false;
              break;
            case "ic":
            case "internalchecks":
              this.allOtherPreAndPostConditions.Checked = false;
              break;
            case "icm":
            case "internalcontractsmetadata":
              this.allOtherContracts.Checked = false;
              break;
            case "pcm":
            case "publiccontractsmetadata":
              this.publicContracts.Checked = false;
              break;
          }
        }
      }
    }
Пример #12
0
        /// <summary>
        /// Load the textbox string from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool anyFound;
            bool indeterminate;
            string text = storage.GetProperties<string>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.Text = (text == null ? "" : text);
            }
            else
            {
                box.Text = TextIndeterminate;
            }
        }
Пример #13
0
        /// <summary>
        /// Load the negated checkbox state from its associated msbuild property
        /// </summary>
        /// <param name="configNames">The set of configurations</param>
        /// <param name="storage">The property storage</param>		
        public override void Load(string[] configNames, IPropertyStorage storage)
        {
            bool anyFound;
            bool indeterminate;
            bool result = storage.GetProperties<bool>(perUser, configNames, propertyName, defaultValue, out anyFound, out indeterminate);

            if (!indeterminate)
            {
                box.CheckState = CheckBoxProperty.CheckStateFromBool(!result);
            }
            else
            {
                box.CheckState = CheckState.Indeterminate;
            }
        }
Пример #14
0
 private string SetComboBoxState(string[] configNames, IPropertyStorage storage, ComboBox box, string propertyName, string defaultValue)
 {
     string result = storage.GetProperties(false, configNames, propertyName, defaultValue) as string;
     box.SelectedItem = result;
     return result;
 }
Пример #15
0
        static private void LoadTrackBarProperties(TrackBar trackBar, string name, string[] configNames, IPropertyStorage storage)
        {
            bool anyFound, indeterminate;
            var selection = storage.GetProperties(false, configNames, name, "out", out anyFound, out indeterminate);
            int value;

            if (!indeterminate && Int32.TryParse(selection, out value)
              && value >= trackBar.Minimum && value <= trackBar.Maximum)
            {
                trackBar.Value = value;
            }
            else
            {
                trackBar.Value = 0; // default: low
            }
        }
Пример #16
0
        /// <summary>
        /// Load project file properties and represent them in the UI.
        /// IMPORTANT:
        ///   The defaults must match what the build script expect as defaults!!! This way, not representing a
        ///   property in the project file is equivalent to it having the default.
        /// </summary>
        /// <param name="configNames"></param>
        /// <param name="storage"></param>
        public void LoadProperties(string[] configNames, IPropertyStorage storage)
        {
            bool propertiesChangedOnLoad = false;

            SetGlobalComboBoxState(storage, AssemblyModeDropDown, AssemblyModeName, "0");

            foreach (var prop in properties)
            {
                Contract.Assume(prop != null);

                prop.Load(configNames, storage);
            }

            EnableDisableRuntimeDependentUI();

            var runtimeCheckingLevel = SetComboBoxState(configNames, storage, RuntimeCheckingLevelDropDown, RuntimeCheckingLevelName, "Full");
            if (runtimeCheckingLevel == "RequiresAlways")
            {
                // fixup backwards compatible string
                RuntimeCheckingLevelDropDown.SelectedItem = "ReleaseRequires";
                propertiesChangedOnLoad = true;
            }


            EnableDisableStaticDependentUI();

            EnableDisableBaseLineUI();

            EnableDisableBackgroundDependentUI();

            EnableDisableCacheDependendUI();

            bool anyFound, indeterminate;
            string contractReferenceAssemblySelection = storage.GetProperties(false, configNames, ContractReferenceAssemblyName, "(none)", out anyFound, out indeterminate);

            if (!indeterminate)
            {
                if (!anyFound)
                {
                    bool anyFound2, indeterminate2;

                    // check for legacy
                    var legacyBuildContractReferenceAssembly = storage.GetProperties(false, configNames, BuildContractReferenceAssemblyName, false, out anyFound2, out indeterminate2);
                    if (anyFound2 && !indeterminate2)
                    {
                        if (legacyBuildContractReferenceAssembly)
                        {
                            // TODO remove property
                            contractReferenceAssemblySelection = "Build";
                            // make sure properties are changed!!!
                            propertiesChangedOnLoad = true;
                        }
                        else
                        {
                            contractReferenceAssemblySelection = "DoNotBuild";
                            propertiesChangedOnLoad = true;
                        }
                    }
                }
                ContractReferenceAssemblySelection.SelectedItem = contractReferenceAssemblySelection;
            }
            else
            {
                ContractReferenceAssemblySelection.SelectedItem = null;
            }

            // Load the track bar properties
            LoadTrackBarProperties(WarningLevelTrackBar, WarningLevelName, configNames, storage);

            EnableDisableContractReferenceDependentUI();


            if (propertiesChangedOnLoad)
            {
                this.PropertiesChanged();
                SaveProperties(configNames, storage);
            }
        }