Cleaning up warnings in Printer Connection
This commit is contained in:
parent
244a8902b0
commit
2479e01efd
6 changed files with 390 additions and 224 deletions
|
|
@ -294,7 +294,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (e is PrintPauseEventArgs printePauseEventArgs)
|
||||
{
|
||||
if (printePauseEventArgs.filamentRunout)
|
||||
if (printePauseEventArgs.FilamentRunout)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
|
|
@ -318,7 +318,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
string filamentPauseMessage = "Your 3D print has been paused.\n\nOut of filament, or jam, detected. Please load more filament or clear the jam.".Localize();
|
||||
|
||||
var messageBox = new MessageBoxPage(ResumePrint,
|
||||
filamentPauseMessage.FormatWith(printePauseEventArgs.layerNumber),
|
||||
filamentPauseMessage.FormatWith(printePauseEventArgs.LayerNumber),
|
||||
pauseCaption,
|
||||
StyledMessageBox.MessageType.YES_NO_WITHOUT_HIGHLIGHT,
|
||||
null,
|
||||
|
|
@ -343,7 +343,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
string layerPauseMessage = "Your 3D print has been auto-paused.\n\nLayer{0} reached.".Localize();
|
||||
|
||||
UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(ResumePrint,
|
||||
layerPauseMessage.FormatWith(printePauseEventArgs.layerNumber),
|
||||
layerPauseMessage.FormatWith(printePauseEventArgs.LayerNumber),
|
||||
pauseCaption,
|
||||
StyledMessageBox.MessageType.YES_NO,
|
||||
"Resume".Localize(),
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
}
|
||||
}
|
||||
|
||||
public object Peek()
|
||||
public string Peek()
|
||||
{
|
||||
// lock queue
|
||||
lock (locker)
|
||||
|
|
|
|||
|
|
@ -48,17 +48,17 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
if (printer.Settings.GetValue(SettingsKey.progress_reporting) != "None"
|
||||
&& printer.Connection.CommunicationState == CommunicationStates.Printing
|
||||
&& printer.Connection.activePrintTask != null
|
||||
&& printer.Connection.activePrintTask.PercentDone > nextPercent)
|
||||
&& printer.Connection.ActivePrintTask != null
|
||||
&& printer.Connection.ActivePrintTask.PercentDone > nextPercent)
|
||||
{
|
||||
nextPercent = Math.Round(printer.Connection.activePrintTask.PercentDone) + 0.5;
|
||||
nextPercent = Math.Round(printer.Connection.ActivePrintTask.PercentDone) + 0.5;
|
||||
if (printer.Settings.GetValue(SettingsKey.progress_reporting) == "M73")
|
||||
{
|
||||
return String.Format("M73 P{0:0}", printer.Connection.activePrintTask.PercentDone);
|
||||
return String.Format("M73 P{0:0}", printer.Connection.ActivePrintTask.PercentDone);
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.Format("M117 Printing - {0:0}%", printer.Connection.activePrintTask.PercentDone);
|
||||
return String.Format("M117 Printing - {0:0}%", printer.Connection.ActivePrintTask.PercentDone);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
72
MatterControlLib/PrinterCommunication/PrintPauseEventArgs.cs
Normal file
72
MatterControlLib/PrinterCommunication/PrintPauseEventArgs.cs
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
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.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterControl.Printing;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrinterCommunication.Io;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.SerialPortCommunication;
|
||||
using MatterHackers.SerialPortCommunication.FrostedSerial;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication
|
||||
{
|
||||
|
||||
public class PrintPauseEventArgs : EventArgs
|
||||
{
|
||||
public PrintPauseEventArgs(string name, bool filamentRunout, int layerNumber)
|
||||
{
|
||||
this.ItemName = name;
|
||||
this.FilamentRunout = filamentRunout;
|
||||
this.LayerNumber = layerNumber;
|
||||
}
|
||||
|
||||
public string ItemName { get; }
|
||||
|
||||
public bool FilamentRunout { get; }
|
||||
|
||||
public int LayerNumber { get; }
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Copyright (c) 2018, Lars Brubaker, John Lewin
|
||||
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.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MatterControl.Printing;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
|
||||
using MatterHackers.MatterControl.DataStorage;
|
||||
using MatterHackers.MatterControl.PrinterCommunication.Io;
|
||||
using MatterHackers.MatterControl.PrintQueue;
|
||||
using MatterHackers.MatterControl.SlicerConfiguration;
|
||||
using MatterHackers.SerialPortCommunication;
|
||||
using MatterHackers.SerialPortCommunication.FrostedSerial;
|
||||
using MatterHackers.VectorMath;
|
||||
|
||||
namespace MatterHackers.MatterControl.PrinterCommunication
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// This is a class to pass temperatures to callbacks that expect them.
|
||||
/// </summary>
|
||||
public class TemperatureEventArgs : EventArgs
|
||||
{
|
||||
public TemperatureEventArgs(int index0Based, double temperature)
|
||||
{
|
||||
this.Index0Based = index0Based;
|
||||
this.Temperature = temperature;
|
||||
}
|
||||
|
||||
public int Index0Based { get; }
|
||||
|
||||
public double Temperature { get; }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue