Change message confirmation dialogs from modal to async w/callback.

This commit is contained in:
kevinepope 2014-10-21 21:20:09 -07:00
parent b7da8de443
commit e936fe98f7
20 changed files with 158 additions and 98 deletions

View file

@ -186,23 +186,29 @@ namespace MatterHackers.MatterControl
{
UiThread.RunOnIdle((state) =>
{
StyledMessageBox.ShowMessageBox(ProcessDialogResponse, updateAvailableMessage, updateAvailableTitle, StyledMessageBox.MessageType.YES_NO, downloadNow, remindMeLater);
// show a dialog to tell the user there is an update
if (StyledMessageBox.ShowMessageBox(updateAvailableMessage, updateAvailableTitle, StyledMessageBox.MessageType.YES_NO, downloadNow, remindMeLater))
{
InitiateUpdateDownload();
// Switch to the about page so we can see the download progress.
GuiWidget aboutTabWidget = FindNamedWidgetRecursive(ApplicationController.Instance.MainView, "About Tab");
Tab aboutTab = aboutTabWidget as Tab;
if (aboutTab != null)
{
aboutTab.TabBarContaningTab.SelectTab(aboutTab);
}
}
});
}
}
}
void ProcessDialogResponse(bool messageBoxResponse)
{
if (messageBoxResponse)
{
InitiateUpdateDownload();
// Switch to the about page so we can see the download progress.
GuiWidget aboutTabWidget = FindNamedWidgetRecursive(ApplicationController.Instance.MainView, "About Tab");
Tab aboutTab = aboutTabWidget as Tab;
if (aboutTab != null)
{
aboutTab.TabBarContaningTab.SelectTab(aboutTab);
}
}
}
static GuiWidget FindNamedWidgetRecursive(GuiWidget root, string name)
{
foreach (GuiWidget child in root.Children)

View file

@ -264,11 +264,7 @@ namespace MatterHackers.MatterControl.ActionBar
ApplicationSettings.Instance.set("HideGCodeWarning", null);
}
};
if (!StyledMessageBox.ShowMessageBox(gcodeWarningMessage, "Warning GCode file".Localize(), new GuiWidget[] { hideGCodeWaringCheckBox }, StyledMessageBox.MessageType.YES_NO))
{
// the user selected 'no' they don't want to print the file
return;
}
StyledMessageBox.ShowMessageBox(onConfirmPrint, gcodeWarningMessage, "Warning - GCode file".Localize(), new GuiWidget[] { hideGCodeWaringCheckBox }, StyledMessageBox.MessageType.YES_NO);
}
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
@ -279,14 +275,30 @@ namespace MatterHackers.MatterControl.ActionBar
else
{
string message = String.Format(removeFromQueueMessage, pathAndFile);
if (StyledMessageBox.ShowMessageBox(message, itemNotFoundMessage, StyledMessageBox.MessageType.YES_NO))
{
QueueData.Instance.RemoveAt(queueDataView.SelectedIndex);
}
StyledMessageBox.ShowMessageBox(onRemoveMessageConfirm, message, itemNotFoundMessage, StyledMessageBox.MessageType.YES_NO);
}
}
}
void onConfirmPrint(bool messageBoxResponse)
{
if (!messageBoxResponse)
{
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
PrintItemWrapper partToPrint = PrinterConnectionAndCommunication.Instance.ActivePrintItem;
SlicingQueue.Instance.QueuePartForSlicing(partToPrint);
partToPrint.SlicingDone.RegisterEvent(partToPrint_SliceDone, ref unregisterEvents);
}
}
void onRemoveMessageConfirm(bool messageBoxResponse)
{
if (messageBoxResponse)
{
QueueData.Instance.RemoveAt(queueDataView.SelectedIndex);
}
}
void onStartButton_Click(object sender, MouseEventArgs mouseEvent)
{
UiThread.RunOnIdle((state) =>
@ -327,10 +339,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
if (timeSincePrintStarted.IsRunning && timeSincePrintStarted.ElapsedMilliseconds > (2 * 60 * 1000))
{
if (StyledMessageBox.ShowMessageBox(cancelCurrentPrintMessage, cancelCurrentPrintTitle, StyledMessageBox.MessageType.YES_NO))
{
CancelPrinting();
}
StyledMessageBox.ShowMessageBox(onConfirmCancelPrint, cancelCurrentPrintMessage, cancelCurrentPrintTitle, StyledMessageBox.MessageType.YES_NO);
}
else
{
@ -338,6 +347,14 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
void onConfirmCancelPrint(bool messageBoxResponse)
{
if (messageBoxResponse)
{
CancelPrinting();
}
}
void CancelConnectionButton_Click(object state)
{
CancelPrinting();

View file

@ -207,27 +207,28 @@ namespace MatterHackers.MatterControl.ActionBar
string disconnectAndCancelMessage = "Disconnect and cancel the current print?".Localize();
string disconnectAndCancelTitle = "WARNING: Disconnecting will cancel the current print.\n\nDo you want to disconnect?".Localize();
void OnIdleDisconnect(object state)
{
bool doCancel = true;
{
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
if (StyledMessageBox.ShowMessageBox(disconnectAndCancelMessage, disconnectAndCancelTitle, StyledMessageBox.MessageType.YES_NO))
{
PrinterConnectionAndCommunication.Instance.Stop();
}
else
{
doCancel = false;
}
StyledMessageBox.ShowMessageBox(onConfirmStopPrint, disconnectAndCancelMessage, disconnectAndCancelTitle, StyledMessageBox.MessageType.YES_NO);
}
if (doCancel)
else
{
PrinterConnectionAndCommunication.Instance.Disable();
selectActivePrinterButton.Invalidate();
}
}
void onConfirmStopPrint(bool messageBoxResponse)
{
if (messageBoxResponse)
{
PrinterConnectionAndCommunication.Instance.Stop();
PrinterConnectionAndCommunication.Instance.Disable();
selectActivePrinterButton.Invalidate();
}
}
void SetConnectionButtonVisibleState(object state)
{

View file

@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.ActionBar
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
{
string message = string.Format(waitingForBedToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, waitingForBedToHeatTitle);
StyledMessageBox.ShowMessageBox(null, message, waitingForBedToHeatTitle);
}
else
{

View file

@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.ActionBar
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1))
{
string message = string.Format(waitingForeExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1), sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, waitingForeExtruderToHeatTitle);
StyledMessageBox.ShowMessageBox(null, message, waitingForeExtruderToHeatTitle);
}
else
{

View file

@ -177,7 +177,7 @@ namespace MatterHackers.MatterControl
if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
StyledMessageBox.ShowMessageBox(cannotExitWhileActiveMessage, cannotExitWhileActiveTitle);
StyledMessageBox.ShowMessageBox(null, cannotExitWhileActiveMessage, cannotExitWhileActiveTitle);
}
else
{

View file

@ -274,7 +274,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
UiThread.RunOnIdle( (state) =>
{
StyledMessageBox.ShowMessageBox(zIsTooLowMessage, zTooLowTitle, StyledMessageBox.MessageType.OK);
StyledMessageBox.ShowMessageBox(null, zIsTooLowMessage, zTooLowTitle, StyledMessageBox.MessageType.OK);
});
// don't move the bed lower it will not work when we print.
return;

View file

@ -443,7 +443,7 @@ namespace MatterHackers.MatterControl
static EePromMarlinWidget openEePromMarlinWidget = null;
static EePromRepetierWidget openEePromRepetierWidget = null;
string noEepromMappingMessage = "Oops! There is no eeprom mapping for your printer's firmware.".Localize();
string noEepromMappingTitle = "Warning no eeprom mapping".Localize();
string noEepromMappingTitle = "Warning - No EEProm Mapping".Localize();
string groupBoxTitle = "EEProm Settings".Localize();
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout)
{
@ -508,7 +508,7 @@ namespace MatterHackers.MatterControl
default:
UiThread.RunOnIdle((state) =>
{
StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
StyledMessageBox.ShowMessageBox(null, noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
}
);
break;

View file

@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
static EePromMarlinWidget openEePromMarlinWidget = null;
static EePromRepetierWidget openEePromRepetierWidget = null;
string noEepromMappingMessage = "Oops! There is no eeprom mapping for your printer's firmware.".Localize();
string noEepromMappingTitle = "Warning no eeprom mapping".Localize();
string noEepromMappingTitle = "Warning - No EEProm Mapping".Localize();
string groupBoxTitle = "EEProm Settings".Localize();
private FlowLayoutWidget GetEEPromControl()
{
@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
break;
default:
StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
StyledMessageBox.ShowMessageBox(null, noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
break;
}
#endif

View file

@ -17,28 +17,29 @@ namespace MatterHackers.MatterControl
String unwrappedMessage;
TextWidget messageContainer;
FlowLayoutWidget middleRowContainer;
public EventHandler ClickedOk;
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
public delegate void MessageBoxDelegate(bool response);
MessageBoxDelegate responseCallback;
public enum MessageType { OK, YES_NO };
public static bool ShowMessageBox(String message, string caption, MessageType messageType = MessageType.OK, string yesOk = "", string no = "")
public static void ShowMessageBox(MessageBoxDelegate callback, String message, string caption, MessageType messageType = MessageType.OK, string yesOk = "", string no = "")
{
return ShowMessageBox(message, caption, null, messageType, yesOk, no);
ShowMessageBox(callback, message, caption, null, messageType, yesOk, no);
}
public static bool ShowMessageBox(string message, string caption, GuiWidget[] extraWidgetsToAdd, MessageType messageType, string yesOk = "", string no = "")
public static void ShowMessageBox(MessageBoxDelegate callback, string message, string caption, GuiWidget[] extraWidgetsToAdd, MessageType messageType, string yesOk = "", string no = "")
{
StyledMessageBox messageBox = new StyledMessageBox(message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, no);
bool okClicked = false;
messageBox.ClickedOk += (sender, e) => { okClicked = true; };
StyledMessageBox messageBox = new StyledMessageBox(callback, message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, no);
messageBox.ShowAsSystemWindow();
return okClicked;
}
public StyledMessageBox(String message, string windowTitle, MessageType messageType, GuiWidget[] extraWidgetsToAdd, double width, double height, string yesOk, string no)
public StyledMessageBox(MessageBoxDelegate callback, String message, string windowTitle, MessageType messageType, GuiWidget[] extraWidgetsToAdd, double width, double height, string yesOk, string no)
: base(width, height)
{
responseCallback = callback;
unwrappedMessage = message;
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
topToBottom.AnchorAll();
@ -182,17 +183,22 @@ namespace MatterHackers.MatterControl
}
void noButton_Click(object sender, MouseEventArgs mouseEvent)
{
{
UiThread.RunOnIdle(CloseOnIdle);
if (responseCallback != null)
{
responseCallback(false);
}
}
void okButton_Click(object sender, MouseEventArgs mouseEvent)
{
if (ClickedOk != null)
{
ClickedOk(this, null);
}
UiThread.RunOnIdle(CloseOnIdle);
if (responseCallback != null)
{
responseCallback(true);
}
}
void CloseOnIdle(object state)

View file

@ -272,7 +272,7 @@ namespace MatterHackers.MatterControl.DataStorage
GenerateSampleData sampleData = new GenerateSampleData();
}
else
{
{
ValidateSchema();
}
StartSession();

View file

@ -373,24 +373,29 @@ namespace MatterHackers.MatterControl
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
StyledMessageBox.ShowMessageBox(unableToExitMessage, unableToExitTitle);
StyledMessageBox.ShowMessageBox(null, unableToExitMessage, unableToExitTitle);
CancelClose = true;
}
else if (PartsSheet.IsSaving())
{
if (!StyledMessageBox.ShowMessageBox(savePartsSheetExitAnywayMessage, confirmExit, StyledMessageBox.MessageType.YES_NO))
{
CancelClose = true;
}
else
{
base.OnClosing(out CancelClose);
}
StyledMessageBox.ShowMessageBox(onConfirmExit, savePartsSheetExitAnywayMessage, confirmExit, StyledMessageBox.MessageType.YES_NO);
CancelClose = true;
}
else
{
base.OnClosing(out CancelClose);
}
}
bool cancelClose;
void onConfirmExit(bool messageBoxResponse)
{
bool CancelClose;
if (messageBoxResponse)
{
base.OnClosing(out CancelClose);
}
}
}
}

View file

@ -1693,11 +1693,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
catch (System.UnauthorizedAccessException)
{
//Do something special when unauthorized?
StyledMessageBox.ShowMessageBox("Oops! Unable to save changes.", "Unable to save");
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
}
catch
{
StyledMessageBox.ShowMessageBox("Oops! Unable to save changes.", "Unable to save");
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
}
}

View file

@ -314,6 +314,7 @@ namespace MatterHackers.MatterControl.PrintHistory
public void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
{
itemToRemove = printItemWrapper;
UiThread.RunOnIdle((state) =>
{
string maxLengthName = printItemWrapper.FileLocation;
@ -328,12 +329,18 @@ namespace MatterHackers.MatterControl.PrintHistory
string notFoundMessage = LocalizedString.Get("Oops! Could not find this file:");
string message = "{0}:\n'{1}'".FormatWith(notFoundMessage, maxLengthName);
string titleLabel = LocalizedString.Get("Item not Found");
if (StyledMessageBox.ShowMessageBox(message, titleLabel, StyledMessageBox.MessageType.OK))
{
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(printItemWrapper));
}
StyledMessageBox.ShowMessageBox(onConfirmRemove, message, titleLabel, StyledMessageBox.MessageType.OK);
});
}
PrintItemWrapper itemToRemove;
void onConfirmRemove(bool messageBoxResponse)
{
if (messageBoxResponse)
{
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(itemToRemove));
}
}
PartPreviewMainWindow partPreviewWindow;
private void OpenPartPreviewWindow(PrintItem printItem, View3DWidget.AutoRotate autoRotate)

