/// <summary> /// Class constructor /// </summary> /// <param name="conflicts">The list of file conflicts.</param> public OverwriteWarningsForm(OverwriteWarningCollection warnings, bool fatal, OverwriteWarningType type) { // // Required for Windows Form Designer support // InitializeComponent(); pictureBox.Image = SystemIcons.Exclamation.ToBitmap(); // There appears to be a bug in the 1.0 version of the framework. On my // 3.2ghz machine, if listBox.Items.Add(conflict) is placed in the // foreach array it hangs, unless you slow it down somehow. Moving // the add outside the loop and changing it to an AddRange() to add all // of the conflicts in one shot makes it work correctly, thus the change // to the code. // Add all of the conflicts to the list box. ListViewItem[] items = new ListViewItem[warnings.Count]; for (int i = 0; i < warnings.Count; i++) items[i] = new ListViewItem(new String[] { warnings[i].Replacer, warnings[i].File, warnings[i].Source }); listView.Items.AddRange(items); // Load the appropriate prompt text. labelPrompt.Text = StringResources.GetString(type.ToString()); // If we have fatal errors then turn off the continue button, the user // can only cancel. if (fatal) buttonContinue.Enabled = false; }
/// <summary> /// This method should ask the user for confirmation of overwriting /// the listed files. If fatal is true then there is no confirmation, /// it is just an informational message that the operation must be aborted. /// </summary> /// <param name="warnings">The list of warnings</param> /// <param name="fatal">True if the warnings are fatal</param> /// <param name="type">The type of overwrite being confirmed</param> /// <returns>True if the operation should proceed</returns> bool IHakInstallProgress.ShouldOverwrite(OverwriteWarningCollection warnings, bool fatal, OverwriteWarningType type) { return true; }
/// <summary> /// This method should ask the user for confirmation of overwriting /// the listed files. If fatal is true then there is no confirmation, /// it is just an informational message that the operation must be aborted. /// </summary> /// <param name="warnings">The list of warnings</param> /// <param name="fatal">True if the warnings are fatal</param> /// <param name="type">The type of overwrite being confirmed</param> /// <returns>True if the operation should proceed</returns> bool IHakInstallProgress.ShouldOverwrite(OverwriteWarningCollection warnings, bool fatal, OverwriteWarningType type) { OverwriteWarningsForm form = new OverwriteWarningsForm(warnings, fatal, type); return DialogResult.OK == form.ShowDialog((Form) this); }