Load and Unload Macros working better.

Fixed colors on redeem purchase disabled button
This commit is contained in:
Lars Brubaker 2016-11-29 14:17:37 -08:00
parent a241888635
commit 06b1512698
24 changed files with 87 additions and 72 deletions

View file

@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
private List<string> commandQueue = new List<string>();
bool waitingForUserInput = false;
public const string macroStart = "; Command:";
public const string MacroPrefix = "; Command:";
public QueuedCommandsStream(GCodeStream internalStream)
: base(internalStream)
@ -83,17 +83,17 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
if (lineToSend != null)
{
if (lineToSend.StartsWith(macroStart))
if (lineToSend.StartsWith(MacroPrefix))
{
int spaceAfterCommand = lineToSend.IndexOf(' ', macroStart.Length);
int spaceAfterCommand = lineToSend.IndexOf(' ', MacroPrefix.Length);
string command;
if (spaceAfterCommand > 0)
{
command = lineToSend.Substring(macroStart.Length, spaceAfterCommand - macroStart.Length);
command = lineToSend.Substring(MacroPrefix.Length, spaceAfterCommand - MacroPrefix.Length);
}
else
{
command = lineToSend.Substring(macroStart.Length);
command = lineToSend.Substring(MacroPrefix.Length);
}
List<string> messages = new List<string>();
@ -112,12 +112,14 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
}
break;
case "ChooseMaterial":
waitingForUserInput = true;
UiThread.RunOnIdle(() => RunningMacroPage.Show(messages.Count > 0 ? messages[0] : "", true, true));
break;
case "WaitOK":
waitingForUserInput = true;
if (messages.Count > 0)
{
UiThread.RunOnIdle(() => RunningMacroPage.Show(messages[0], true));
}
UiThread.RunOnIdle(() => RunningMacroPage.Show(messages.Count > 0 ? messages[0] : "", true));
break;
case "Close":
@ -140,17 +142,19 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
return lineToSend;
}
public void Continue()
{
waitingForUserInput = false;
}
internal void Clear()
public void Reset()
{
lock (locker)
{
commandQueue.Clear();
}
waitingForUserInput = false;
}
public void Continue()
{
waitingForUserInput = false;
}
}
}