Change message confirmation dialogs from modal to async w/callback.
This commit is contained in:
parent
b7da8de443
commit
e936fe98f7
20 changed files with 158 additions and 98 deletions
|
|
@ -186,23 +186,29 @@ namespace MatterHackers.MatterControl
|
||||||
{
|
{
|
||||||
UiThread.RunOnIdle((state) =>
|
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
|
// 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)
|
static GuiWidget FindNamedWidgetRecursive(GuiWidget root, string name)
|
||||||
{
|
{
|
||||||
foreach (GuiWidget child in root.Children)
|
foreach (GuiWidget child in root.Children)
|
||||||
|
|
|
||||||
|
|
@ -264,11 +264,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
ApplicationSettings.Instance.set("HideGCodeWarning", null);
|
ApplicationSettings.Instance.set("HideGCodeWarning", null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (!StyledMessageBox.ShowMessageBox(gcodeWarningMessage, "Warning GCode file".Localize(), new GuiWidget[] { hideGCodeWaringCheckBox }, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onConfirmPrint, 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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
|
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
|
||||||
|
|
@ -279,14 +275,30 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string message = String.Format(removeFromQueueMessage, pathAndFile);
|
string message = String.Format(removeFromQueueMessage, pathAndFile);
|
||||||
if (StyledMessageBox.ShowMessageBox(message, itemNotFoundMessage, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onRemoveMessageConfirm, message, itemNotFoundMessage, StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
|
||||||
QueueData.Instance.RemoveAt(queueDataView.SelectedIndex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
void onStartButton_Click(object sender, MouseEventArgs mouseEvent)
|
||||||
{
|
{
|
||||||
UiThread.RunOnIdle((state) =>
|
UiThread.RunOnIdle((state) =>
|
||||||
|
|
@ -327,10 +339,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
{
|
{
|
||||||
if (timeSincePrintStarted.IsRunning && timeSincePrintStarted.ElapsedMilliseconds > (2 * 60 * 1000))
|
if (timeSincePrintStarted.IsRunning && timeSincePrintStarted.ElapsedMilliseconds > (2 * 60 * 1000))
|
||||||
{
|
{
|
||||||
if (StyledMessageBox.ShowMessageBox(cancelCurrentPrintMessage, cancelCurrentPrintTitle, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onConfirmCancelPrint, cancelCurrentPrintMessage, cancelCurrentPrintTitle, StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
|
||||||
CancelPrinting();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -338,6 +347,14 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onConfirmCancelPrint(bool messageBoxResponse)
|
||||||
|
{
|
||||||
|
if (messageBoxResponse)
|
||||||
|
{
|
||||||
|
CancelPrinting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CancelConnectionButton_Click(object state)
|
void CancelConnectionButton_Click(object state)
|
||||||
{
|
{
|
||||||
CancelPrinting();
|
CancelPrinting();
|
||||||
|
|
|
||||||
|
|
@ -207,27 +207,28 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
string disconnectAndCancelMessage = "Disconnect and cancel the current print?".Localize();
|
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();
|
string disconnectAndCancelTitle = "WARNING: Disconnecting will cancel the current print.\n\nDo you want to disconnect?".Localize();
|
||||||
void OnIdleDisconnect(object state)
|
void OnIdleDisconnect(object state)
|
||||||
{
|
{
|
||||||
bool doCancel = true;
|
|
||||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||||
{
|
{
|
||||||
if (StyledMessageBox.ShowMessageBox(disconnectAndCancelMessage, disconnectAndCancelTitle, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onConfirmStopPrint, disconnectAndCancelMessage, disconnectAndCancelTitle, StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
|
||||||
PrinterConnectionAndCommunication.Instance.Stop();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
doCancel = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (doCancel)
|
|
||||||
{
|
{
|
||||||
PrinterConnectionAndCommunication.Instance.Disable();
|
PrinterConnectionAndCommunication.Instance.Disable();
|
||||||
selectActivePrinterButton.Invalidate();
|
selectActivePrinterButton.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onConfirmStopPrint(bool messageBoxResponse)
|
||||||
|
{
|
||||||
|
if (messageBoxResponse)
|
||||||
|
{
|
||||||
|
PrinterConnectionAndCommunication.Instance.Stop();
|
||||||
|
PrinterConnectionAndCommunication.Instance.Disable();
|
||||||
|
selectActivePrinterButton.Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SetConnectionButtonVisibleState(object state)
|
void SetConnectionButtonVisibleState(object state)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
|
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
|
||||||
{
|
{
|
||||||
string message = string.Format(waitingForBedToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
|
string message = string.Format(waitingForBedToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
|
||||||
StyledMessageBox.ShowMessageBox(message, waitingForBedToHeatTitle);
|
StyledMessageBox.ShowMessageBox(null, message, waitingForBedToHeatTitle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
||||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1))
|
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1))
|
||||||
{
|
{
|
||||||
string message = string.Format(waitingForeExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1), sliceSettingsNote);
|
string message = string.Format(waitingForeExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderNumber - 1), sliceSettingsNote);
|
||||||
StyledMessageBox.ShowMessageBox(message, waitingForeExtruderToHeatTitle);
|
StyledMessageBox.ShowMessageBox(null, message, waitingForeExtruderToHeatTitle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||||
{
|
{
|
||||||
StyledMessageBox.ShowMessageBox(cannotExitWhileActiveMessage, cannotExitWhileActiveTitle);
|
StyledMessageBox.ShowMessageBox(null, cannotExitWhileActiveMessage, cannotExitWhileActiveTitle);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
||||||
{
|
{
|
||||||
UiThread.RunOnIdle( (state) =>
|
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.
|
// don't move the bed lower it will not work when we print.
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -443,7 +443,7 @@ namespace MatterHackers.MatterControl
|
||||||
static EePromMarlinWidget openEePromMarlinWidget = null;
|
static EePromMarlinWidget openEePromMarlinWidget = null;
|
||||||
static EePromRepetierWidget openEePromRepetierWidget = null;
|
static EePromRepetierWidget openEePromRepetierWidget = null;
|
||||||
string noEepromMappingMessage = "Oops! There is no eeprom mapping for your printer's firmware.".Localize();
|
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();
|
string groupBoxTitle = "EEProm Settings".Localize();
|
||||||
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout)
|
private void AddEePromControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||||
{
|
{
|
||||||
|
|
@ -508,7 +508,7 @@ namespace MatterHackers.MatterControl
|
||||||
default:
|
default:
|
||||||
UiThread.RunOnIdle((state) =>
|
UiThread.RunOnIdle((state) =>
|
||||||
{
|
{
|
||||||
StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
|
StyledMessageBox.ShowMessageBox(null, noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
||||||
static EePromMarlinWidget openEePromMarlinWidget = null;
|
static EePromMarlinWidget openEePromMarlinWidget = null;
|
||||||
static EePromRepetierWidget openEePromRepetierWidget = null;
|
static EePromRepetierWidget openEePromRepetierWidget = null;
|
||||||
string noEepromMappingMessage = "Oops! There is no eeprom mapping for your printer's firmware.".Localize();
|
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();
|
string groupBoxTitle = "EEProm Settings".Localize();
|
||||||
private FlowLayoutWidget GetEEPromControl()
|
private FlowLayoutWidget GetEEPromControl()
|
||||||
{
|
{
|
||||||
|
|
@ -257,7 +257,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
StyledMessageBox.ShowMessageBox(noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
|
StyledMessageBox.ShowMessageBox(null, noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -17,28 +17,29 @@ namespace MatterHackers.MatterControl
|
||||||
String unwrappedMessage;
|
String unwrappedMessage;
|
||||||
TextWidget messageContainer;
|
TextWidget messageContainer;
|
||||||
FlowLayoutWidget middleRowContainer;
|
FlowLayoutWidget middleRowContainer;
|
||||||
public EventHandler ClickedOk;
|
|
||||||
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
|
TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
|
||||||
|
|
||||||
|
public delegate void MessageBoxDelegate(bool response);
|
||||||
|
MessageBoxDelegate responseCallback;
|
||||||
|
|
||||||
public enum MessageType { OK, YES_NO };
|
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);
|
StyledMessageBox messageBox = new StyledMessageBox(callback, message, caption, messageType, extraWidgetsToAdd, 400, 300, yesOk, no);
|
||||||
bool okClicked = false;
|
|
||||||
messageBox.ClickedOk += (sender, e) => { okClicked = true; };
|
|
||||||
messageBox.ShowAsSystemWindow();
|
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)
|
: base(width, height)
|
||||||
{
|
{
|
||||||
|
responseCallback = callback;
|
||||||
unwrappedMessage = message;
|
unwrappedMessage = message;
|
||||||
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
|
||||||
topToBottom.AnchorAll();
|
topToBottom.AnchorAll();
|
||||||
|
|
@ -182,17 +183,22 @@ namespace MatterHackers.MatterControl
|
||||||
}
|
}
|
||||||
|
|
||||||
void noButton_Click(object sender, MouseEventArgs mouseEvent)
|
void noButton_Click(object sender, MouseEventArgs mouseEvent)
|
||||||
{
|
{
|
||||||
UiThread.RunOnIdle(CloseOnIdle);
|
UiThread.RunOnIdle(CloseOnIdle);
|
||||||
|
if (responseCallback != null)
|
||||||
|
{
|
||||||
|
responseCallback(false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void okButton_Click(object sender, MouseEventArgs mouseEvent)
|
void okButton_Click(object sender, MouseEventArgs mouseEvent)
|
||||||
{
|
{
|
||||||
if (ClickedOk != null)
|
|
||||||
{
|
|
||||||
ClickedOk(this, null);
|
|
||||||
}
|
|
||||||
UiThread.RunOnIdle(CloseOnIdle);
|
UiThread.RunOnIdle(CloseOnIdle);
|
||||||
|
if (responseCallback != null)
|
||||||
|
{
|
||||||
|
responseCallback(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CloseOnIdle(object state)
|
void CloseOnIdle(object state)
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ namespace MatterHackers.MatterControl.DataStorage
|
||||||
GenerateSampleData sampleData = new GenerateSampleData();
|
GenerateSampleData sampleData = new GenerateSampleData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ValidateSchema();
|
ValidateSchema();
|
||||||
}
|
}
|
||||||
StartSession();
|
StartSession();
|
||||||
|
|
|
||||||
|
|
@ -373,24 +373,29 @@ namespace MatterHackers.MatterControl
|
||||||
|
|
||||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||||
{
|
{
|
||||||
StyledMessageBox.ShowMessageBox(unableToExitMessage, unableToExitTitle);
|
StyledMessageBox.ShowMessageBox(null, unableToExitMessage, unableToExitTitle);
|
||||||
CancelClose = true;
|
CancelClose = true;
|
||||||
}
|
}
|
||||||
else if (PartsSheet.IsSaving())
|
else if (PartsSheet.IsSaving())
|
||||||
{
|
{
|
||||||
if (!StyledMessageBox.ShowMessageBox(savePartsSheetExitAnywayMessage, confirmExit, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onConfirmExit, savePartsSheetExitAnywayMessage, confirmExit, StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
CancelClose = true;
|
||||||
CancelClose = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
base.OnClosing(out CancelClose);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base.OnClosing(out CancelClose);
|
base.OnClosing(out CancelClose);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool cancelClose;
|
||||||
|
void onConfirmExit(bool messageBoxResponse)
|
||||||
|
{
|
||||||
|
bool CancelClose;
|
||||||
|
if (messageBoxResponse)
|
||||||
|
{
|
||||||
|
base.OnClosing(out CancelClose);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1693,11 +1693,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
||||||
catch (System.UnauthorizedAccessException)
|
catch (System.UnauthorizedAccessException)
|
||||||
{
|
{
|
||||||
//Do something special when unauthorized?
|
//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
|
catch
|
||||||
{
|
{
|
||||||
StyledMessageBox.ShowMessageBox("Oops! Unable to save changes.", "Unable to save");
|
StyledMessageBox.ShowMessageBox(null, "Oops! Unable to save changes.", "Unable to save");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,7 @@ namespace MatterHackers.MatterControl.PrintHistory
|
||||||
|
|
||||||
public void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
|
public void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
|
||||||
{
|
{
|
||||||
|
itemToRemove = printItemWrapper;
|
||||||
UiThread.RunOnIdle((state) =>
|
UiThread.RunOnIdle((state) =>
|
||||||
{
|
{
|
||||||
string maxLengthName = printItemWrapper.FileLocation;
|
string maxLengthName = printItemWrapper.FileLocation;
|
||||||
|
|
@ -328,12 +329,18 @@ namespace MatterHackers.MatterControl.PrintHistory
|
||||||
string notFoundMessage = LocalizedString.Get("Oops! Could not find this file:");
|
string notFoundMessage = LocalizedString.Get("Oops! Could not find this file:");
|
||||||
string message = "{0}:\n'{1}'".FormatWith(notFoundMessage, maxLengthName);
|
string message = "{0}:\n'{1}'".FormatWith(notFoundMessage, maxLengthName);
|
||||||
string titleLabel = LocalizedString.Get("Item not Found");
|
string titleLabel = LocalizedString.Get("Item not Found");
|
||||||
if (StyledMessageBox.ShowMessageBox(message, titleLabel, StyledMessageBox.MessageType.OK))
|
StyledMessageBox.ShowMessageBox(onConfirmRemove, message, titleLabel, StyledMessageBox.MessageType.OK);
|
||||||
{
|
|
||||||
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(printItemWrapper));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
PrintItemWrapper itemToRemove;
|
||||||
|
|
||||||
|
void onConfirmRemove(bool messageBoxResponse)
|
||||||
|
{
|
||||||
|
if (messageBoxResponse)
|
||||||
|
{
|
||||||
|
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(itemToRemove));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
PartPreviewMainWindow partPreviewWindow;
|
PartPreviewMainWindow partPreviewWindow;
|
||||||
private void OpenPartPreviewWindow(PrintItem printItem, View3DWidget.AutoRotate autoRotate)
|
private void OpenPartPreviewWindow(PrintItem printItem, View3DWidget.AutoRotate autoRotate)
|
||||||
|
|
|
||||||
|
|
@ -383,10 +383,15 @@ namespace MatterHackers.MatterControl.PrintLibrary
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string message = String.Format("Cannot find\n'{0}'.\nWould you like to remove it from the library?", pathAndFile);
|
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))
|
StyledMessageBox.ShowMessageBox(null, message, "Item not found", StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
}
|
||||||
libraryDataView.RemoveChild(this);
|
}
|
||||||
}
|
|
||||||
|
void onConfirmRemove(bool messageBoxResponse)
|
||||||
|
{
|
||||||
|
if (messageBoxResponse)
|
||||||
|
{
|
||||||
|
libraryDataView.RemoveChild(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
||||||
string pleaseSelectPrinterTitle = "Please select a printer";
|
string pleaseSelectPrinterTitle = "Please select a printer";
|
||||||
void MustSelectPrinterMessage(object state)
|
void MustSelectPrinterMessage(object state)
|
||||||
{
|
{
|
||||||
StyledMessageBox.ShowMessageBox(pleaseSelectPrinterMessage, pleaseSelectPrinterTitle);
|
StyledMessageBox.ShowMessageBox(null, pleaseSelectPrinterMessage, pleaseSelectPrinterTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool exportGCodeToFolderButton_Click()
|
bool exportGCodeToFolderButton_Click()
|
||||||
|
|
|
||||||
|
|
@ -517,11 +517,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
||||||
{
|
{
|
||||||
if (PrintItemWrapper.PrintItem.FileLocation == QueueData.SdCardFileName)
|
if (PrintItemWrapper.PrintItem.FileLocation == QueueData.SdCardFileName)
|
||||||
{
|
{
|
||||||
if (StyledMessageBox.ShowMessageBox(alsoRemoveFromSdCardMessage, alsoRemoveFromSdCardTitle, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onDeleteFileConfirm, alsoRemoveFromSdCardMessage, alsoRemoveFromSdCardTitle, StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
|
||||||
// The firmware only understands the names when lowercase.
|
|
||||||
PrinterConnectionAndCommunication.Instance.DeleteFileFromSdCard(PrintItemWrapper.PrintItem.Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int thisIndexInQueue = QueueData.Instance.GetIndex(PrintItemWrapper);
|
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)
|
public static void ShowCantFindFileMessage(PrintItemWrapper printItemWrapper)
|
||||||
{
|
{
|
||||||
|
itemToRemove = printItemWrapper;
|
||||||
UiThread.RunOnIdle((state) =>
|
UiThread.RunOnIdle((state) =>
|
||||||
{
|
{
|
||||||
string maxLengthName = printItemWrapper.FileLocation;
|
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 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 message = "{0}:\n'{1}'\n\n{2}?".FormatWith(notFoundMessage, maxLengthName,notFoundMessageEnd);
|
||||||
string titleLabel = LocalizedString.Get("Item not Found");
|
string titleLabel = LocalizedString.Get("Item not Found");
|
||||||
if (StyledMessageBox.ShowMessageBox(message, titleLabel, StyledMessageBox.MessageType.YES_NO))
|
StyledMessageBox.ShowMessageBox(onConfirmRemove, message, titleLabel, StyledMessageBox.MessageType.YES_NO);
|
||||||
{
|
|
||||||
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(printItemWrapper));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PrintItemWrapper itemToRemove;
|
||||||
|
static void onConfirmRemove(bool messageBoxResponse)
|
||||||
|
{
|
||||||
|
if (messageBoxResponse)
|
||||||
|
{
|
||||||
|
QueueData.Instance.RemoveIndexOnIdle(QueueData.Instance.GetIndex(itemToRemove));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ThemeChanged(object sender, EventArgs e)
|
public void ThemeChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (this.isActivePrint)
|
if (this.isActivePrint)
|
||||||
|
|
|
||||||
|
|
@ -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 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);
|
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
|
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 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);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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 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 details = string.Format("Layer Height = {0}\nNozzle Diameter = {1}", LayerHeight, NozzleDiameter);
|
||||||
string location = LocalizedString.Get("Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'");
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
else if (FirstLayerHeight > NozzleDiameter)
|
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 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 details = string.Format("First Layer Height = {0}\nNozzle Diameter = {1}", FirstLayerHeight, NozzleDiameter);
|
||||||
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Layers/Perimeters'";
|
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;
|
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 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 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'";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -773,7 +773,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
string error = "The Min Fan Speed can only go as high as 100%.";
|
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 details = string.Format("It is currently set to {0}.", MinFanSpeed);
|
||||||
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Filament' -> 'Cooling' (show all settings)";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -782,7 +782,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
||||||
string error = "The Max Fan Speed can only go as high as 100%.";
|
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 details = string.Format("It is currently set to {0}.", MaxFanSpeed);
|
||||||
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Filament' -> 'Cooling' (show all settings)";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (FillDensity < 0 || FillDensity > 1)
|
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 error = "The Fill Density must be between 0 and 1 inclusive.";
|
||||||
string details = string.Format("It is currently set to {0}.", FillDensity);
|
string details = string.Format("It is currently set to {0}.", FillDensity);
|
||||||
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Infill'";
|
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;
|
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 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 details = string.Format("It is currently set to {0}.", actualSpeedValueString);
|
||||||
string location = "Location: 'Advanced Controls' -> 'Slice Settings' -> 'Print' -> 'Speed'";
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,7 @@ namespace MatterHackers.MatterControl
|
||||||
string fileNameOnly = Path.GetFileName(item.FileLocation);
|
string fileNameOnly = Path.GetFileName(item.FileLocation);
|
||||||
if (addedFileNames.Contains(fileNameOnly))
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue