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 (System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } 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 (System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } return(null); }