Move CommunicationState enums into PrinterCommunication namespace

This commit is contained in:
John Lewin 2017-06-13 17:32:38 -07:00
parent 9aaf0f6311
commit 1ac3274e7d
27 changed files with 148 additions and 148 deletions

View file

@ -249,7 +249,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
this.activePrintButtons.Clear();
if (!PrinterConnection.Instance.PrinterIsConnected
&& PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect)
&& PrinterConnection.Instance.CommunicationState != CommunicationStates.AttemptingToConnect)
{
if (!ProfileManager.Instance.ActiveProfiles.Any())
{
@ -275,12 +275,12 @@ namespace MatterHackers.MatterControl.ActionBar
{
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.AttemptingToConnect:
case CommunicationStates.AttemptingToConnect:
this.activePrintButtons.Add(cancelConnectButton);
EnableActiveButtons();
break;
case PrinterConnection.CommunicationStates.Connected:
case CommunicationStates.Connected:
PrintLevelingData levelingData = ActiveSliceSettings.Instance.Helpers.GetPrintLevelingData();
if (levelingData != null && ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_required_to_print)
&& !levelingData.HasBeenRunAndEnabled())
@ -295,13 +295,13 @@ namespace MatterHackers.MatterControl.ActionBar
EnableActiveButtons();
break;
case PrinterConnection.CommunicationStates.PreparingToPrint:
case CommunicationStates.PreparingToPrint:
this.activePrintButtons.Add(cancelButton);
EnableActiveButtons();
break;
case PrinterConnection.CommunicationStates.PrintingFromSd:
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.PrintingFromSd:
case CommunicationStates.Printing:
if (!PrinterConnection.Instance.PrintWasCanceled)
{
this.activePrintButtons.Add(pauseButton);
@ -315,13 +315,13 @@ namespace MatterHackers.MatterControl.ActionBar
EnableActiveButtons();
break;
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Paused:
this.activePrintButtons.Add(resumeButton);
this.activePrintButtons.Add(cancelButton);
EnableActiveButtons();
break;
case PrinterConnection.CommunicationStates.FinishedPrint:
case CommunicationStates.FinishedPrint:
this.activePrintButtons.Add(startButton);
EnableActiveButtons();
break;

View file

@ -253,35 +253,35 @@ namespace MatterHackers.MatterControl.ActionBar
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.PreparingToPrint:
case CommunicationStates.PreparingToPrint:
printLabel = "Preparing To Print".Localize() + ":";
break;
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.Printing:
printLabel = PrinterConnection.Instance.PrintingStateString;
printerStatus = totalPrintTimeText;
break;
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Paused:
printLabel = "Printing Paused".Localize() + ":";
printerStatus = totalPrintTimeText;
break;
case PrinterConnection.CommunicationStates.FinishedPrint:
case CommunicationStates.FinishedPrint:
printLabel = "Done Printing".Localize() + ":";
printerStatus = totalPrintTimeText;
break;
case PrinterConnection.CommunicationStates.Disconnected:
case CommunicationStates.Disconnected:
printerStatus = "Not connected. Press 'Connect' to enable printing.".Localize();
break;
case PrinterConnection.CommunicationStates.AttemptingToConnect:
case CommunicationStates.AttemptingToConnect:
printerStatus = "Attempting to Connect".Localize() + "...";
break;
case PrinterConnection.CommunicationStates.ConnectionLost:
case PrinterConnection.CommunicationStates.FailedToConnect:
case CommunicationStates.ConnectionLost:
case CommunicationStates.FailedToConnect:
printerStatus = "Connection Failed".Localize() + ": " + PrinterConnection.Instance.ConnectionFailureMessage;
break;

View file

@ -341,9 +341,9 @@ namespace MatterHackers.MatterControl.ActionBar
// Ensure connect buttons are locked while long running processes are executing to prevent duplicate calls into said actions
connectButton.Enabled = ActiveSliceSettings.Instance.PrinterSelected
&& communicationState != PrinterConnection.CommunicationStates.AttemptingToConnect;
&& communicationState != CommunicationStates.AttemptingToConnect;
disconnectButton.Enabled = communicationState != PrinterConnection.CommunicationStates.Disconnecting;
disconnectButton.Enabled = communicationState != CommunicationStates.Disconnecting;
});
}
}

