Rename Connection.PrinterIsConnected -> Connection.IsConnected

This commit is contained in:
John Lewin 2018-02-01 14:51:44 -08:00
parent 028afd98d2
commit e998f137aa
15 changed files with 33 additions and 33 deletions

View file

@ -110,7 +110,7 @@ namespace MatterHackers.MatterControl.ActionBar
{
if (disableablePanel != null)
{
disableablePanel.Enabled = printer.Connection.PrinterIsConnected;
disableablePanel.Enabled = printer.Connection.IsConnected;
}
}, ref unregisterEvents);
@ -145,7 +145,7 @@ namespace MatterHackers.MatterControl.ActionBar
public override void OnLoad(EventArgs args)
{
// Wrap popup content in a DisableablePanel
disableablePanel = new DisableablePanel(this.GetPopupContent(), printer.Connection.PrinterIsConnected, alpha: 140);
disableablePanel = new DisableablePanel(this.GetPopupContent(), printer.Connection.IsConnected, alpha: 140);
// Set as popup
this.PopupContent = disableablePanel;

View file

@ -147,7 +147,7 @@ namespace MatterHackers.MatterControl.PrinterControls
else
{
this.Enabled = true;
runPrintLevelingButton.Enabled = printer.Connection.PrinterIsConnected;
runPrintLevelingButton.Enabled = printer.Connection.IsConnected;
}
}
}

View file

