コード例 #1
0
        //---------------------------------------------------------------------
        // ISettingsEditor.
        //---------------------------------------------------------------------

        public void ShowWindow(ISettingsObject settingsObject)
        {
            this.EditorObject = settingsObject;
            Show(this.dockPanel, DockState.DockRightAutoHide);
            this.dockPanel.ActiveAutoHideContent = this;
            Activate();
        }
コード例 #2
0
ファイル: SettingsBase.cs プロジェクト: formist/LinkMe
        /// <summary>
        /// Loads settings into an object that implements IXmlSettings. Returns true if settings were loaded,
        /// otherwise false.
        /// </summary>
        protected bool ReadSettingIntoObject(XmlNode xmlSection, XmlNamespaceManager xmlNsManager, string name,
                                             ISettingsObject settingsObject)
        {
            if (settingsObject == null)
            {
                return(false);
            }

            XmlNode xmlSetting = GetSetting(xmlSection, xmlNsManager, name, false);

            if (xmlSetting == null)
            {
                return(false);
            }

            try
            {
                settingsObject.ReadXmlSettings(xmlSetting, xmlNsManager, Prefix, m_currentFilePath);
            }
            catch (System.Exception ex)
            {
                throw new ApplicationException("Failed to load XML settings for a '"
                                               + settingsObject.GetType() + "' object.", ex);
            }

            return(true);
        }
コード例 #3
0
ファイル: DataGrid.cs プロジェクト: formist/LinkMe
            public bool SettingsEqual(ISettingsObject obj)
            {
                ColumnWidths other = obj as ColumnWidths;

                if (other == null)
                {
                    return(false);
                }

                if (m_columns.Count != other.m_columns.Count)
                {
                    return(false);
                }

                IDictionaryEnumerator enumerator = m_columns.GetEnumerator();

                while (enumerator.MoveNext())
                {
                    object otherValue = other.m_columns[enumerator.Key];
                    if (otherValue == null || (int)enumerator.Value != (int)otherValue)
                    {
                        return(false);
                    }
                }

                return(true);
            }
コード例 #4
0
ファイル: SettingsBase.cs プロジェクト: formist/LinkMe
        protected void WriteSetting(XmlWriter writer, string name, ISettingsObject value)
        {
            if (value == null)
            {
                return;
            }

            StartSetting(writer, name);
            value.WriteXmlSettingContents(writer, SettingsXmlNamespace, m_currentFilePath);
            EndSetting(writer);
        }
コード例 #5
0
ファイル: WindowSettings.cs プロジェクト: formist/LinkMe
        public bool SettingsEqual(ISettingsObject obj)
        {
            WindowSettings other = obj as WindowSettings;

            if (other == null)
            {
                return(false);
            }

            return(Height == other.Height && Width == other.Width && Left == other.Left && Top == other.Top &&
                   State == other.State);
        }
コード例 #6
0
ファイル: RecentlyUsedList.cs プロジェクト: formist/LinkMe
        public bool SettingsEqual(ISettingsObject obj)
        {
            RecentlyUsedList other = obj as RecentlyUsedList;

            if (other == null)
            {
                return(false);
            }

            return(StringCollectionsEqual(m_items, other.m_items) &&
                   StringCollectionsEqual(m_displayNames, other.m_displayNames));
        }
コード例 #7
0
        public virtual bool SettingsEqual(ISettingsObject obj)
        {
            ObjectBrowserSettings other = obj as ObjectBrowserSettings;

            if (other == null)
            {
                return(false);
            }

            return(ShowMembers == other.ShowMembers && ShowTypeCheckBoxes == other.ShowTypeCheckBoxes &&
                   ShowNonPublic == other.ShowNonPublic && TypeOrder == other.TypeOrder &&
                   MemberOrder == other.MemberOrder);
        }
コード例 #8
0
        //---------------------------------------------------------------------
        // Service event handlers.
        //---------------------------------------------------------------------

        private void OnProjectExplorerNodeSelected(ProjectExplorerNodeSelectedEvent e)
        {
            //
            // If the window is visible, switch to a different editor. Otherwise,
            // ignore the event.
            //
            if (this.Visible && e.SelectedNode is ISettingsObject settingsObject)
            {
                this.EditorObject = settingsObject;
            }
            else
            {
                this.EditorObject = null;
            }
        }
コード例 #9
0
        public override bool SettingsEqual(ISettingsObject obj)
        {
            if (!base.SettingsEqual(obj))
            {
                return(false);
            }

            NetBrowserSettings other = obj as NetBrowserSettings;

            if (other == null)
            {
                return(false);
            }

            return(Language == other.Language);
        }
コード例 #10
0
ファイル: SettingsBase.cs プロジェクト: formist/LinkMe
        /// <summary>
        /// Checks whether the settings have changed from their initial values.
        /// </summary>
        /// <returns>True if the settings have changed, otherwise false.</returns>
        /// <remarks>
        /// This method compares each of the values returned by GetInitialValues() to the current
        /// value for the same setting. If the setting value implements the <see cref="ISettingsObject"/>
        /// interface then the <see cref="ISettingsObject.SettingsEqual"/> is used to compare them,
        /// otherwise object.Equals() is used.
        /// </remarks>
        protected virtual bool HaveValuesChangedFromInitial()
        {
            // The names and values are assumed to stay constant, so we don't get the names again, but
            // need to get the initial values. Simply cloning the hashtable in the constructor may not
            // work for non-primitive types.

            Hashtable initialValues = CreateInitialSettingsDictionary();

            IDictionaryEnumerator enumerator = m_settingDictionary.GetEnumerator();

            while (enumerator.MoveNext())
            {
                Debug.Assert(initialValues.ContainsKey(enumerator.Key), string.Format(
                                 "The '{0}' setting class contains a setting named '{1}', which was not returned"
                                 + " by GetSettingNames().", GetType().FullName, enumerator.Key));

                object          initialValue    = initialValues[enumerator.Key];
                ISettingsObject initialSettings = initialValue as ISettingsObject;
                ISettingsObject currentSettings = enumerator.Value as ISettingsObject;

                // If the object implements ISettingsObject call it otherwise just use object equality.

                if (initialSettings != null && currentSettings != null)
                {
                    if (!initialSettings.SettingsEqual(currentSettings))
                    {
                        return(true);
                    }
                }
                else
                {
                    if (!object.Equals(initialValue, enumerator.Value))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #11
0
 public bool SettingsEqual(ISettingsObject obj)
 {
     // Not likely to be used any time soon, so just the objects are different for now.
     return(false);
 }
コード例 #12
0
        //---------------------------------------------------------------------
        // ISettingsEditor.
        //---------------------------------------------------------------------

        public void ShowWindow(ISettingsObject settingsObject)
        {
            this.EditorObject = settingsObject;
            ShowOrActivate(this.dockPanel, DockState.DockRightAutoHide);
        }