An event arguments class that indicates that an import operation failed.
Inheritance: System.EventArgs
Ejemplo n.º 1
0
        /// <summary>
        /// Handles the <see cref="PluginManagerVM.ImportFailed"/> event of the view model.
        /// </summary>
        /// <remarks>
        /// This displays a simple error message.
        /// </remarks>
        /// <param name="sender">The object that raised the event.</param>
        /// <param name="e">An <see cref="ImportFailedEventArgs"/> describing the event arguments.</param>
        private void ViewModel_ImportFailed(object sender, ImportFailedEventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke((Action <object, ImportFailedEventArgs>)ViewModel_ImportFailed, sender, e);
                return;
            }

            BeginInvoke(new MethodInvoker(() =>
            {
                if (string.IsNullOrEmpty(e.Filename))
                {
                    Trace.TraceError("Failed to import the load order from the clipboard.");
                }
                else
                {
                    Trace.TraceError("Failed to import the load order from: {0}", e.Filename);
                }
                Trace.Indent();
                Trace.TraceError("Reason: {0}", e.Message);
                if (e.Error != null)
                {
                    TraceUtil.TraceException(e.Error);
                }
                Trace.Unindent();
            }));

            string message
                = "An error was encountered while trying to import the load order." + Environment.NewLine
                  + Environment.NewLine
                  + e.Message + Environment.NewLine;

            ExtendedMessageBox.Show(this, message, Application.ProductName, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
		/// <summary>
		/// Handles the <see cref="PluginManagerVM.ImportFailed"/> event of the view model.
		/// </summary>
		/// <remarks>
		/// This displays a simple error message.
		/// </remarks>
		/// <param name="sender">The object that raised the event.</param>
		/// <param name="e">An <see cref="ImportFailedEventArgs"/> describing the event arguments.</param>
		private void ViewModel_ImportFailed(object sender, ImportFailedEventArgs e)
		{
			if (InvokeRequired)
			{
				Invoke((Action<object, ImportFailedEventArgs>)ViewModel_ImportFailed, sender, e);
				return;
			}

			BeginInvoke(new MethodInvoker(() =>
			{
				if (string.IsNullOrEmpty(e.Filename))
					Trace.TraceError("Failed to import the load order from the clipboard.");
				else
					Trace.TraceError("Failed to import the load order from: {0}", e.Filename);
				Trace.Indent();
				Trace.TraceError("Reason: {0}", e.Message);
				if (e.Error != null)
					TraceUtil.TraceException(e.Error);
				Trace.Unindent();
			}));

			string message
				= "An error was encountered while trying to import the load order." + Environment.NewLine
				+ Environment.NewLine
				+ e.Message + Environment.NewLine;
			ExtendedMessageBox.Show(this, message, Application.ProductName, null, MessageBoxButtons.OK, MessageBoxIcon.Error);
		}