View file

@ -383,10 +383,15 @@ namespace MatterHackers.MatterControl.PrintLibrary
else
{
string message = String.Format("Cannot find\n'{0}'.\nWould you like to remove it from the library?", pathAndFile);
if (StyledMessageBox.ShowMessageBox(message, "Item not found", StyledMessageBox.MessageType.YES_NO))
{
libraryDataView.RemoveChild(this);
}
StyledMessageBox.ShowMessageBox(null, message, "Item not found", StyledMessageBox.MessageType.YES_NO);
}
}
void onConfirmRemove(bool messageBoxResponse)
{
if (messageBoxResponse)
{
libraryDataView.RemoveChild(this);
}
}

View file

@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl.PrintQueue
string pleaseSelectPrinterTitle = "Please select a printer";
void MustSelectPrinterMessage(object state)
{
StyledMessageBox.ShowMessageBox(pleaseSelectPrinterMessage, pleaseSelectPrinterTitle);
StyledMessageBox.ShowMessageBox(null, pleaseSelectPrinterMessage, pleaseSelectPrinterTitle);
}
bool exportGCodeToFolderButton_Click()

View file

@ -517,11 +517,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{
if (PrintItemWrapper.PrintItem.FileLocation == QueueData.SdCardFileName)
{
if (StyledMessageBox.ShowMessageBox(alsoRemoveFromSdCardMessage, alsoRemoveFromSdCardTitle, StyledMessageBox.MessageType.YES_NO))
{
// The firmware only understands the names when lowercase.
PrinterConnectionAndCommunication.Instance.DeleteFileFromSdCard(PrintItemWrapper.PrintItem.Name);
}
StyledMessageBox.ShowMessageBox(onDeleteFileConfirm, alsoRemoveFromSdCardMessage, alsoRemoveFromSdCardTitle, StyledMessageBox.MessageType.YES_NO);
}
int thisIndexInQueue = QueueData.Instance.GetIndex(PrintItemWrapper);
@ -529,8 +525,18 @@ namespace MatterHackers.MatterControl.PrintQueue
}
void onDeleteFileConfirm(bool messageBoxResponse)
{
if (messageBoxResponse)
{
// The firmware only understands the names when lowercase.
PrinterConnectionAndCommunication.Instance.DeleteFileFromSdCard(PrintItemWrapper.PrintItem.Name);
}
}
public static void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
{
itemToRemove = printItemWrapper;
UiThread.RunOnIdle((state) =>
{
string maxLengthName = printItemWrapper.FileLocation;
@ -546,13 +552,20 @@ namespace MatterHackers.MatterControl.PrintQueue
string notFoundMessageEnd = LocalizedString.Get("Would you like to remove it from the queue");
string message = "{0}:\n'{1}'\n\n{2}?".FormatWith(notFoundMessage, maxLengthName,notFoundMessageEnd);
string titleLabel = LocalizedString.Get("Item not Found");
if (StyledMessageBox.ShowMessageBox(message, titleLabel, StyledMessageBox.MessageType.YES_NO))
{
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(printItemWrapper));
}
StyledMessageBox.ShowMessageBox(onConfirmRemove, message, titleLabel, StyledMessageBox.MessageType.YES_NO);
});
}
static PrintItemWrapper itemToRemove;
static void onConfirmRemove(bool messageBoxResponse)
{
if (messageBoxResponse)
{
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(itemToRemove));
}
}
public void ThemeChanged(object sender, EventArgs e)
{
if (this.isActivePrint)

View file

@ -525,7 +525,7 @@ namespace MatterHackers.MatterControl
{
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";
string message = string.Format("The extruder is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting extruder temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based), sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, "Waiting For Extruder To Heat");
StyledMessageBox.ShowMessageBox(null, message, "Waiting For Extruder To Heat");
}
else
{
@ -620,7 +620,7 @@ namespace MatterHackers.MatterControl
{
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";
string message = string.Format("The bed is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting bed temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, "Waiting For Bed To Heat");
StyledMessageBox.ShowMessageBox(null, message, "Waiting For Bed To Heat");
}
else
{

View file

@ -747,7 +747,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = LocalizedString.Get("'Layer Height' must be less than or equal to the 'Nozzle Diameter'.");
string details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter);
string location = LocalizedString.Get("Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'");
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}
else if (FirstLayerHeight > NozzleDiameter)
@ -755,7 +755,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = LocalizedString.Get("First Layer Height' must be less than or equal to the 'Nozzle Diameter'.");
string details = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}", FirstLayerHeight, NozzleDiameter);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}
@ -764,7 +764,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = LocalizedString.Get("First Layer Extrusion Width' must be less than or equal to the 'Nozzle Diameter' * 4.");
string details = string.Format("First Layer Extrusion Width = {0}\nNozzle Diameter = {1}", GetActiveValue("first_layer_extrusion_width"), NozzleDiameter);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Advanced' -> 'Frist Layer'";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}
@ -773,7 +773,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = "The Min Fan Speed can only go as high as 100%.";
string details = string.Format("It is currently set to {0}.", MinFanSpeed);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Filament' -> 'Cooling' (show all settings)";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}
@ -782,7 +782,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = "The Max Fan Speed can only go as high as 100%.";
string details = string.Format("It is currently set to {0}.", MaxFanSpeed);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Filament' -> 'Cooling' (show all settings)";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}
if (FillDensity < 0 || FillDensity > 1)
@ -790,7 +790,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = "The Fill Density must be between 0 and 1 inclusive.";
string details = string.Format("It is currently set to {0}.", FillDensity);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Infill'";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}
@ -840,7 +840,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string error = string.Format("The '{0}' must be greater than 0.", SliceSettingsOrganizer.Instance.GetSettingsData(speedSetting).PresentationName);
string details = string.Format("It is currently set to {0}.", actualSpeedValueString);
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Speed'";
StyledMessageBox.ShowMessageBox(string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
StyledMessageBox.ShowMessageBox(null, string.Format("{0}\n\n{1}\n\n{2}", error, details, location), "Slice Error");
return false;
}

View file

@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl
string fileNameOnly = Path.GetFileName(item.FileLocation);
if (addedFileNames.Contains(fileNameOnly))
{
StyledMessageBox.ShowMessageBox(string.Format("Duplicate file name found but in a different folder '{0}'. This part will not be added to the collection.\n\n{1}", fileNameOnly, item.FileLocation), "Duplicate File");
StyledMessageBox.ShowMessageBox(null, string.Format("Duplicate file name found but in a different folder '{0}'. This part will not be added to the collection.\n\n{1}", fileNameOnly, item.FileLocation), "Duplicate File");
continue;
}