View file

@ -81,7 +81,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
double goalTemp = (int)(targetTemp + .5);
if (PrinterConnection.Instance.PrinterIsPrinting
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingBed
&& PrinterConnection.Instance.PrintingState == DetailedPrintingState.HeatingBed
&& goalTemp != PrinterConnection.Instance.TargetBedTemperature)
{
string message = string.Format(waitingForBedToHeatMessage, PrinterConnection.Instance.TargetBedTemperature, sliceSettingsNote);

View file

@ -80,7 +80,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
double goalTemp = (int)(targetTemp + .5);
if (PrinterConnection.Instance.PrinterIsPrinting
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingExtruder
&& PrinterConnection.Instance.PrintingState == DetailedPrintingState.HeatingExtruder
&& goalTemp != PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex))
{
string message = string.Format(waitingForExtruderToHeatMessage, PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex), sliceSettingsNote);

View file

@ -342,35 +342,35 @@ namespace MatterHackers.MatterControl.ActionBar
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.PreparingToPrint:
case CommunicationStates.PreparingToPrint:
activePrintLabel.Text = "Preparing To Print".Localize() + ":";
break;
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.Printing:
activePrintLabel.Text = PrinterConnection.Instance.PrintingStateString;
activePrintStatus.Text = totalPrintTimeText;
break;
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Paused:
activePrintLabel.Text = "Printing Paused".Localize() + ":";
activePrintStatus.Text = totalPrintTimeText;
break;
case PrinterConnection.CommunicationStates.FinishedPrint:
case CommunicationStates.FinishedPrint:
activePrintLabel.Text = "Done Printing".Localize() + ":";
activePrintStatus.Text = totalPrintTimeText;
break;
case PrinterConnection.CommunicationStates.Disconnected:
case CommunicationStates.Disconnected:
activePrintStatus.Text = "Not connected. Press 'Connect' to enable printing.".Localize();
break;
case PrinterConnection.CommunicationStates.AttemptingToConnect:
case CommunicationStates.AttemptingToConnect:
activePrintStatus.Text = "Attempting to Connect".Localize() + "...";
break;
case PrinterConnection.CommunicationStates.ConnectionLost:
case PrinterConnection.CommunicationStates.FailedToConnect:
case CommunicationStates.ConnectionLost:
case CommunicationStates.FailedToConnect:
activePrintStatus.Text = "Connection Failed".Localize() + ": " + PrinterConnection.Instance.ConnectionFailureMessage;
break;

View file

