2017-05-23 19:03:30 -07:00
/ *
2018-06-18 15:25:53 -07:00
Copyright ( c ) 2018 , Lars Brubaker , John Lewin
2017-05-23 19:03:30 -07:00
All rights reserved .
Redistribution and use in source and binary forms , with or without
modification , are permitted provided that the following conditions are met :
1. Redistributions of source code must retain the above copyright notice , this
list of conditions and the following disclaimer .
2. Redistributions in binary form must reproduce the above copyright notice ,
this list of conditions and the following disclaimer in the documentation
and / or other materials provided with the distribution .
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES , INCLUDING , BUT NOT LIMITED TO , THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED . IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT , INDIRECT , INCIDENTAL , SPECIAL , EXEMPLARY , OR CONSEQUENTIAL DAMAGES
( INCLUDING , BUT NOT LIMITED TO , PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES ;
LOSS OF USE , DATA , OR PROFITS ; OR BUSINESS INTERRUPTION ) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY , WHETHER IN CONTRACT , STRICT LIABILITY , OR TORT
( INCLUDING NEGLIGENCE OR OTHERWISE ) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE , EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE .
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies ,
either expressed or implied , of the FreeBSD Project .
* /
2017-12-10 21:10:54 -08:00
2017-05-23 19:03:30 -07:00
using System ;
2018-01-21 21:07:14 -08:00
using System.Collections.Generic ;
2018-02-07 18:43:09 -08:00
using System.Collections.ObjectModel ;
using System.IO ;
2017-05-23 19:03:30 -07:00
using MatterHackers.Agg ;
2017-08-20 02:34:39 -07:00
using MatterHackers.Agg.Platform ;
2017-05-23 19:03:30 -07:00
using MatterHackers.Agg.UI ;
using MatterHackers.Localizations ;
using MatterHackers.MatterControl.ActionBar ;
2017-05-24 14:19:02 -07:00
using MatterHackers.MatterControl.CustomWidgets ;
2017-05-23 19:03:30 -07:00
using MatterHackers.MatterControl.EeProm ;
using MatterHackers.MatterControl.PrinterCommunication ;
2017-11-01 13:57:45 -07:00
using MatterHackers.MatterControl.PrintHistory ;
2018-09-08 12:52:47 -07:00
using MatterHackers.MatterControl.SetupWizard ;
2017-06-29 18:46:59 -07:00
using MatterHackers.MatterControl.SlicerConfiguration ;
2018-11-24 16:15:54 -08:00
using Newtonsoft.Json ;
2017-05-23 19:03:30 -07:00
namespace MatterHackers.MatterControl.PartPreviewWindow
{
2017-12-26 09:11:23 -08:00
public class PrinterActionsBar : OverflowBar
2017-05-23 19:03:30 -07:00
{
2017-09-15 12:08:00 -07:00
private PrinterConfig printer ;
2018-06-17 16:34:38 -07:00
private static MarlinEEPromPage marlinEEPromPage = null ;
private static RepetierEEPromPage repetierEEPromPage = null ;
2017-06-09 08:16:46 -07:00
2017-12-11 14:15:50 -08:00
private PrinterTabPage printerTabPage ;
2018-02-07 18:43:09 -08:00
2017-11-29 13:45:01 -08:00
internal GuiWidget sliceButton ;
2017-10-16 16:32:25 -07:00
2018-02-07 18:43:09 -08:00
private RadioIconButton layers2DButton ;
2018-05-07 17:36:30 -07:00
internal RadioIconButton layers3DButton ;
2018-02-07 18:43:09 -08:00
internal RadioIconButton modelViewButton ;
2018-11-08 08:13:08 -08:00
private Dictionary < PartViewMode , RadioIconButton > viewModes = new Dictionary < PartViewMode , RadioIconButton > ( ) ;
2017-09-25 22:11:02 -07:00
public PrinterActionsBar ( PrinterConfig printer , PrinterTabPage printerTabPage , ThemeConfig theme )
2017-12-26 09:11:23 -08:00
: base ( theme )
2017-05-23 19:03:30 -07:00
{
2017-09-15 12:08:00 -07:00
this . printer = printer ;
2017-12-11 14:15:50 -08:00
this . printerTabPage = printerTabPage ;
2017-10-16 17:09:00 -07:00
2017-08-07 15:47:27 -07:00
this . HAnchor = HAnchor . Stretch ;
this . VAnchor = VAnchor . Fit ;
2017-05-23 19:03:30 -07:00
2017-12-10 21:10:54 -08:00
var defaultMargin = theme . ButtonSpacing ;
2017-06-29 19:42:20 -07:00
2017-12-10 21:10:54 -08:00
// add the reset button first (if there is one)
2018-10-05 09:24:57 -07:00
if ( printer . Settings . GetValue < bool > ( SettingsKey . show_reset_connection ) )
2017-10-16 16:32:25 -07:00
{
2018-01-16 19:01:09 -08:00
var resetConnectionButton = new TextIconButton (
"Reset" . Localize ( ) ,
2018-04-12 08:42:10 -07:00
AggContext . StaticData . LoadIcon ( "e_stop.png" , 14 , 14 , theme . InvertIcons ) ,
2018-01-16 19:01:09 -08:00
theme )
{
ToolTipText = "Reboots the firmware on the controller" . Localize ( ) ,
Margin = defaultMargin
} ;
2017-12-10 21:10:54 -08:00
resetConnectionButton . Click + = ( s , e ) = >
{
UiThread . RunOnIdle ( printer . Connection . RebootBoard ) ;
} ;
this . AddChild ( resetConnectionButton ) ;
}
2017-10-16 16:32:25 -07:00
2017-12-10 21:10:54 -08:00
this . AddChild ( new PrinterConnectButton ( printer , theme ) ) ;
2018-12-03 13:23:24 -08:00
// add the start print button
GuiWidget startPrintButton ;
this . AddChild ( startPrintButton = new PrintPopupMenu ( printer , theme )
{
Margin = theme . ButtonSpacing
} ) ;
void SetPrintButtonStyle ( object s , EventArgs e )
{
switch ( printer . Connection . CommunicationState )
{
case CommunicationStates . FinishedPrint :
case CommunicationStates . Connected :
theme . ApplyPrimaryActionStyle ( startPrintButton ) ;
break ;
default :
theme . RemovePrimaryActionStyle ( startPrintButton ) ;
break ;
}
}
2019-06-17 18:12:34 -07:00
2018-12-03 13:23:24 -08:00
// make sure the buttons state is set correctly
printer . Connection . CommunicationStateChanged + = SetPrintButtonStyle ;
startPrintButton . Closed + = ( s , e ) = > printer . Connection . CommunicationStateChanged - = SetPrintButtonStyle ;
// and set the style right now
SetPrintButtonStyle ( this , null ) ;
2017-10-16 16:32:25 -07:00
2018-06-24 10:34:09 -07:00
this . AddChild ( new SliceButton ( printer , printerTabPage , theme )
2017-12-11 14:15:50 -08:00
{
Name = "Generate Gcode Button" ,
Margin = theme . ButtonSpacing ,
2018-06-24 10:34:09 -07:00
} ) ;
2017-10-16 16:32:25 -07:00
2018-02-07 18:43:09 -08:00
// Add vertical separator
2018-05-17 13:52:29 -07:00
this . AddChild ( new ToolbarSeparator ( theme )
2018-02-07 18:43:09 -08:00
{
VAnchor = VAnchor . Absolute ,
Height = theme . ButtonHeight ,
} ) ;
var buttonGroupB = new ObservableCollection < GuiWidget > ( ) ;
var iconPath = Path . Combine ( "ViewTransformControls" , "model.png" ) ;
2018-04-12 08:42:10 -07:00
modelViewButton = new RadioIconButton ( AggContext . StaticData . LoadIcon ( iconPath , 16 , 16 , theme . InvertIcons ) , theme )
2018-02-07 18:43:09 -08:00
{
SiblingRadioButtonList = buttonGroupB ,
Name = "Model View Button" ,
Checked = printer ? . ViewState . ViewMode = = PartViewMode . Model | | printer = = null ,
ToolTipText = "Model View" . Localize ( ) ,
Margin = theme . ButtonSpacing
} ;
modelViewButton . Click + = SwitchModes_Click ;
buttonGroupB . Add ( modelViewButton ) ;
AddChild ( modelViewButton ) ;
2018-11-08 08:13:08 -08:00
viewModes . Add ( PartViewMode . Model , modelViewButton ) ;
2018-02-07 18:43:09 -08:00
iconPath = Path . Combine ( "ViewTransformControls" , "gcode_3d.png" ) ;
2018-04-12 08:42:10 -07:00
layers3DButton = new RadioIconButton ( AggContext . StaticData . LoadIcon ( iconPath , 16 , 16 , theme . InvertIcons ) , theme )
2018-02-07 18:43:09 -08:00
{
SiblingRadioButtonList = buttonGroupB ,
Name = "Layers3D Button" ,
Checked = printer ? . ViewState . ViewMode = = PartViewMode . Layers3D ,
ToolTipText = "3D Layer View" . Localize ( ) ,
Margin = theme . ButtonSpacing
} ;
layers3DButton . Click + = SwitchModes_Click ;
buttonGroupB . Add ( layers3DButton ) ;
2018-11-08 08:13:08 -08:00
viewModes . Add ( PartViewMode . Layers3D , layers3DButton ) ;
2018-02-07 18:43:09 -08:00
if ( ! UserSettings . Instance . IsTouchScreen )
{
this . AddChild ( layers3DButton ) ;
}
iconPath = Path . Combine ( "ViewTransformControls" , "gcode_2d.png" ) ;
2018-04-12 08:42:10 -07:00
layers2DButton = new RadioIconButton ( AggContext . StaticData . LoadIcon ( iconPath , 16 , 16 , theme . InvertIcons ) , theme )
2018-02-07 18:43:09 -08:00
{
SiblingRadioButtonList = buttonGroupB ,
Name = "Layers2D Button" ,
Checked = printer ? . ViewState . ViewMode = = PartViewMode . Layers2D ,
ToolTipText = "2D Layer View" . Localize ( ) ,
Margin = theme . ButtonSpacing ,
} ;
layers2DButton . Click + = SwitchModes_Click ;
buttonGroupB . Add ( layers2DButton ) ;
this . AddChild ( layers2DButton ) ;
2018-11-08 08:13:08 -08:00
viewModes . Add ( PartViewMode . Layers2D , layers2DButton ) ;
2017-08-04 21:32:48 -07:00
this . AddChild ( new HorizontalSpacer ( ) ) ;
2019-05-01 14:57:31 -07:00
int hotendCount = printer . Settings . Helpers . HotendCount ( ) ;
2017-11-16 09:56:16 -08:00
if ( ! printer . Settings . GetValue < bool > ( SettingsKey . sla_printer ) )
2017-06-29 18:46:59 -07:00
{
2018-12-10 13:58:59 -08:00
for ( int extruderIndex = 0 ; extruderIndex < hotendCount ; extruderIndex + + )
2017-09-06 18:16:45 -07:00
{
2018-12-10 13:58:59 -08:00
this . AddChild ( new TemperatureWidgetHotend ( printer , extruderIndex , theme , hotendCount )
2017-11-16 09:56:16 -08:00
{
Margin = new BorderDouble ( right : 10 )
} ) ;
}
2017-09-06 18:16:45 -07:00
}
2017-06-29 18:46:59 -07:00
2017-09-15 12:08:00 -07:00
if ( printer . Settings . GetValue < bool > ( SettingsKey . has_heated_bed ) )
2017-06-29 18:46:59 -07:00
{
2018-04-12 08:42:10 -07:00
this . AddChild ( new TemperatureWidgetBed ( printer , theme ) ) ;
2017-06-29 18:46:59 -07:00
}
2018-04-07 09:50:52 -07:00
this . OverflowButton . Name = "Printer Overflow Menu" ;
2018-01-21 21:07:14 -08:00
this . ExtendOverflowMenu = ( popupMenu ) = >
{
2018-06-18 15:04:07 -07:00
this . GeneratePrinterOverflowMenu ( popupMenu , ApplicationController . Instance . MenuTheme ) ;
2018-01-21 21:07:14 -08:00
} ;
2018-02-07 18:43:09 -08:00
printer . ViewState . ViewModeChanged + = ( s , e ) = >
{
2018-11-08 08:13:08 -08:00
if ( viewModes [ e . ViewMode ] is RadioIconButton activeButton
& & viewModes [ e . PreviousMode ] is RadioIconButton previousButton
& & ! buttonIsBeingClicked )
2018-02-07 18:43:09 -08:00
{
2018-11-08 08:13:08 -08:00
// Show slide to animation from previous to current, on completion update view to current by setting active.Checked
previousButton . SlideToNewState (
activeButton ,
this ,
( ) = >
{
activeButton . Checked = true ;
} ,
theme ) ;
2018-02-07 18:43:09 -08:00
}
} ;
2017-06-02 13:17:30 -07:00
2018-11-16 08:44:56 -08:00
// Register listeners
2019-05-11 07:40:19 -07:00
printer . Connection . ConnectionSucceeded + = CheckForPrintRecovery ;
// if we are already connected than check if there is a print recovery right now
if ( printer . Connection . CommunicationState = = CommunicationStates . Connected )
{
CheckForPrintRecovery ( null , null ) ;
}
2017-06-09 08:16:46 -07:00
}
2017-05-24 14:19:02 -07:00
2018-05-16 11:37:33 -07:00
bool buttonIsBeingClicked ;
2020-05-29 19:08:41 -07:00
2018-02-07 18:43:09 -08:00
private void SwitchModes_Click ( object sender , MouseEventArgs e )
{
2018-05-16 11:37:33 -07:00
buttonIsBeingClicked = true ;
2018-02-07 18:43:09 -08:00
if ( sender is GuiWidget widget )
{
if ( widget . Name = = "Layers2D Button" )
{
printer . ViewState . ViewMode = PartViewMode . Layers2D ;
printer . Bed . EnsureGCodeLoaded ( ) ;
}
else if ( widget . Name = = "Layers3D Button" )
{
printer . ViewState . ViewMode = PartViewMode . Layers3D ;
printer . Bed . EnsureGCodeLoaded ( ) ;
}
else
{
printer . ViewState . ViewMode = PartViewMode . Model ;
}
}
2020-05-29 19:08:41 -07:00
2018-05-16 11:37:33 -07:00
buttonIsBeingClicked = false ;
2018-02-07 18:43:09 -08:00
}
2020-06-05 12:16:37 -07:00
public override GuiWidget AddChild ( GuiWidget childToAdd , int indexInChildrenList = - 1 )
2017-08-14 11:06:23 -07:00
{
2017-11-09 15:48:05 -08:00
childToAdd . VAnchor = VAnchor . Center ;
2020-06-05 12:16:37 -07:00
return base . AddChild ( childToAdd , indexInChildrenList ) ;
2017-08-14 11:06:23 -07:00
}
2018-08-23 16:44:11 -07:00
public override void OnClosed ( EventArgs e )
2017-07-14 13:55:02 -07:00
{
2018-11-16 08:44:56 -08:00
// Unregister listeners
2019-05-11 07:40:19 -07:00
printer . Connection . ConnectionSucceeded - = CheckForPrintRecovery ;
2018-11-16 08:44:56 -08:00
2017-07-14 13:55:02 -07:00
base . OnClosed ( e ) ;
}
2019-05-11 07:40:19 -07:00
private void CheckForPrintRecovery ( object s , EventArgs e )
2018-11-16 08:44:56 -08:00
{
UiThread . RunOnIdle ( ( ) = >
{
PrintRecovery . CheckIfNeedToRecoverPrint ( printer ) ;
} ) ;
}
2018-01-21 21:07:14 -08:00
private void GeneratePrinterOverflowMenu ( PopupMenu popupMenu , ThemeConfig theme )
2017-06-09 08:16:46 -07:00
{
2018-01-21 21:07:14 -08:00
var menuActions = new List < NamedAction > ( )
2017-06-09 08:16:46 -07:00
{
2017-07-28 08:57:33 -07:00
new NamedAction ( )
{
2018-04-12 11:23:08 -07:00
Icon = AggContext . StaticData . LoadIcon ( "memory_16x16.png" , 16 , 16 , theme . InvertIcons ) ,
2017-07-28 08:57:33 -07:00
Title = "Configure EEProm" . Localize ( ) ,
2018-06-15 11:11:49 -07:00
Action = configureEePromButton_Click ,
IsEnabled = ( ) = > printer . Connection . IsConnected
2017-07-28 08:57:33 -07:00
} ,
2018-01-03 15:24:55 -08:00
new NamedBoolAction ( )
2018-09-07 14:49:26 -07:00
{
Title = "Show Controls" . Localize ( ) ,
Action = ( ) = > { } ,
GetIsActive = ( ) = > printer . ViewState . ControlsVisible ,
SetIsActive = ( value ) = > printer . ViewState . ControlsVisible = value
} ,
new NamedBoolAction ( )
2019-06-12 11:48:45 -07:00
{
2018-09-07 14:49:26 -07:00
Title = "Show Terminal" . Localize ( ) ,
Action = ( ) = > { } ,
GetIsActive = ( ) = > printer . ViewState . TerminalVisible ,
SetIsActive = ( value ) = > printer . ViewState . TerminalVisible = value
} ,
new NamedBoolAction ( )
2017-12-27 13:45:47 -08:00
{
Title = "Configure Printer" . Localize ( ) ,
2018-01-03 15:24:55 -08:00
Action = ( ) = > { } ,
GetIsActive = ( ) = > printer . ViewState . ConfigurePrinterVisible ,
SetIsActive = ( value ) = > printer . ViewState . ConfigurePrinterVisible = value
2017-12-27 13:45:47 -08:00
} ,
2018-08-08 07:03:37 -07:00
new ActionSeparator ( ) ,
2018-09-08 12:52:47 -07:00
new NamedAction ( )
{
Title = "Import Presets" . Localize ( ) ,
Action = ( ) = >
{
AggContext . FileDialogs . OpenFileDialog (
new OpenFileDialogParams ( "settings files|*.printer" ) ,
( dialogParams ) = >
{
if ( ! string . IsNullOrEmpty ( dialogParams . FileName ) )
{
DialogWindow . Show ( new ImportSettingsPage ( dialogParams . FileName , printer ) ) ;
}
} ) ;
}
} ,
new NamedAction ( )
{
2019-05-09 14:04:46 -07:00
Title = "Export Printer" . Localize ( ) ,
2018-12-13 16:09:52 -08:00
Action = ( ) = > UiThread . RunOnIdle ( ( ) = >
2018-09-08 12:52:47 -07:00
{
2018-11-24 16:15:54 -08:00
ApplicationController . Instance . ExportAsMatterControlConfig ( printer ) ;
2019-05-09 14:04:46 -07:00
} ) ,
Icon = AggContext . StaticData . LoadIcon ( "cube_export.png" , 16 , 16 , theme . InvertIcons ) ,
2018-09-08 12:52:47 -07:00
} ,
new ActionSeparator ( ) ,
2019-05-14 13:02:11 -07:00
new NamedAction ( )
{
Title = "Calibrate Printer" . Localize ( ) ,
Action = ( ) = > UiThread . RunOnIdle ( ( ) = >
{
UiThread . RunOnIdle ( ( ) = >
{
DialogWindow . Show ( new PrinterCalibrationWizard ( printer , theme ) ) ;
} ) ;
} ) ,
2020-08-04 14:56:27 -07:00
Icon = AggContext . StaticData . LoadIcon ( "compass.png" , 16 , 16 , theme . InvertIcons )
2019-05-14 13:02:11 -07:00
} ,
new ActionSeparator ( ) ,
2018-09-08 12:52:47 -07:00
new NamedAction ( )
{
2020-08-29 10:56:16 -07:00
Title = "Update Settings..." . Localize ( ) ,
Action = ( ) = >
{
DialogWindow . Show ( new UpdateSettingsPage ( printer ) ) ;
} ,
Icon = AggContext . StaticData . LoadIcon ( "fa-refresh_14.png" , 16 , 16 , theme . InvertIcons )
} ,
new NamedAction ( )
{
Title = "Restore Settings..." . Localize ( ) ,
2018-09-08 12:52:47 -07:00
Action = ( ) = >
{
2018-11-11 21:25:50 -08:00
DialogWindow . Show ( new PrinterProfileHistoryPage ( printer ) ) ;
2018-09-08 12:52:47 -07:00
}
} ,
new NamedAction ( )
{
2020-08-29 10:56:16 -07:00
Title = "Reset to Defaults..." . Localize ( ) ,
2018-09-08 12:52:47 -07:00
Action = ( ) = >
{
StyledMessageBox . ShowMessageBox (
( revertSettings ) = >
{
if ( revertSettings )
{
printer . Settings . ClearUserOverrides ( ) ;
2020-08-21 11:35:12 -07:00
printer . Settings . ResetSettingsForNewProfile ( ) ;
2019-06-01 09:10:15 -07:00
// this is user driven
printer . Settings . Save ( ) ;
2019-05-11 08:21:27 -07:00
printer . Settings . Helpers . PrintLevelingData . SampledPositions . Clear ( ) ;
2019-05-24 14:14:07 -07:00
ApplicationController . Instance . ReloadAll ( ) . ConfigureAwait ( false ) ;
2018-09-08 12:52:47 -07:00
}
} ,
"Resetting to default values will remove your current overrides and restore your original printer settings.\nAre you sure you want to continue?" . Localize ( ) ,
"Revert Settings" . Localize ( ) ,
StyledMessageBox . MessageType . YES_NO ) ;
}
} ,
new ActionSeparator ( ) ,
2017-07-28 08:19:22 -07:00
new NamedAction ( )
2017-07-27 14:25:21 -07:00
{
2017-07-28 08:19:22 -07:00
Title = "Delete Printer" . Localize ( ) ,
Action = ( ) = >
2017-07-27 14:25:21 -07:00
{
2017-07-28 08:19:22 -07:00
StyledMessageBox . ShowMessageBox (
( doDelete ) = >
{
if ( doDelete )
{
2018-11-11 21:25:50 -08:00
ProfileManager . Instance . DeletePrinter ( printer . Settings . ID ) ;
2017-07-28 08:19:22 -07:00
}
} ,
2018-12-29 09:24:59 -08:00
"Are you sure you want to delete printer '{0}'?" . Localize ( ) . FormatWith ( printer . Settings . GetValue ( SettingsKey . printer_name ) ) ,
2017-07-28 08:19:22 -07:00
"Delete Printer?" . Localize ( ) ,
StyledMessageBox . MessageType . YES_NO ,
"Delete Printer" . Localize ( ) ) ;
2019-05-09 14:04:46 -07:00
} ,
2017-07-28 08:19:22 -07:00
}
2017-07-27 14:25:21 -07:00
} ;
2017-10-15 15:50:48 -07:00
2018-01-21 21:07:14 -08:00
theme . CreateMenuItems ( popupMenu , menuActions ) ;
2017-06-09 08:16:46 -07:00
}
2017-05-23 19:03:30 -07:00
2017-07-28 08:57:33 -07:00
private void configureEePromButton_Click ( )
2017-06-09 08:16:46 -07:00
{
UiThread . RunOnIdle ( ( ) = >
2017-05-23 19:03:30 -07:00
{
2018-06-18 13:40:40 -07:00
var firmwareType = printer . Connection . FirmwareType ;
// Force Repetier firmware for testing when we don't have repetier firmware
if ( false )
{
firmwareType = FirmwareTypes . Repetier ;
}
switch ( firmwareType )
2017-06-09 08:16:46 -07:00
{
2017-06-13 17:32:38 -07:00
case FirmwareTypes . Repetier :
2018-06-17 16:34:38 -07:00
if ( repetierEEPromPage ! = null )
2017-06-09 08:16:46 -07:00
{
2018-06-19 15:02:25 -07:00
repetierEEPromPage . DialogWindow . BringToFront ( ) ;
2017-06-09 08:16:46 -07:00
}
else
{
2018-06-18 16:33:40 -07:00
repetierEEPromPage = new RepetierEEPromPage ( printer ) ;
2018-06-17 16:34:38 -07:00
repetierEEPromPage . Closed + = ( s , e ) = >
2017-05-23 19:03:30 -07:00
{
2018-06-17 16:34:38 -07:00
repetierEEPromPage = null ;
2017-06-09 08:16:46 -07:00
} ;
2018-06-17 16:34:38 -07:00
DialogWindow . Show ( repetierEEPromPage ) ;
2017-06-09 08:16:46 -07:00
}
2020-05-29 19:08:41 -07:00
2017-06-09 08:16:46 -07:00
break ;
2017-06-13 17:32:38 -07:00
case FirmwareTypes . Marlin :
2018-06-17 16:34:38 -07:00
if ( marlinEEPromPage ! = null )
2017-06-09 08:16:46 -07:00
{
2018-06-19 15:02:25 -07:00
marlinEEPromPage . DialogWindow . BringToFront ( ) ;
2017-06-09 08:16:46 -07:00
}
else
{
2018-06-18 16:33:40 -07:00
marlinEEPromPage = new MarlinEEPromPage ( printer ) ;
2018-06-17 16:34:38 -07:00
marlinEEPromPage . Closed + = ( s , e ) = >
2017-05-23 19:03:30 -07:00
{
2018-06-17 16:34:38 -07:00
marlinEEPromPage = null ;
2017-06-09 08:16:46 -07:00
} ;
2018-06-17 16:34:38 -07:00
DialogWindow . Show ( marlinEEPromPage ) ;
2017-06-09 08:16:46 -07:00
}
2020-05-29 19:08:41 -07:00
2017-06-09 08:16:46 -07:00
break ;
default :
2018-01-04 17:30:48 -08:00
printer . Connection . QueueLine ( "M115" ) ;
2018-06-24 09:52:03 -07:00
StyledMessageBox . ShowMessageBox (
"Oops! There is no eeprom mapping for your printer's firmware." . Localize ( ) + "\n\n" + "You may need to wait a minute for your printer to finish initializing." . Localize ( ) ,
"Warning - No EEProm Mapping" . Localize ( ) ,
StyledMessageBox . MessageType . OK ) ;
2017-06-09 08:16:46 -07:00
break ;
}
2017-09-01 21:23:08 -07:00
} ) ;
2017-05-23 19:03:30 -07:00
}
}
}