B2019-030 Use FlexableMesageBox instead of MessageBox so that it is always on top.

This commit is contained in:
2019-03-07 18:02:31 +00:00
parent 7e4770d76d
commit 17260519e3
25 changed files with 238 additions and 218 deletions

View File

@@ -8,6 +8,7 @@ using System.Windows.Forms;
using System.IO;
using System.Text.RegularExpressions;
using VEPROMS.CSLA.Library;
using JR.Utils.GUI.Forms;
namespace Volian.Controls.Library
{
@@ -415,16 +416,16 @@ namespace Volian.Controls.Library
// check that it is an image
System.Drawing.Image img = System.Drawing.Image.FromFile(openFileDialog1.FileName);
if (img != null)
{
FileName = openFileDialog1.FileName;
MyPictureBox.Image = img;
SetWidthsAndHeights(img);
_IsDirty = true;
}
{
FileName = openFileDialog1.FileName;
MyPictureBox.Image = img;
SetWidthsAndHeights(img);
_IsDirty = true;
}
}
catch (Exception ex)
{
MessageBox.Show("Could not create image, check file type.", "Error on Image File Selection");
FlexibleMessageBox.Show("Could not create image, check file type.", "Error on Image File Selection");
return;
}
}
@@ -547,7 +548,7 @@ namespace Volian.Controls.Library
catch (Exception ex)
{
string msg = string.Format("Could not display image {0}.", imgname);
MessageBox.Show(msg);
FlexibleMessageBox.Show(msg);
}
}
}
@@ -682,7 +683,7 @@ namespace Volian.Controls.Library
}
if (InsType == E_ImageSource.RoFigure && MyItemInfo.MyContent.MyImage == null) // on an RO image
{
MessageBox.Show("Cannot replace an existing RO figure/image. Use the Step Properties panel/RO tab.", "Warning, no paste/replace for RO images.");
FlexibleMessageBox.Show("Cannot replace an existing RO figure/image. Use the Step Properties panel/RO tab.", "Warning, no paste/replace for RO images.");
e.Handled = true;
return;
}
@@ -698,19 +699,19 @@ namespace Volian.Controls.Library
System.Drawing.Image img = Clipboard.GetImage();
if (img == null) // let user know there is no valid data in clipboard:
{
MessageBox.Show(this, "The clipboard does not contain image data.", "Cannot paste.", MessageBoxButtons.OK);
FlexibleMessageBox.Show(this, "The clipboard does not contain image data.", "Cannot paste.", MessageBoxButtons.OK);
return;
}
if (MyItemInfo.MyContent.MyImage != null && img != null) // see if there already is an image and if so - ask if user wants to replace.
{
if (MessageBox.Show(this, "Do you want to replace the existing image?", "Confirm Image Replace", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
if (FlexibleMessageBox.Show(this, "Do you want to replace the existing image?", "Confirm Image Replace", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
{
setdata = true;
setdata = true;
}
}
else if (MyItemInfo.MyContent.ContentRoUsageCount > 0 && img != null)
{
MessageBox.Show("Cannot replace an existing RO figure/image. Use the Step Properties panel/RO tab.", "Warning, no paste/replace for RO images.");
FlexibleMessageBox.Show("Cannot replace an existing RO figure/image. Use the Step Properties panel/RO tab.", "Warning, no paste/replace for RO images.");
return;
}
else if (img != null) // no existing image, be sure there is valid data in clipboard
@@ -806,7 +807,7 @@ namespace Volian.Controls.Library
byte[] cmp = ROImageInfo.Compress(imgToByte);
if (origLen > cmp.Length)
{
imgToByte = cmp;
imgToByte = cmp;
compressed = true;
}
}
@@ -835,8 +836,8 @@ namespace Volian.Controls.Library
imgCfg = new ImageConfig();
else if (imgCfg == null)
imgCfg = new ImageConfig(MyItemInfo.MyContent.MyImage);
imgCfg.Image_DataSize = origLen;
_MyItem.MyContent.MyImage.Config = imgCfg.ToString();
imgCfg.Image_DataSize = origLen;
_MyItem.MyContent.MyImage.Config = imgCfg.ToString();
}
_MyItem.MyContent.MyImage.Data = imgToByte;
_MyItem.MyContent.MyImage.FileName = FileName;
@@ -846,28 +847,28 @@ namespace Volian.Controls.Library
_MyItem.MyContent.DTS = DateTime.Now;
_MyItem.MyContent.UserID = Volian.Base.Library.VlnSettings.UserID;
_MyItem.Save();
}
StepConfig sc = MyItemInfo.MyConfig as StepConfig;
// if the plant has the change id option, the change id was entered when the program started.
// this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it.
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
}
// We saved changes. Reset the change bar override.
// IF there is a step config remove the change bar override by setting the CBOverride value to null
// This fixes a problem reported by Farly where if the change bar or overridden to be off, the next
// time a change was made, the change bar remained turned off.
if (sc != null)
sc.Step_CBOverride = null; // clear the change bar override
MyStepRTB.ClearUndo();
}
StepConfig sc = MyItemInfo.MyConfig as StepConfig;
// if the plant has the change id option, the change id was entered when the program started.
// this should be saved for every piece of edited data. Note that the set of config
// item Step_MultipleChangeID has the save built in to it.
if (MyItemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.ChangeBarData.ChangeIds
&& !this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.EditorialChange)
{
if (sc == null) sc = new StepConfig();
sc.Step_ChangeID = this.MyStepPanel.MyStepTabPanel.MyDisplayTabControl.ChgId;
}
// We saved changes. Reset the change bar override.
// IF there is a step config remove the change bar override by setting the CBOverride value to null
// This fixes a problem reported by Farly where if the change bar or overridden to be off, the next
// time a change was made, the change bar remained turned off.
if (sc != null)
sc.Step_CBOverride = null; // clear the change bar override
MyStepRTB.ClearUndo();
}
catch (Exception ex)
{
MessageBox.Show("The image could not be saved.", "Image Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
FlexibleMessageBox.Show("The image could not be saved.", "Image Save", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
_newSizeHt = 0;
@@ -906,7 +907,7 @@ namespace Volian.Controls.Library
ifmt = System.Drawing.Imaging.ImageFormat.Png;
break;
default:
MessageBox.Show("Invalid File Type");
FlexibleMessageBox.Show("Invalid File Type");
return null;
}
MemoryStream ms = new MemoryStream();
@@ -931,7 +932,7 @@ namespace Volian.Controls.Library
if (img != null)
{
// Ask user if they want to use the clipboard image.
DialogResult dr = MessageBox.Show("Clipboard has an image, use this (select Yes) or select a file (select No)?", "Insert Image Before/After", MessageBoxButtons.YesNo);
DialogResult dr = FlexibleMessageBox.Show("Clipboard has an image, use this (select Yes) or select a file (select No)?", "Insert Image Before/After", MessageBoxButtons.YesNo);
if (dr == DialogResult.Yes)
{
@@ -967,7 +968,7 @@ namespace Volian.Controls.Library
if (dr != DialogResult.Cancel)
{
string msg = string.Format("Could not display image {0}.", openFileDialog1.FileName);
MessageBox.Show(msg);
FlexibleMessageBox.Show(msg);
}
return; // user must have exited out or entered a bad filename.
}