示例#1
0
        /// <summary>
        /// Raises the CannotWriteValue event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void OnCannotReadValue(object sender, XmlConfigurationReaderEventArgs e)
        {
            try
            {
                string message = string.Format("The value for the option '{0}' in the category '{1}' could not be read due to the following exception.\n\t{2}\n\tThe buffer contained '{3}' when the exception was thrown.", e.Option.ElementName, e.Option.Category, e.Exception, e.Buffer);
                Debug.WriteLine(message);
            }
            catch (Exception) {}

            try
            {
                if (this.CannotReadValue != null)
                {
                    this.CannotReadValue(sender, e);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
		/// <summary>
		/// Raises the CannotWriteValue event
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		protected virtual void OnCannotReadValue(object sender, XmlConfigurationReaderEventArgs e)
		{
			try
			{
				string message = string.Format("The value for the option '{0}' in the category '{1}' could not be read due to the following exception.\n\t{2}\n\tThe buffer contained '{3}' when the exception was thrown.", e.Option.ElementName, e.Option.Category, e.Exception, e.Buffer);
				Debug.WriteLine(message);
			}
			catch(Exception) {}

			try
			{			
				if (this.CannotReadValue != null)
					this.CannotReadValue(sender, e);
			}
			catch(Exception ex)
			{
				Debug.WriteLine(ex);
			}
		}