public virtual void OnChanged(object sender, XmlConfigurationElementEventArgs e) { try { // no events during initialization or editing if (_isBeingInitialized /*|| _isBeingEdited */) { return; } // are we ourselves changing? if not then our sub options and sub categories don't change us!!! if (string.Compare(this.Fullpath, e.Element.Fullpath, true) == 0) { _hasChanges = true; } //EventTracing.TraceMethodAndDelegate(this, this.Changed); if (this.Changed != null) { this.Changed(sender, e); } } catch (Exception ex) { Debug.WriteLine(ex); } }
/// <summary> /// Occurs when a change is made to a configuration thru the XmlConfigurationView /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnConfigurationChanged(object sender, XmlConfigurationElementEventArgs e) { if (e.Element.IsBeingEdited) { _buttonApply.Enabled = true; } }
/// <summary> /// Occurs when a category has changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Categories_Changed(object sender, XmlConfigurationElementEventArgs e) { if (!e.Element.IsBeingEdited) { _hasUnpersistedChanges = true; } }
public static string DescribeElementCancellingEdit(XmlConfigurationElementEventArgs e) { try { string elementType = null; XmlConfigurationElementTypes et = e.Element.GetElementType(); switch (et) { case XmlConfigurationElementTypes.XmlConfiguration: elementType = "configuration"; break; case XmlConfigurationElementTypes.XmlConfigurationCategory: elementType = "category"; break; case XmlConfigurationElementTypes.XmlConfigurationElement: elementType = "element"; break; case XmlConfigurationElementTypes.XmlConfigurationOption: elementType = "option"; break; } ; return(string.Format("The {0} '{1}' has cancelled edit mode at {2} on {3}. The current user is {4}.", elementType, e.Element.Fullpath, DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString(), System.Environment.UserName)); } catch (Exception ex) { Debug.WriteLine(ex); } return(null); }
public static string DescribeElementChanging(XmlConfigurationElementEventArgs e) { try { string elementType = null; XmlConfigurationElementTypes et = e.Element.GetElementType(); switch (et) { case XmlConfigurationElementTypes.XmlConfiguration: elementType = "configuration"; break; case XmlConfigurationElementTypes.XmlConfigurationCategory: elementType = "category"; break; case XmlConfigurationElementTypes.XmlConfigurationElement: elementType = "element"; break; case XmlConfigurationElementTypes.XmlConfigurationOption: elementType = "option"; break; } ; return(string.Format("The {5} '{0}' was '{1}' in the '{2}' configuration at {3} on {4}. The {5} is{6}being edited. The current user is {7}.", e.Element.Fullpath, e.Action.ToString(), e.Element.Configuration.DisplayName, DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString(), elementType, (e.Element.IsBeingEdited ? " " : " not "), System.Environment.UserName)); } catch (Exception ex) { Debug.WriteLine(ex); } return(null); }
public void OnEditCancelled(object sender, XmlConfigurationElementEventArgs e) { try { //EventTracing.TraceMethodAndDelegate(this, this.EditCancelled); if (this.EditCancelled != null) { this.EditCancelled(sender, e); } } catch (Exception ex) { Debug.WriteLine(ex); } }
/// <summary> /// Occurs when a configuration changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnConfigurationChanged(object sender, XmlConfigurationElementEventArgs e) { try { if (this.ConfigurationChanged != null) { this.ConfigurationChanged(sender, e); } // System.Diagnostics.Debug.WriteLine(XmlConfiguration.DescribeElementChanging(e)); } catch (Exception ex) { Debug.WriteLine(ex); } }
public void OnChanged(object sender, XmlConfigurationElementEventArgs e) { try { if (_isBeingInitialized) { return; } _hasChanges = true; //EventTracing.TraceMethodAndDelegate(this, this.Changed); if (this.Changed != null) { this.Changed(sender, e); } } catch (Exception ex) { Debug.WriteLine(ex); } }
public void OnChanged(object sender, XmlConfigurationElementEventArgs e) { try { // no events during initialization if (_isBeingInitialized) return; _hasChanges = true; //EventTracing.TraceMethodAndDelegate(this, this.Changed); if (this.Changed != null) this.Changed(sender, e); } catch(Exception ex) { Debug.WriteLine(ex); } }
public void OnEditCancelled(object sender, XmlConfigurationElementEventArgs e) { try { //EventTracing.TraceMethodAndDelegate(this, this.EditCancelled); if (this.EditCancelled != null) this.EditCancelled(sender, e); } catch(Exception ex) { Debug.WriteLine(ex); } }
/// <summary> /// Monitors the all users configuration for changes to the AutoUpdate options. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void HandleConfigurationChanged(object sender, XmlConfigurationElementEventArgs e) { // bail if the element is being edited if (e.Element.IsBeingEdited) return; // we only care about options if (e.Element.GetElementType() == XmlConfigurationElementTypes.XmlConfigurationOption) { string[] optionNames = Enum.GetNames(typeof(AutoUpdateOptionNames)); foreach (string name in optionNames) { string fullPath = string.Format("{0}\\{1}\\{2}", AllUsersConfigurationProvider.Current.ConfigurationName, ConfigurationCategoryName, name); if (string.Compare(e.Element.Fullpath, fullPath, true) == 0) { AutoUpdateOptionNames optionName = (AutoUpdateOptionNames)Enum.Parse(typeof(AutoUpdateOptionNames), name); try { this.BeginInit(); XmlConfigurationOption option = (XmlConfigurationOption)e.Element; // read the value back out into our copy switch (optionName) { case AutoUpdateOptionNames.AutomaticallyCheckForUpdates: this.AutomaticallyCheckForUpdates = Convert.ToBoolean(option.Value); break; case AutoUpdateOptionNames.AutomaticallyDownloadUpdates: this.AutomaticallyDownloadUpdates = Convert.ToBoolean(option.Value); break; case AutoUpdateOptionNames.AutomaticallyInstallUpdates: this.AutomaticallyInstallUpdates = Convert.ToBoolean(option.Value); break; case AutoUpdateOptionNames.AutomaticallySwitchToNewVersion: this.AutomaticallySwitchToNewVersion = Convert.ToBoolean(option.Value); break; case AutoUpdateOptionNames.AutomaticallyUpdateAlternatePath: this.AutomaticallyUpdateAlternatePath = Convert.ToBoolean(option.Value); break; case AutoUpdateOptionNames.AlternatePath: this.AlternatePath = Convert.ToString(option.Value); break; case AutoUpdateOptionNames.WebServiceUrl: this.WebServiceUrl = Convert.ToString(option.Value); break; }; } catch (Exception ex) { Debug.WriteLine(ex); } finally { this.EndInit(); } // raise the changed event to signal that this option was changed EventManager.Raise<AutoUpdateOptionsEventArgs>(this.Changed, this, new AutoUpdateOptionsEventArgs(this, optionName)); break; } } } }
public virtual void OnChanged(object sender, XmlConfigurationElementEventArgs e) { try { // no events during initialization or editing if (_isBeingInitialized/*|| _isBeingEdited */) return; // are we ourselves changing? if not then our sub options and sub categories don't change us!!! if (string.Compare(this.Fullpath, e.Element.Fullpath, true) == 0) { _hasChanges = true; } //EventTracing.TraceMethodAndDelegate(this, this.Changed); if (this.Changed != null) this.Changed(sender, e); } catch(Exception ex) { Debug.WriteLine(ex); } }
/// <summary> /// Occurs when a change is made to a configuration thru the XmlConfigurationView /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnConfigurationChanged(object sender, XmlConfigurationElementEventArgs e) { if (e.Element.IsBeingEdited) _buttonApply.Enabled = true; }
/// <summary> /// Occurs when a configuration changes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnConfigurationChanged(object sender, XmlConfigurationElementEventArgs e) { try { if (this.ConfigurationChanged != null) this.ConfigurationChanged(sender, e); // System.Diagnostics.Debug.WriteLine(XmlConfiguration.DescribeElementChanging(e)); } catch(Exception ex) { Debug.WriteLine(ex); } }