@ -576,7 +576,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
container.backButton.Enabled = false;
container.nextButton.Enabled = false;
if (printer.Connection.PrinterIsConnected
if (printer.Connection.IsConnected
&& !(printer.Connection.PrinterIsPrinting
|| printer.Connection.PrinterIsPaused))
{

View file

@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.EeProm
{
printerConnection.CommunicationStateChanged.RegisterEvent((s, e) =>
{
if(!printerConnection.PrinterIsConnected)
if(!printerConnection.IsConnected)
{
this.CloseOnIdle();
}

View file

@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.Library
{
this.Items.Clear();
if (printer.Connection.PrinterIsConnected
if (printer.Connection.IsConnected
&& !(printer.Connection.PrinterIsPrinting || printer.Connection.PrinterIsPaused))
{
autoResetEvent = new AutoResetEvent(false);

View file

@ -48,7 +48,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
if (!printerConnection.WaitingForPositionRead
&& nextReadTimeMs < UiThread.CurrentTimerMs
&& printerConnection.PrinterIsConnected)
&& printerConnection.IsConnected)
{
nextReadTimeMs = UiThread.CurrentTimerMs + 1000;
return "M105";

View file

@ -577,7 +577,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
{
fanSpeed = Math.Max(0, Math.Min(255, value));
OnFanSpeedSet(null);
if (PrinterIsConnected)
if (this.IsConnected)
{
QueueLine("M106 S{0}".FormatWith((int)(fanSpeed + .5)));
}
@ -623,7 +623,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
}
}
public bool PrinterIsConnected
public bool IsConnected
{
get
{
@ -780,7 +780,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
{
_targetBedTemperature = value;
OnBedTemperatureSet(new TemperatureEventArgs(0, TargetBedTemperature));
if (PrinterIsConnected)
if (this.IsConnected)
{
QueueLine("M140 S{0}".FormatWith(_targetBedTemperature));
}
@ -902,7 +902,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
// make sure we don't have a left over print task
activePrintTask = null;
if (PrinterIsConnected)
if (this.IsConnected)
{
this.OnConnectionFailed(ConnectionFailure.AlreadyConnected);
return;
@ -916,7 +916,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
if (serialPortIsAvailable && !serialPortIsAlreadyOpen)
{
if (!PrinterIsConnected)
if (!this.IsConnected)
{
try
{
@ -1055,7 +1055,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
public void Disable()
{
if (PrinterIsConnected)
if (this.IsConnected)
{
// Make sure we send this without waiting for the printer to respond. We want to try and turn off the heaters.
// It may be possible in the future to make this go into the printer queue for assured sending but it means
@ -1278,7 +1278,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
public void OnIdle()
{
if (PrinterIsConnected && ReadThread.NumRunning == 0)
if (this.IsConnected && ReadThread.NumRunning == 0)
{
ReadThread.Start(this);
}
@ -1420,9 +1420,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication
timeSinceLastReadAnything.Restart();
// we want this while loop to be as fast as possible. Don't allow any significant work to happen in here
while (CommunicationState == CommunicationStates.AttemptingToConnect
|| (PrinterIsConnected && serialPort != null && serialPort.IsOpen && !Disconnecting && readThreadHolder.IsCurrentThread()))
|| (this.IsConnected && serialPort != null && serialPort.IsOpen && !Disconnecting && readThreadHolder.IsCurrentThread()))
{
if ((PrinterIsConnected
if ((this.IsConnected
|| this.communicationState == CommunicationStates.AttemptingToConnect)
&& CommunicationState != CommunicationStates.PrintingFromSd)
{
@ -1879,7 +1879,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
{
targetHotendTemperature[hotendIndex0Based] = temperature;
OnHotendTemperatureSet(new TemperatureEventArgs(hotendIndex0Based, temperature));
if (PrinterIsConnected)
if (this.IsConnected)
{
QueueLine("M104 T{0} S{1}".FormatWith(hotendIndex0Based, targetHotendTemperature[hotendIndex0Based]));
}
@ -1890,7 +1890,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
public async void StartPrint(string gcodeFilename, PrintTask printTaskToUse = null)
{
if (!PrinterIsConnected || PrinterIsPrinting)
if (!this.IsConnected || PrinterIsPrinting)
{
return;
}
@ -1959,7 +1959,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
public bool StartSdCardPrint(string m23FileName)
{
if (!PrinterIsConnected
if (!this.IsConnected
|| PrinterIsPrinting
|| string.IsNullOrEmpty(m23FileName))
{
@ -2395,7 +2395,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
int waitTimeInMs = 60000; // 60 seconds
if (waitingForPosition.IsRunning
&& waitingForPosition.ElapsedMilliseconds < waitTimeInMs
&& PrinterIsConnected)
&& this.IsConnected)
{
// we are waiting for a position response don't print more
return;
@ -2407,7 +2407,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
if (currentSentLine != null)
{
if (currentSentLine.Contains("M114")
&& PrinterIsConnected)
&& this.IsConnected)
{
waitingForPosition.Restart();
}
@ -2558,7 +2558,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
private void WriteRaw(string lineToWrite, string lineWithoutChecksum)
{
if (PrinterIsConnected || CommunicationState == CommunicationStates.AttemptingToConnect)
if (this.IsConnected || CommunicationState == CommunicationStates.AttemptingToConnect)
{
if (serialPort != null && serialPort.IsOpen)
{

View file

@ -47,7 +47,7 @@ namespace MatterHackers.MatterControl.PrinterControls
: base(FlowDirection.TopToBottom)
{
this.printer = printer;
this.Enabled = printer.Connection.PrinterIsConnected;
this.Enabled = printer.Connection.IsConnected;
this.AddChild(
settingsItem = new SettingsItem(
@ -68,7 +68,7 @@ namespace MatterHackers.MatterControl.PrinterControls
printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) =>
{
this.Enabled = printer.Connection.PrinterIsConnected
this.Enabled = printer.Connection.IsConnected
&& printer.Settings.GetValue<bool>(SettingsKey.has_power_control);
}, ref unregisterEvents);

View file

@ -167,7 +167,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private void onPrinterStatusChanged(object sender, EventArgs e)
{
if (printer.Connection.PrinterIsConnected)
if (printer.Connection.IsConnected)
{
printerComPortHelpLink.Visible = false;
printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;

View file

@ -159,7 +159,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
private void onPrinterStatusChanged(object sender, EventArgs e)
{
if (printer.Connection.PrinterIsConnected)
if (printer.Connection.IsConnected)
{
printerErrorMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
printerErrorMessage.Text = "Connection succeeded".Localize() + "!";

View file

@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl.PrintQueue
public void LoadFilesFromSD()
{
if (ApplicationController.Instance.ActivePrinter.Connection.PrinterIsConnected
if (ApplicationController.Instance.ActivePrinter.Connection.IsConnected
&& !(ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPrinting
|| ApplicationController.Instance.ActivePrinter.Connection.PrinterIsPaused))
{

View file

@ -168,7 +168,7 @@ namespace MatterHackers.MatterControl
connectButtonContainer.Visible = false;
retryButtonContainer.Visible = false;
if (ApplicationController.Instance.ActivePrinter.Connection.PrinterIsConnected)
if (ApplicationController.Instance.ActivePrinter.Connection.IsConnected)
{
generalError.Text = "{0}!".FormatWith ("Connection succeeded".Localize ());
generalError.Visible = true;

View file

@ -56,7 +56,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
public void Run(PrinterConnection printerConnection)
{
if (printerConnection.PrinterIsConnected)
if (printerConnection.IsConnected)
{
printerConnection.MacroStart();
printerConnection.QueueLine(GCode);

View file

@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
EventHandler unregisterEvents = null;
bool canChangeComPort = !printer.Connection.PrinterIsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
bool canChangeComPort = !printer.Connection.IsConnected && printer.Connection.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
@ -83,7 +83,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// Prevent droplist interaction when connected
printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) =>
{
canChangeComPort = !printer.Connection.PrinterIsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
canChangeComPort = !printer.Connection.IsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
dropdownList.Enabled = canChangeComPort;
dropdownList.TextColor = canChangeComPort ? ActiveTheme.Instance.PrimaryTextColor : new Color(ActiveTheme.Instance.PrimaryTextColor, 150);
dropdownList.BorderColor = canChangeComPort ? ActiveTheme.Instance.SecondaryTextColor : new Color(ActiveTheme.Instance.SecondaryTextColor, 150);

View file

@ -33,7 +33,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
var theme = ApplicationController.Instance.Theme;
base.Initialize(tabIndex);
bool canChangeComPort = !printer.Connection.PrinterIsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
bool canChangeComPort = !printer.Connection.IsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
//This setting defaults to Manual
var selectedMachine = printer.Settings.GetValue(SettingsKey.selector_ip_address);
dropdownList = new DropDownList(selectedMachine, theme.Colors.PrimaryTextColor, maxHeight: 200, pointSize: theme.DefaultFontSize)
@ -60,7 +60,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
// Prevent droplist interaction when connected
printer.Connection.CommunicationStateChanged.RegisterEvent((s, e) =>
{
canChangeComPort = !printer.Connection.PrinterIsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
canChangeComPort = !printer.Connection.IsConnected && printer.Connection.CommunicationState != CommunicationStates.AttemptingToConnect;
dropdownList.Enabled = canChangeComPort;
dropdownList.TextColor = canChangeComPort ? theme.Colors.PrimaryTextColor : new Color(theme.Colors.PrimaryTextColor, 150);
dropdownList.BorderColor = canChangeComPort ? theme.Colors.SecondaryTextColor : new Color(theme.Colors.SecondaryTextColor, 150);