Ejemplo n.º 1
0
 /// <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;
     }
 }
Ejemplo n.º 2
0
 /// <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;
     }
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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 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 (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
        }
        public void OnEditCancelled(object sender, XmlConfigurationElementEventArgs e)
        {
            try
            {
                EventTracing.TraceMethodAndDelegate(this, this.EditCancelled);

                if (this.EditCancelled != null)
                {
                    this.EditCancelled(sender, e);
                }
            }
            catch (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
        }
Ejemplo n.º 7
0
        /// <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.Trace.WriteLine(XmlConfiguration.DescribeElementChanging(e));
            }
            catch (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
        }
Ejemplo n.º 8
0
        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 (System.Exception systemException)
            {
                System.Diagnostics.Trace.WriteLine(systemException);
            }
        }
		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(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
		}
		public void OnEditCancelled(object sender, XmlConfigurationElementEventArgs e)
		{
			try
			{
				EventTracing.TraceMethodAndDelegate(this, this.EditCancelled);

				if (this.EditCancelled != null)
					this.EditCancelled(sender, e);
			}
			catch(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
		}
		/// <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.Trace.WriteLine(XmlConfiguration.DescribeElementChanging(e));
			}
			catch(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
		}
		/// <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(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;
		}
		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(System.Exception systemException)
			{
				System.Diagnostics.Trace.WriteLine(systemException);
			}
		}