mattercontrol/CustomWidgets/SavePartsSheetFeedbackWindow.cs

57 lines
1.7 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;
using MatterHackers.Localizations;
2015-04-08 15:20:10 -07:00
using System;
2014-01-29 19:09:30 -08:00
namespace MatterHackers.MatterControl
{
2015-04-08 15:20:10 -07:00
public class SavePartsSheetFeedbackWindow : SystemWindow
{
private int totalParts;
private int count = 0;
private FlowLayoutWidget feedback = new FlowLayoutWidget(FlowDirection.TopToBottom);
2014-01-29 19:09:30 -08:00
2015-04-08 15:20:10 -07:00
public SavePartsSheetFeedbackWindow(int totalParts, string firstPartName, RGBA_Bytes backgroundColor)
: base(300, 500)
{
BackgroundColor = backgroundColor;
2014-03-11 15:24:47 -07:00
string savePartSheetTitle = LocalizedString.Get("MatterControl");
string savePartSheetTitleFull = LocalizedString.Get("Saving to Parts Sheet");
2015-04-08 15:20:10 -07:00
Title = string.Format("{0} - {1}", savePartSheetTitle, savePartSheetTitleFull);
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
private TextWidget CreateNextLine(string startText)
{
TextWidget nextLine = new TextWidget(startText, textColor: ActiveTheme.Instance.PrimaryTextColor);
2015-04-08 15:20:10 -07:00
nextLine.Margin = new BorderDouble(0, 2);
nextLine.HAnchor = Agg.UI.HAnchor.ParentLeft;
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);
feedback.AddChild(CreateNextLine(partDescription));
}
}
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)
{
feedback.AddChild(CreateNextLine(string.Format("{0}", stringEvent.Data)));
}
}
}
}