/// <summary> /// Handles the <see cref="PluginManagerVM.ImportSucceeded"/> event of the view model. /// </summary> /// <remarks> /// This displays a simple success message. /// </remarks> /// <param name="sender">The object that raised the event.</param> /// <param name="e">An <see cref="EventArgs{String}"/> describing the event arguments.</param> private void ViewModel_ImportSucceeded(object sender, ImportSucceededEventArgs e) { if (InvokeRequired) { Invoke((Action <object, ImportSucceededEventArgs>)ViewModel_ImportSucceeded, sender, e); return; } System.Text.StringBuilder sbMessage = new System.Text.StringBuilder(); string strDetails; sbMessage.Append("The load order was successfully imported from"); FormatPluginCountsReport(e, ref sbMessage, out strDetails); ExtendedMessageBox.Show(this, sbMessage.ToString(), ViewModel.Settings.ModManagerName, strDetails, ExtendedMessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// Formats the text to display when importing a load order succeeds. /// </summary> /// <param name="p_iseEventArgs">An <see cref="ImportSucceededEventArgs"/> describing the event arguments.</param> /// <param name="p_sbMessage">The formatted success message.</param> /// <param name="p_strDetails">The names of the plugins that were not imported.</param> private void FormatPluginCountsReport(ImportSucceededEventArgs p_iseEventArgs, ref System.Text.StringBuilder p_sbMessage, out string p_strDetails) { if (string.IsNullOrEmpty(p_iseEventArgs.Filename)) { p_sbMessage.AppendLine(" the clipboard."); } else { p_sbMessage.AppendLine(":"); p_sbMessage.AppendLine(); p_sbMessage.AppendLine(); p_sbMessage.AppendLine(p_iseEventArgs.Filename); } p_sbMessage.AppendLine(); if (p_iseEventArgs.TotalPluginCount == 1) { p_sbMessage.AppendLine("- 1 plugin found in the import source"); } else { p_sbMessage.AppendFormat("- {0} plugins found in the import source", p_iseEventArgs.TotalPluginCount).AppendLine(); } if (p_iseEventArgs.ImportedPluginCount == 1) { p_sbMessage.AppendLine("- 1 plugin successfully imported"); } else { p_sbMessage.AppendFormat("- {0} plugin(s) successfully imported", p_iseEventArgs.ImportedPluginCount).AppendLine(); } if (p_iseEventArgs.PluginsNotImported.Count == 1) { p_sbMessage.AppendLine("- 1 plugin not imported (not managed)"); } else { p_sbMessage.AppendFormat("- {0} plugins not imported (not managed)", p_iseEventArgs.PluginsNotImported.Count).AppendLine(); } System.Text.StringBuilder sbDetails = new System.Text.StringBuilder(); foreach (string strPluginFilename in p_iseEventArgs.PluginsNotImported) { sbDetails.AppendFormat("- {0}", strPluginFilename).AppendLine(); } if (sbDetails.Length > 0) { sbDetails.Insert(0, "The following plugin(s) were not imported: " + Environment.NewLine); } if (sbDetails.Length > 0) { p_strDetails = sbDetails.ToString(); } else { p_strDetails = null; } }
/// <summary> /// Handles the <see cref="PluginManagerVM.ImportSucceeded"/> event of the view model. /// </summary> /// <remarks> /// This displays a simple success message. /// </remarks> /// <param name="sender">The object that raised the event.</param> /// <param name="e">An <see cref="EventArgs{String}"/> describing the event arguments.</param> private void ViewModel_ImportSucceeded(object sender, ImportSucceededEventArgs e) { if (InvokeRequired) { Invoke((Action<object, ImportSucceededEventArgs>)ViewModel_ImportSucceeded, sender, e); return; } System.Text.StringBuilder sbMessage = new System.Text.StringBuilder(); string strDetails; sbMessage.Append("The load order was successfully imported from"); FormatPluginCountsReport(e, ref sbMessage, out strDetails); ExtendedMessageBox.Show(this, sbMessage.ToString(), ViewModel.Settings.ModManagerName, strDetails, ExtendedMessageBoxButtons.OK, MessageBoxIcon.Information); }
/// <summary> /// Formats the text to display when importing a load order succeeds. /// </summary> /// <param name="p_iseEventArgs">An <see cref="ImportSucceededEventArgs"/> describing the event arguments.</param> /// <param name="p_sbMessage">The formatted success message.</param> /// <param name="p_strDetails">The names of the plugins that were not imported.</param> private void FormatPluginCountsReport(ImportSucceededEventArgs p_iseEventArgs, ref System.Text.StringBuilder p_sbMessage, out string p_strDetails) { if (string.IsNullOrEmpty(p_iseEventArgs.Filename)) p_sbMessage.AppendLine(" the clipboard."); else { p_sbMessage.AppendLine(":"); p_sbMessage.AppendLine(); p_sbMessage.AppendLine(); p_sbMessage.AppendLine(p_iseEventArgs.Filename); } p_sbMessage.AppendLine(); if (p_iseEventArgs.TotalPluginCount == 1) p_sbMessage.AppendLine("- 1 plugin found in the import source"); else p_sbMessage.AppendFormat("- {0} plugins found in the import source", p_iseEventArgs.TotalPluginCount).AppendLine(); if (p_iseEventArgs.ImportedPluginCount == 1) p_sbMessage.AppendLine("- 1 plugin successfully imported"); else p_sbMessage.AppendFormat("- {0} plugin(s) successfully imported", p_iseEventArgs.ImportedPluginCount).AppendLine(); if (p_iseEventArgs.PluginsNotImported.Count == 1) p_sbMessage.AppendLine("- 1 plugin not imported (not managed)"); else p_sbMessage.AppendFormat("- {0} plugins not imported (not managed)", p_iseEventArgs.PluginsNotImported.Count).AppendLine(); System.Text.StringBuilder sbDetails = new System.Text.StringBuilder(); foreach (string strPluginFilename in p_iseEventArgs.PluginsNotImported) sbDetails.AppendFormat("- {0}", strPluginFilename).AppendLine(); if (sbDetails.Length > 0) sbDetails.Insert(0, "The following plugin(s) were not imported: " + Environment.NewLine); if (sbDetails.Length > 0) p_strDetails = sbDetails.ToString(); else p_strDetails = null; }