@ -503,7 +503,7 @@ namespace MatterHackers.MatterControl
{
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.Printing:
if (UserSettings.Instance.IsTouchScreen)
{
UiThread.RunOnIdle(PrintingWindow.Show);
@ -931,7 +931,7 @@ namespace MatterHackers.MatterControl
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((sender, e) =>
{
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected)
if (PrinterConnection.Instance.CommunicationState == CommunicationStates.Connected)
{
PrinterConnection.Instance.PrintActivePartIfPossible();
}

View file

@ -151,7 +151,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
private void SetVisibleControls()
{
if (!ActiveSliceSettings.Instance.PrinterSelected
|| PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing
|| PrinterConnection.Instance.CommunicationState == CommunicationStates.Printing
|| PrinterConnection.Instance.PrinterIsPaused)
{
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);

View file

@ -120,28 +120,28 @@ namespace MatterHackers.MatterControl.ConfigurationPage
//cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Disconnecting:
case PrinterConnection.CommunicationStates.ConnectionLost:
case PrinterConnection.CommunicationStates.Disconnected:
case PrinterConnection.CommunicationStates.AttemptingToConnect:
case PrinterConnection.CommunicationStates.FailedToConnect:
case CommunicationStates.Disconnecting:
case CommunicationStates.ConnectionLost:
case CommunicationStates.Disconnected:
case CommunicationStates.AttemptingToConnect:
case CommunicationStates.FailedToConnect:
break;
case PrinterConnection.CommunicationStates.FinishedPrint:
case PrinterConnection.CommunicationStates.Connected:
case CommunicationStates.FinishedPrint:
case CommunicationStates.Connected:
break;
case PrinterConnection.CommunicationStates.PrintingFromSd:
case CommunicationStates.PrintingFromSd:
break;
case PrinterConnection.CommunicationStates.PreparingToPrint:
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.PreparingToPrint:
case CommunicationStates.Printing:
switch (PrinterConnection.Instance.PrintingState)
{
case PrinterConnection.DetailedPrintingState.HomingAxis:
case PrinterConnection.DetailedPrintingState.HeatingBed:
case PrinterConnection.DetailedPrintingState.HeatingExtruder:
case PrinterConnection.DetailedPrintingState.Printing:
case DetailedPrintingState.HomingAxis:
case DetailedPrintingState.HeatingBed:
case DetailedPrintingState.HeatingExtruder:
case DetailedPrintingState.Printing:
break;
default:
@ -149,7 +149,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
}
break;
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Paused:
break;
default:

View file

@ -349,9 +349,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
// Close if not Preparing, Printing or Paused
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.PreparingToPrint:
case PrinterConnection.CommunicationStates.Printing:
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.PreparingToPrint:
case CommunicationStates.Printing:
case CommunicationStates.Paused:
break;
default:
@ -497,9 +497,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
// Here for safety
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.PreparingToPrint:
case PrinterConnection.CommunicationStates.Printing:
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.PreparingToPrint:
case CommunicationStates.Printing:
case CommunicationStates.Paused:
break;
default:

View file

@ -80,9 +80,9 @@ namespace MatterHackers.MatterControl.PrintHistory
{
UiThread.RunOnIdle(() =>
{
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected)
if (PrinterConnection.Instance.CommunicationState == CommunicationStates.Connected)
{
PrinterConnection.Instance.CommunicationState = PrinterConnection.CommunicationStates.PreparingToPrint;
PrinterConnection.Instance.CommunicationState = CommunicationStates.PreparingToPrint;
PrinterConnection.Instance.StartPrint(lastPrintTask.PrintingGCodeFileName, lastPrintTask);
}
});

View file

@ -359,7 +359,7 @@
<Compile Include="PartPreviewWindow\PartPreviewMainWindow.cs" />
<Compile Include="Queue\OptionsMenu\PartsSheetCreator.cs" />
<Compile Include="Utilities\WebUtilities\JsonResponseDictionary.cs" />
<Compile Include="PrinterCommunication\PrinterConnectionAndCommunication.cs" />
<Compile Include="PrinterCommunication\PrinterConnection.cs" />
<Compile Include="PrinterControls\PrintLevelingPlane.cs" />
<Compile Include="PrinterControls\TerminalWindow\TerminalWindow.cs" />
<Compile Include="PrinterControls\PrinterConnections\SetupStepComPortManual.cs" />

View file

@ -214,7 +214,7 @@ namespace MatterHackers.MatterControl
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(fileName, fullPath)));
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((sender, e) =>
{
if (!hasBeenRun && PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected)
if (!hasBeenRun && PrinterConnection.Instance.CommunicationState == CommunicationStates.Connected)
{
hasBeenRun = true;
PrinterConnection.Instance.PrintActivePartIfPossible();
@ -539,7 +539,7 @@ namespace MatterHackers.MatterControl
UserSettings.Instance.Fields.StartCountDurringExit = UserSettings.Instance.Fields.StartCount;
TerminalWindow.CloseIfOpen();
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.PrintingFromSd)
if (PrinterConnection.Instance.CommunicationState != CommunicationStates.PrintingFromSd)
{
PrinterConnection.Instance.Disable();
}
@ -595,7 +595,7 @@ namespace MatterHackers.MatterControl
// Record that we are waiting for a response to the request to close
closeMessageBoxIsOpen = true;
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.PrintingFromSd)
if (PrinterConnection.Instance.CommunicationState != CommunicationStates.PrintingFromSd)
{
// Needed as we can't assign to CancelClose inside of the lambda below
StyledMessageBox.ShowMessageBox(ConditionalyCloseNow,
@ -632,9 +632,9 @@ namespace MatterHackers.MatterControl
if (continueWithShutdown)
{
closeHasBeenConfirmed = true;
bool printingFromSdCard = PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.PrintingFromSd
|| (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Paused
&& PrinterConnection.Instance.PrePauseCommunicationState == PrinterConnection.CommunicationStates.PrintingFromSd);
bool printingFromSdCard = PrinterConnection.Instance.CommunicationState == CommunicationStates.PrintingFromSd
|| (PrinterConnection.Instance.CommunicationState == CommunicationStates.Paused
&& PrinterConnection.Instance.PrePauseCommunicationState == CommunicationStates.PrintingFromSd);
if (!printingFromSdCard)
{
PrinterConnection.Instance.Disable();

View file

@ -149,7 +149,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
#else
switch (PrinterConnection.Instance.FirmwareType)
{
case PrinterConnection.FirmwareTypes.Repetier:
case FirmwareTypes.Repetier:
if (openEePromRepetierWidget != null)
{
openEePromRepetierWidget.BringToFront();
@ -164,7 +164,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
break;
case PrinterConnection.FirmwareTypes.Marlin:
case FirmwareTypes.Marlin:
if (openEePromMarlinWidget != null)
{
openEePromMarlinWidget.BringToFront();

View file

@ -517,8 +517,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// make sure we lock the controls if we are printing or paused
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Printing:
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Printing:
case CommunicationStates.Paused:
LockEditControls();
break;
}
@ -2181,8 +2181,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Printing:
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Printing:
case CommunicationStates.Paused:
break;
default:
@ -2299,8 +2299,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Printing:
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Printing:
case CommunicationStates.Paused:
LockEditControls();
break;

View file

@ -196,7 +196,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
if (PrinterConnection.Instance.PrinterIsPrinting)
{
// remember where we were after we ran the pause gcode
PrinterConnection.Instance.CommunicationState = PrinterConnection.CommunicationStates.Paused;
PrinterConnection.Instance.CommunicationState = CommunicationStates.Paused;
}
lineToSend = "";

View file

@ -27,6 +27,15 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using Gaming.Game;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
@ -42,18 +51,28 @@ using MatterHackers.SerialPortCommunication;
using MatterHackers.SerialPortCommunication.FrostedSerial;
using MatterHackers.VectorMath;
using Microsoft.Win32.SafeHandles;
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.IO.Compression;
namespace MatterHackers.MatterControl.PrinterCommunication
{
public enum CommunicationStates
{
Disconnected,
AttemptingToConnect,
FailedToConnect,
Connected,
PreparingToPrint,
Printing,
PrintingFromSd,
Paused,
FinishedPrint,
Disconnecting,
ConnectionLost
};
public enum DetailedPrintingState { HomingAxis, HeatingBed, HeatingExtruder, Printing };
public enum FirmwareTypes { Unknown, Repetier, Marlin, Sprinter };
public static class PrintItemWrapperExtensionMethods
{
private static TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
@ -364,25 +383,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication
[Flags]
public enum Axis { X = 1, Y = 2, Z = 4, E = 8, XYZ = (X | Y | Z) }
public enum CommunicationStates
{
Disconnected,
AttemptingToConnect,
FailedToConnect,
Connected,
PreparingToPrint,
Printing,
PrintingFromSd,
Paused,
FinishedPrint,
Disconnecting,
ConnectionLost
};
public enum DetailedPrintingState { HomingAxis, HeatingBed, HeatingExtruder, Printing };
public enum FirmwareTypes { Unknown, Repetier, Marlin, Sprinter };
public static PrinterConnection Instance
{
get
@ -1393,7 +1393,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
}
else
{
CommunicationState = PrinterConnection.CommunicationStates.PreparingToPrint;
CommunicationState = CommunicationStates.PreparingToPrint;
PrintItemWrapper partToPrint = ActivePrintItem;
SlicingQueue.Instance.QueuePartForSlicing(partToPrint);
partToPrint.SlicingDone += partToPrint_SliceDone;
@ -2539,7 +2539,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
{
if (messageBoxResponse)
{
CommunicationState = PrinterConnection.CommunicationStates.PreparingToPrint;
CommunicationState = CommunicationStates.PreparingToPrint;
PrintItemWrapper partToPrint = ActivePrintItem;
SlicingQueue.Instance.QueuePartForSlicing(partToPrint);
partToPrint.SlicingDone += partToPrint_SliceDone;

View file

@ -215,11 +215,11 @@ namespace MatterHackers.MatterControl
{
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Disconnecting:
case PrinterConnection.CommunicationStates.ConnectionLost:
case PrinterConnection.CommunicationStates.Disconnected:
case PrinterConnection.CommunicationStates.AttemptingToConnect:
case PrinterConnection.CommunicationStates.FailedToConnect:
case CommunicationStates.Disconnecting:
case CommunicationStates.ConnectionLost:
case CommunicationStates.Disconnected:
case CommunicationStates.AttemptingToConnect:
case CommunicationStates.FailedToConnect:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
@ -239,8 +239,8 @@ namespace MatterHackers.MatterControl
break;
case PrinterConnection.CommunicationStates.FinishedPrint:
case PrinterConnection.CommunicationStates.Connected:
case CommunicationStates.FinishedPrint:
case CommunicationStates.Connected:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -259,7 +259,7 @@ namespace MatterHackers.MatterControl
movementControlsContainer?.jogControls.SetEnabledLevels(false, true);
break;
case PrinterConnection.CommunicationStates.PrintingFromSd:
case CommunicationStates.PrintingFromSd:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -272,14 +272,14 @@ namespace MatterHackers.MatterControl
tuningAdjustmentControlsContainer?.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
break;
case PrinterConnection.CommunicationStates.PreparingToPrint:
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.PreparingToPrint:
case CommunicationStates.Printing:
switch (PrinterConnection.Instance.PrintingState)
{
case PrinterConnection.DetailedPrintingState.HomingAxis:
case PrinterConnection.DetailedPrintingState.HeatingBed:
case PrinterConnection.DetailedPrintingState.HeatingExtruder:
case PrinterConnection.DetailedPrintingState.Printing:
case DetailedPrintingState.HomingAxis:
case DetailedPrintingState.HeatingBed:
case DetailedPrintingState.HeatingExtruder:
case DetailedPrintingState.Printing:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -303,7 +303,7 @@ namespace MatterHackers.MatterControl
}
break;
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Paused:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -514,11 +514,11 @@ namespace MatterHackers.MatterControl
{
switch (PrinterConnection.Instance.CommunicationState)
{
case PrinterConnection.CommunicationStates.Disconnecting:
case PrinterConnection.CommunicationStates.ConnectionLost:
case PrinterConnection.CommunicationStates.Disconnected:
case PrinterConnection.CommunicationStates.AttemptingToConnect:
case PrinterConnection.CommunicationStates.FailedToConnect:
case CommunicationStates.Disconnecting:
case CommunicationStates.ConnectionLost:
case CommunicationStates.Disconnected:
case CommunicationStates.AttemptingToConnect:
case CommunicationStates.FailedToConnect:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
@ -538,8 +538,8 @@ namespace MatterHackers.MatterControl
break;
case PrinterConnection.CommunicationStates.FinishedPrint:
case PrinterConnection.CommunicationStates.Connected:
case CommunicationStates.FinishedPrint:
case CommunicationStates.Connected:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -559,7 +559,7 @@ namespace MatterHackers.MatterControl
break;
case PrinterConnection.CommunicationStates.PrintingFromSd:
case CommunicationStates.PrintingFromSd:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -572,14 +572,14 @@ namespace MatterHackers.MatterControl
tuningAdjustmentControlsContainer?.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
break;
case PrinterConnection.CommunicationStates.PreparingToPrint:
case PrinterConnection.CommunicationStates.Printing:
case CommunicationStates.PreparingToPrint:
case CommunicationStates.Printing:
switch (PrinterConnection.Instance.PrintingState)
{
case PrinterConnection.DetailedPrintingState.HomingAxis:
case PrinterConnection.DetailedPrintingState.HeatingBed:
case PrinterConnection.DetailedPrintingState.HeatingExtruder:
case PrinterConnection.DetailedPrintingState.Printing:
case DetailedPrintingState.HomingAxis:
case DetailedPrintingState.HeatingBed:
case DetailedPrintingState.HeatingExtruder:
case DetailedPrintingState.Printing:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@ -605,7 +605,7 @@ namespace MatterHackers.MatterControl
}
break;
case PrinterConnection.CommunicationStates.Paused:
case CommunicationStates.Paused:
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
{
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);

View file

@ -120,7 +120,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton.Visible = false;
UiThread.RunOnIdle(() => this?.Parent?.Close());
}
else if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect)
else if (PrinterConnection.Instance.CommunicationState != CommunicationStates.AttemptingToConnect)
{
printerComPortHelpLink.Visible = false;
printerComPortError.TextColor = RGBA_Bytes.Red;

View file

@ -131,7 +131,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton.Visible = false;
UiThread.RunOnIdle(() => this?.Parent?.Close());
}
else if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect)
else if (PrinterConnection.Instance.CommunicationState != CommunicationStates.AttemptingToConnect)
{
printerErrorMessage.TextColor = RGBA_Bytes.Red;
printerErrorMessage.Text = "Uh-oh! Could not connect to printer.".Localize();

View file

@ -502,7 +502,7 @@ namespace MatterHackers.MatterControl
{
double goalTemp = (int)(targetTemp + .5);
if (PrinterConnection.Instance.PrinterIsPrinting
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingExtruder
&& PrinterConnection.Instance.PrintingState == DetailedPrintingState.HeatingExtruder
&& goalTemp != PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex0Based))
{
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";
@ -599,7 +599,7 @@ namespace MatterHackers.MatterControl
{
double goalTemp = (int)(targetTemp + .5);
if (PrinterConnection.Instance.PrinterIsPrinting
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingBed
&& PrinterConnection.Instance.PrintingState == DetailedPrintingState.HeatingBed
&& goalTemp != PrinterConnection.Instance.TargetBedTemperature)
{
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";

View file

@ -328,12 +328,12 @@ namespace MatterHackers.MatterControl
int eMoveAmountNegative = -EAxisMoveAmount;
// if we are not printing and on mac or PC
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.Printing
if (PrinterConnection.Instance.CommunicationState != CommunicationStates.Printing
&& (OsInformation.OperatingSystem == OSType.Windows || OsInformation.OperatingSystem == OSType.Mac))
{
if (e.KeyCode == Keys.Z)
{
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.Printing)
if (PrinterConnection.Instance.CommunicationState != CommunicationStates.Printing)
{
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.Z);
}
@ -379,7 +379,7 @@ namespace MatterHackers.MatterControl
if ((OsInformation.OperatingSystem == OSType.Windows && e.KeyCode == Keys.PageUp)
|| (OsInformation.OperatingSystem == OSType.Mac && e.KeyCode == (Keys.Back | Keys.Cancel)))
{
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
if (PrinterConnection.Instance.CommunicationState == CommunicationStates.Printing)
{
var currentZ = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.baby_step_z_offset);
currentZ += moveAmountPositive;
@ -393,7 +393,7 @@ namespace MatterHackers.MatterControl
else if ((OsInformation.OperatingSystem == OSType.Windows && e.KeyCode == Keys.PageDown)
|| (OsInformation.OperatingSystem == OSType.Mac && e.KeyCode == Keys.Clear))
{
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
if (PrinterConnection.Instance.CommunicationState == CommunicationStates.Printing)
{
var currentZ = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.baby_step_z_offset);
currentZ += moveAmountNegative;
@ -656,7 +656,7 @@ namespace MatterHackers.MatterControl
{
MoveButton moveButton = (MoveButton)s;
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
if (PrinterConnection.Instance.CommunicationState == CommunicationStates.Printing)
{
if (moveAxis == PrinterConnection.Axis.Z) // only works on z
{

View file

@ -174,13 +174,13 @@ namespace MatterHackers.MatterControl
generalError.Visible = true;
nextButton.Visible = true;
}
else if (firstLoad || PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Disconnected)
else if (firstLoad || PrinterConnection.Instance.CommunicationState == CommunicationStates.Disconnected)
{
generalError.Text = "";
connectButton.Visible = true;
connectButtonContainer.Visible = true;
}
else if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.AttemptingToConnect)
else if (PrinterConnection.Instance.CommunicationState == CommunicationStates.AttemptingToConnect)
{
generalError.Text = "{0}...".FormatWith("Attempting to connect".Localize());
generalError.Visible = true;

View file

@ -62,7 +62,7 @@ namespace MatterHackers.MatterControl
public void ConnectionStatusChanged(object test, EventArgs args)
{
if(PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected && connectToPrinterRow != null)
if(PrinterConnection.Instance.CommunicationState == CommunicationStates.Connected && connectToPrinterRow != null)
{
connectToPrinterRow.SetSuccessful();
nextButton.Visible = true;

View file

@ -1286,7 +1286,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
EventHandler localUnregisterEvents = null;
bool canChangeComPort = !PrinterConnection.Instance.PrinterIsConnected && PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect;
bool canChangeComPort = !PrinterConnection.Instance.PrinterIsConnected && PrinterConnection.Instance.CommunicationState != CommunicationStates.AttemptingToConnect;
// The COM_PORT control is unique in its approach to the SlicerConfigName. It uses "com_port" settings name to
// bind to a context that will place it in the SliceSetting view but it binds its values to a machine
// specific dictionary key that is not exposed in the UI. At runtime we lookup and store to '<machinename>_com_port'
@ -1320,7 +1320,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// Prevent droplist interaction when connected
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
{
canChangeComPort = !PrinterConnection.Instance.PrinterIsConnected && PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect;
canChangeComPort = !PrinterConnection.Instance.PrinterIsConnected && PrinterConnection.Instance.CommunicationState != CommunicationStates.AttemptingToConnect;
selectableOptions.Enabled = canChangeComPort;
selectableOptions.TextColor = canChangeComPort ? ActiveTheme.Instance.PrimaryTextColor : new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 150);
selectableOptions.BorderColor = canChangeComPort ? ActiveTheme.Instance.SecondaryTextColor : new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 150);

View file

@ -312,7 +312,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
// Wait for slicing to complete before setting target values
testRunner.Delay(() => PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.Printing, 8);
testRunner.Delay(() => PrinterConnection.Instance.PrintingState == DetailedPrintingState.Printing, 8);
testRunner.Delay();
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
@ -403,7 +403,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
// Wait for slicing to complete before setting target values
testRunner.Delay(() => PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.Printing, 8);
testRunner.Delay(() => PrinterConnection.Instance.PrintingState == DetailedPrintingState.Printing, 8);
testRunner.Delay();
// Values should remain after print completes

View file

@ -429,7 +429,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
public static void WaitForPrintFinished(this AutomationRunner testRunner)
{
testRunner.Delay(() => PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.FinishedPrint, 500);
testRunner.Delay(() => PrinterConnection.Instance.CommunicationState == CommunicationStates.FinishedPrint, 500);
}
public static async Task RunTest(
@ -487,7 +487,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
await AutomationRunner.ShowWindowAndExecuteTests(matterControlWindow, testMethod, maxTimeToRun, defaultTestImages, config.AutomationInputType, () =>
{
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
if (PrinterConnection.Instance.CommunicationState == CommunicationStates.Printing)
{
PrinterConnection.Instance.Disable();
}