mattercontrol/Queue/OptionsMenu/ExportToSdCardFeedbackWindow.cs

71 lines
1.9 KiB
C#
Raw Normal View History

2015-04-08 15:20:10 -07:00
using MatterHackers.Agg;
2014-01-29 19:09:30 -08:00
using MatterHackers.Agg.UI;
2015-04-08 15:20:10 -07:00
using MatterHackers.Localizations;
using System;
2014-01-29 19:09:30 -08:00
namespace MatterHackers.MatterControl
{
2015-04-08 15:20:10 -07:00
public class ExportToSdCardFeedbackWindow : SystemWindow
{
private int totalParts;
private int count = 0;
private FlowLayoutWidget feedback = new FlowLayoutWidget(FlowDirection.TopToBottom);
private TextWidget nextLine;
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public ExportToSdCardFeedbackWindow(int totalParts, string firstPartName, RGBA_Bytes backgroundColor)
: base(300, 500)
{
BackgroundColor = backgroundColor;
Title = "MatterControl - Exporting to Folder or SD Card".Localize();
this.totalParts = totalParts;
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
feedback.Padding = new BorderDouble(5, 5);
feedback.AnchorAll();
AddChild(feedback);
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
nextLine = CreateNextLine("");
feedback.AddChild(nextLine);
}
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
private TextWidget CreateNextLine(string startText)
{
TextWidget nextLine = new TextWidget(startText, textColor: RGBA_Bytes.White);
nextLine.Margin = new BorderDouble(0, 2);
nextLine.HAnchor = Agg.UI.HAnchor.Left;
2015-04-08 15:20:10 -07:00
nextLine.AutoExpandBoundsToText = true;
return nextLine;
}
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public void StartingNextPart(object sender, EventArgs e)
{
count++;
StringEventArgs stringEvent = e as StringEventArgs;
if (stringEvent != null)
{
string partDescription = string.Format("{0}/{1} '{2}'", count, totalParts, stringEvent.Data);
nextLine.Text = partDescription;
nextLine = CreateNextLine("");
feedback.AddChild(nextLine);
}
}
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public void DoneSaving(object sender, EventArgs e)
{
StringEventArgs stringEvent = e as StringEventArgs;
if (stringEvent != null)
{
nextLine.Text = "";
2016-10-06 14:12:36 -07:00
feedback.AddChild(CreateNextLine(string.Format("Filament length = {0} mm", stringEvent.Data)));
2015-04-08 15:20:10 -07:00
}
}
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public void UpdatePartStatus(object sender, EventArgs e)
{
StringEventArgs stringEvent = e as StringEventArgs;
if (stringEvent != null)
{
nextLine.Text = " " + stringEvent.Data;
}
}
}
}