GetStringProperty() public method

Gets the string value of property in the best settings group (trying local first then global) and creates the (global) property with the default value if it doesn't exist yet.
public GetStringProperty ( string name, string defaultValue ) : string
name string
defaultValue string
return string
Exemplo n.º 1
0
        /// summary>
        /// Receives the broadcast message "PropertyChanged." If it is the ShowFirstPane
        /// property, adjust.
        /// /summary>
        public void OnPropertyChanged(string name)
        {
            CheckDisposed();
            if (m_propertyTable.GetStringProperty("ToolForAreaNamed_lexicon", null) != toolName)
            {
                return;
            }
            if (name == "ActiveClerkSelectedObject" || name == "ToolForAreaNamed_lexicon")
            {
                SetFocusInDefaultControl();
            }
            if (name == m_propertyControllingVisibilityOfFirstPane)
            {
                bool fShowFirstPane = m_propertyTable.GetBoolProperty(m_propertyControllingVisibilityOfFirstPane, true);
                if (fShowFirstPane == m_showingFirstPane)
                {
                    return;                     // just in case it didn't really change
                }
                m_showingFirstPane = fShowFirstPane;

                Panel1Collapsed = !fShowFirstPane;

                if (ShowFirstPaneChanged != null)
                {
                    ShowFirstPaneChanged(this, new EventArgs());
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Restore any appropriate settings which have values in the property table
 /// </summary>
 public static void RestoreSettings(IFdoServiceLocator services, PropertyTable propertyTable)
 {
     var hcSettings = propertyTable.GetStringProperty(khomographconfiguration, null);
     if (hcSettings != null)
     {
         var hc = services.GetInstance<HomographConfiguration>();
         hc.PersistData = hcSettings;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// From IFwExtension
        /// </summary>
        /// <param name="cache"></param>
        /// <param name="mediator"></param>
        /// <param name="propertyTable"></param>
        void IFwExtension.Init(LcmCache cache, Mediator mediator, XCore.PropertyTable propertyTable)
        {
            m_cache         = cache;
            m_mediator      = mediator;
            m_propertyTable = propertyTable;
            string sPrevFile = m_propertyTable.GetStringProperty(FilePropertyName, null);

            if (!String.IsNullOrEmpty(sPrevFile))
            {
                tbPath.Text = sPrevFile;
                UpdateButtons();
            }
            string sMergeStyle = m_propertyTable.GetStringProperty(MergeStylePropertyName, null);

            if (!String.IsNullOrEmpty(sMergeStyle))
            {
                m_msImport = (FlexLiftMerger.MergeStyle)Enum.Parse(typeof(FlexLiftMerger.MergeStyle), sMergeStyle, true);
                switch (m_msImport)
                {
                case FlexLiftMerger.MergeStyle.MsKeepOld:
                    m_rbKeepCurrent.Checked = true;
                    break;

                case FlexLiftMerger.MergeStyle.MsKeepNew:
                    m_rbKeepNew.Checked = true;
                    break;

                case FlexLiftMerger.MergeStyle.MsKeepBoth:
                    m_rbKeepBoth.Checked = true;
                    break;

                default:
                    m_rbKeepCurrent.Checked = true;
                    break;
                }
            }
        }
Exemplo n.º 4
0
        static public void ChooseSinglePropertySequenceValue(Mediator mediator, PropertyTable propertyTable, string choiceValue,
                                                             XmlNode choiceParameterNode, string propertyName, bool fEmptyAllowed, PropertyTable.SettingsGroup settingsGroup)
        {
            propertyTable.SetProperty(propertyName + "Parameters", choiceParameterNode, settingsGroup, true);
            propertyTable.SetPropertyPersistence(propertyName + "Parameters", false, settingsGroup);
            string sValue = propertyTable.GetStringProperty(propertyName, "", settingsGroup);

            string[] rgsValues = sValue.Split(',');
            int      idx       = -1;

            if (sValue == choiceValue)
            {
                if (fEmptyAllowed)
                {
                    sValue = "";
                }
            }
            else if ((idx = IndexOf(rgsValues, choiceValue)) != -1)
            {
                // remove the choiceValue from the string.
                Debug.Assert(rgsValues.Length > 1);
                System.Text.StringBuilder sbValues = new System.Text.StringBuilder(sValue.Length);
                for (int i = 0; i < rgsValues.Length; ++i)
                {
                    if (idx != i)
                    {
                        if (sbValues.Length > 0)
                        {
                            sbValues.Append(",");
                        }
                        sbValues.Append(rgsValues[i]);
                    }
                }
                sValue = sbValues.ToString();
            }
            else
            {
                if (sValue.Length == 0)
                {
                    sValue = choiceValue;
                }
                else
                {
                    sValue = sValue + "," + choiceValue;
                }
            }
            propertyTable.SetProperty(propertyName, sValue, settingsGroup, true);
            propertyTable.SetPropertyPersistence(propertyName, false, settingsGroup);
        }
Exemplo n.º 5
0
		/// <summary>
		/// get the value for our virtual handler from the property table.
		/// </summary>
		/// <param name="pt"></param>
		/// <returns></returns>
		private string GetPropertyTableValue(PropertyTable pt)
		{
			if (pt == null)
				return null;
			return pt.GetStringProperty(m_propertyTableKey, null);
		}