diff --git a/AboutPage/HTMLParser/HtmlParser.cs b/AboutPage/HTMLParser/HtmlParser.cs
index 63dce4a23..67bbb6999 100644
--- a/AboutPage/HTMLParser/HtmlParser.cs
+++ b/AboutPage/HTMLParser/HtmlParser.cs
@@ -40,8 +40,6 @@ namespace MatterHackers.MatterControl.HtmlParsing
private static List voidElements = new List() { "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" };
private Stack elementQueue = new Stack();
- public delegate void ProcessContent(HtmlParser htmlParser, string content);
-
public ElementState CurrentElementState { get { return elementQueue.Peek(); } }
public static string UrlDecode(string htmlContent)
@@ -52,7 +50,7 @@ namespace MatterHackers.MatterControl.HtmlParsing
return decoded;
}
- public void ParseHtml(string htmlContent, ProcessContent addContentFunction, ProcessContent closeContentFunction)
+ public void ParseHtml(string htmlContent, Action addContentFunction, Action closeContentFunction)
{
elementQueue.Push(new ElementState());
diff --git a/ActionBar/PrintStatusRow.cs b/ActionBar/PrintStatusRow.cs
index 2e13d0dd4..1350c04a5 100644
--- a/ActionBar/PrintStatusRow.cs
+++ b/ActionBar/PrintStatusRow.cs
@@ -82,9 +82,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
- public delegate void AddIconToPrintStatusRowDelegate(GuiWidget iconContainer);
-
- public static event AddIconToPrintStatusRowDelegate AddIconToPrintStatusRow
+ public static event Action AddIconToPrintStatusRow
{
add
{
@@ -99,7 +97,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
- private static event AddIconToPrintStatusRowDelegate privateAddIconToPrintStatusRow;
+ private static event Action privateAddIconToPrintStatusRow;
private event EventHandler unregisterEvents;
private string ActivePrintStatusText
diff --git a/MatterControl.csproj b/MatterControl.csproj
index 608abbd39..b5b4752b1 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -205,6 +205,7 @@
+
diff --git a/PartPreviewWindow/SaveAsWindow.cs b/PartPreviewWindow/SaveAsWindow.cs
index 32bab973c..7e529f7a3 100644
--- a/PartPreviewWindow/SaveAsWindow.cs
+++ b/PartPreviewWindow/SaveAsWindow.cs
@@ -12,18 +12,16 @@ namespace MatterHackers.MatterControl
{
public class SaveAsWindow : SystemWindow
{
+ private CheckBox addToLibraryOption;
+ private Action functionToCallOnSaveAs;
private TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
private MHTextEditWidget textToAddWidget;
- private CheckBox addToLibraryOption;
- public delegate void SetPrintItemWrapperAndSave(SaveAsReturnInfo returnInfo);
-
- private SetPrintItemWrapperAndSave functionToCallOnSaveAs;
-
- public SaveAsWindow(SetPrintItemWrapperAndSave functionToCallOnSaveAs)
+ public SaveAsWindow(Action functionToCallOnSaveAs)
: base(480, 250)
{
Title = "MatterControl - Save As";
+ AlwaysOnTopOfMain = true;
this.functionToCallOnSaveAs = functionToCallOnSaveAs;
@@ -40,7 +38,7 @@ namespace MatterHackers.MatterControl
//Creates Text and adds into header
{
- string saveAsLabel = "Save New Design to Queue:";
+ string saveAsLabel = "Save New Design to Queue".Localize() + ":";
TextWidget elementHeader = new TextWidget(saveAsLabel, pointSize: 14);
elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
elementHeader.HAnchor = HAnchor.ParentLeftRight;
@@ -60,24 +58,24 @@ namespace MatterHackers.MatterControl
middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
}
- string fileNameLabel = "Design Name";
+ string fileNameLabel = "Design Name".Localize();
TextWidget textBoxHeader = new TextWidget(fileNameLabel, pointSize: 12);
textBoxHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
textBoxHeader.Margin = new BorderDouble(5);
textBoxHeader.HAnchor = HAnchor.ParentLeft;
- string fileNameLabelFull = "Enter the name of your design.";
+ string fileNameLabelFull = "Enter the name of your design.".Localize(); ;
TextWidget textBoxHeaderFull = new TextWidget(fileNameLabelFull, pointSize: 9);
textBoxHeaderFull.TextColor = ActiveTheme.Instance.PrimaryTextColor;
textBoxHeaderFull.Margin = new BorderDouble(5);
textBoxHeaderFull.HAnchor = HAnchor.ParentLeftRight;
//Adds text box and check box to the above container
- textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter a Design Name Here");
+ textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter a Design Name Here".Localize());
textToAddWidget.HAnchor = HAnchor.ParentLeftRight;
textToAddWidget.Margin = new BorderDouble(5);
- addToLibraryOption = new CheckBox("Also save to Library", ActiveTheme.Instance.PrimaryTextColor);
+ addToLibraryOption = new CheckBox("Also save to Library".Localize(), ActiveTheme.Instance.PrimaryTextColor);
addToLibraryOption.Margin = new BorderDouble(5);
addToLibraryOption.HAnchor = HAnchor.ParentLeftRight;
@@ -107,7 +105,7 @@ namespace MatterHackers.MatterControl
//Adds SaveAs and Close Button to button container
buttonRow.AddChild(new HorizontalSpacer());
- Button cancelButton = textImageButtonFactory.Generate("Cancel", centerText: true);
+ Button cancelButton = textImageButtonFactory.Generate("Cancel".Localize(), centerText: true);
cancelButton.Visible = true;
cancelButton.Cursor = Cursors.Hand;
buttonRow.AddChild(cancelButton);
@@ -131,11 +129,25 @@ namespace MatterHackers.MatterControl
SubmitForm();
}
+ private void SubmitForm()
+ {
+ string newName = textToAddWidget.ActualTextEditWidget.Text;
+ if (newName != "")
+ {
+ string fileName = Path.ChangeExtension(Path.GetRandomFileName(), ".amf");
+ string fileNameAndPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, fileName);
+
+ SaveAsReturnInfo returnInfo = new SaveAsReturnInfo(newName, fileNameAndPath, addToLibraryOption.Checked);
+ functionToCallOnSaveAs(returnInfo);
+ CloseOnIdle();
+ }
+ }
+
public class SaveAsReturnInfo
{
public string fileNameAndPath;
- public bool placeInLibrary;
public string newName;
+ public bool placeInLibrary;
public PrintItemWrapper printItemWrapper;
public SaveAsReturnInfo(string newName, string fileNameAndPath, bool placeInLibrary)
@@ -153,19 +165,5 @@ namespace MatterHackers.MatterControl
printItemWrapper = new PrintItemWrapper(printItem);
}
}
-
- private void SubmitForm()
- {
- string newName = textToAddWidget.ActualTextEditWidget.Text;
- if (newName != "")
- {
- string fileName = Path.ChangeExtension(Path.GetRandomFileName(), ".amf");
- string fileNameAndPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, fileName);
-
- SaveAsReturnInfo returnInfo = new SaveAsReturnInfo(newName, fileNameAndPath, addToLibraryOption.Checked);
- functionToCallOnSaveAs(returnInfo);
- CloseOnIdle();
- }
- }
}
}
\ No newline at end of file
diff --git a/PartPreviewWindow/View3D/View3DWidget.cs b/PartPreviewWindow/View3D/View3DWidget.cs
index d83c385f2..179af9955 100644
--- a/PartPreviewWindow/View3D/View3DWidget.cs
+++ b/PartPreviewWindow/View3D/View3DWidget.cs
@@ -61,7 +61,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
internal HeightValueDisplay heightDisplay;
private readonly int EditButtonHeight = 44;
- private AfterSaveCallback afterSaveCallback = null;
+ private Action afterSaveCallback = null;
private Button applyScaleButton;
private List asynchMeshGroups = new List();
private List asynchMeshGroupTransforms = new List();
@@ -420,8 +420,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
};
}
- public delegate void AfterSaveCallback();
-
public enum AutoRotate { Enabled, Disabled };
public enum OpenMode { Viewing, Editing }
@@ -1932,7 +1930,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
- private void MergeAndSavePartsToCurrentMeshFile(AfterSaveCallback eventToCallAfterSave = null)
+ private void MergeAndSavePartsToCurrentMeshFile(Action eventToCallAfterSave = null)
{
editorThatRequestedSave = true;
afterSaveCallback = eventToCallAfterSave;
diff --git a/PrintLibrary/CreateFolderWindow.cs b/PrintLibrary/CreateFolderWindow.cs
new file mode 100644
index 000000000..4f0545705
--- /dev/null
+++ b/PrintLibrary/CreateFolderWindow.cs
@@ -0,0 +1,141 @@
+using MatterHackers.Agg;
+using MatterHackers.Agg.UI;
+using MatterHackers.Localizations;
+using MatterHackers.MatterControl.CustomWidgets;
+using MatterHackers.MatterControl.DataStorage;
+using System;
+using System.IO;
+
+namespace MatterHackers.MatterControl
+{
+ public class CreateFolderWindow : SystemWindow
+ {
+ private Action functionToCallToCreateNamedFolder;
+ private TextImageButtonFactory textImageButtonFactory = new TextImageButtonFactory();
+ private MHTextEditWidget textToAddWidget;
+
+ public CreateFolderWindow(Action functionToCallToCreateNamedFolder)
+ : base(480, 180)
+ {
+ Title = "MatterControl - Create Folder";
+ AlwaysOnTopOfMain = true;
+
+ this.functionToCallToCreateNamedFolder = functionToCallToCreateNamedFolder;
+
+ FlowLayoutWidget topToBottom = new FlowLayoutWidget(FlowDirection.TopToBottom);
+ topToBottom.AnchorAll();
+ topToBottom.Padding = new BorderDouble(3, 0, 3, 5);
+
+ // Creates Header
+ FlowLayoutWidget headerRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
+ headerRow.HAnchor = HAnchor.ParentLeftRight;
+ headerRow.Margin = new BorderDouble(0, 3, 0, 0);
+ headerRow.Padding = new BorderDouble(0, 3, 0, 3);
+ BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
+
+ //Creates Text and adds into header
+ {
+ string createFolderLabel = "Create New Folder:".Localize();
+ TextWidget elementHeader = new TextWidget(createFolderLabel, pointSize: 14);
+ elementHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
+ elementHeader.HAnchor = HAnchor.ParentLeftRight;
+ elementHeader.VAnchor = Agg.UI.VAnchor.ParentBottom;
+
+ headerRow.AddChild(elementHeader);
+ topToBottom.AddChild(headerRow);
+ this.AddChild(topToBottom);
+ }
+
+ //Creates container in the middle of window
+ FlowLayoutWidget middleRowContainer = new FlowLayoutWidget(FlowDirection.TopToBottom);
+ {
+ middleRowContainer.HAnchor = HAnchor.ParentLeftRight;
+ middleRowContainer.VAnchor = VAnchor.ParentBottomTop;
+ middleRowContainer.Padding = new BorderDouble(5);
+ middleRowContainer.BackgroundColor = ActiveTheme.Instance.SecondaryBackgroundColor;
+ }
+
+ string fileNameLabel = "Folder Name".Localize();
+ TextWidget textBoxHeader = new TextWidget(fileNameLabel, pointSize: 12);
+ textBoxHeader.TextColor = ActiveTheme.Instance.PrimaryTextColor;
+ textBoxHeader.Margin = new BorderDouble(5);
+ textBoxHeader.HAnchor = HAnchor.ParentLeft;
+
+ //Adds text box and check box to the above container
+ textToAddWidget = new MHTextEditWidget("", pixelWidth: 300, messageWhenEmptyAndNotSelected: "Enter a Folder Name Here".Localize());
+ textToAddWidget.HAnchor = HAnchor.ParentLeftRight;
+ textToAddWidget.Margin = new BorderDouble(5);
+
+ middleRowContainer.AddChild(textBoxHeader);
+ middleRowContainer.AddChild(textToAddWidget);
+ middleRowContainer.AddChild(new HorizontalSpacer());
+ topToBottom.AddChild(middleRowContainer);
+
+ //Creates button container on the bottom of window
+ FlowLayoutWidget buttonRow = new FlowLayoutWidget(FlowDirection.LeftToRight);
+ {
+ BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor;
+ buttonRow.HAnchor = HAnchor.ParentLeftRight;
+ buttonRow.Padding = new BorderDouble(0, 3);
+ }
+
+ Button createFolderButton = textImageButtonFactory.Generate("Create".Localize(), centerText: true);
+ createFolderButton.Visible = true;
+ createFolderButton.Cursor = Cursors.Hand;
+ buttonRow.AddChild(createFolderButton);
+
+ createFolderButton.Click += new EventHandler(createFolderButton_Click);
+ textToAddWidget.ActualTextEditWidget.EnterPressed += new KeyEventHandler(ActualTextEditWidget_EnterPressed);
+
+ //Adds Create and Close Button to button container
+ buttonRow.AddChild(new HorizontalSpacer());
+
+ Button cancelButton = textImageButtonFactory.Generate("Cancel".Localize(), centerText: true);
+ cancelButton.Visible = true;
+ cancelButton.Cursor = Cursors.Hand;
+ buttonRow.AddChild(cancelButton);
+ cancelButton.Click += (sender, e) =>
+ {
+ CloseOnIdle();
+ };
+
+ topToBottom.AddChild(buttonRow);
+
+ ShowAsSystemWindow();
+ }
+
+ private void ActualTextEditWidget_EnterPressed(object sender, KeyEventArgs keyEvent)
+ {
+ SubmitForm();
+ }
+
+ private void createFolderButton_Click(object sender, EventArgs mouseEvent)
+ {
+ SubmitForm();
+ }
+
+ private void SubmitForm()
+ {
+ string newName = textToAddWidget.ActualTextEditWidget.Text;
+ if (newName != "")
+ {
+ string fileName = Path.ChangeExtension(Path.GetRandomFileName(), ".amf");
+ string fileNameAndPath = Path.Combine(ApplicationDataStorage.Instance.ApplicationLibraryDataPath, fileName);
+
+ CreateFolderReturnInfo returnInfo = new CreateFolderReturnInfo(newName);
+ functionToCallToCreateNamedFolder(returnInfo);
+ CloseOnIdle();
+ }
+ }
+
+ public class CreateFolderReturnInfo
+ {
+ public string newName;
+
+ public CreateFolderReturnInfo(string newName)
+ {
+ this.newName = newName;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/PrintLibrary/LibraryDataView.cs b/PrintLibrary/LibraryDataView.cs
index eaa7a036d..47dd20859 100644
--- a/PrintLibrary/LibraryDataView.cs
+++ b/PrintLibrary/LibraryDataView.cs
@@ -92,9 +92,7 @@ namespace MatterHackers.MatterControl.PrintLibrary
this.SelectedItems.Clear();
}
- public delegate void SelectedValueChangedEventHandler(object sender, EventArgs e);
-
- public event SelectedValueChangedEventHandler SelectedValueChanged;
+ public event Action