Json Profiles
This commit is contained in:
parent
bfa2ddafd8
commit
4496720772
93 changed files with 3069 additions and 4120 deletions
|
|
@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl
|
|||
this.Margin = new BorderDouble(0);
|
||||
this.Padding = new BorderDouble(0);
|
||||
this.VAnchor = Agg.UI.VAnchor.ParentCenter;
|
||||
this.MenuDropList.SelectionChanged += new EventHandler(MenuDropList_SelectionChanged);
|
||||
this.MenuDropList.SelectionChanged += MenuDropList_SelectionChanged;
|
||||
this.MenuDropList.OpenOffset = new Vector2(0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -64,9 +64,9 @@ namespace MatterHackers.MatterControl
|
|||
string menuSelection = ((DropDownMenu)sender).SelectedValue;
|
||||
foreach (MenuItemAction item in menuItems)
|
||||
{
|
||||
if (item.Title == menuSelection)
|
||||
if (item.Title == menuSelection && item.Action != null)
|
||||
{
|
||||
item.Action?.Invoke();
|
||||
UiThread.RunOnIdle(item.Action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|||
using MatterHackers.VectorMath;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace MatterHackers.MatterControl
|
||||
{
|
||||
|
|
@ -18,127 +19,69 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public static MenuOptionFile CurrentMenuOptionFile = null;
|
||||
|
||||
public event EventHandler<StringEventArgs> AddLocalFolderToLibrary;
|
||||
public EventHandler RedeemDesignCode;
|
||||
public EventHandler EnterShareCode;
|
||||
public EventHandler EnterShareCode;
|
||||
|
||||
public MenuOptionFile()
|
||||
: base("File".Localize())
|
||||
{
|
||||
Name = "File Menu";
|
||||
CurrentMenuOptionFile = this;
|
||||
|
||||
}
|
||||
|
||||
override protected IEnumerable<MenuItemAction> GetMenuItems()
|
||||
protected override IEnumerable<MenuItemAction> GetMenuItems()
|
||||
{
|
||||
return new List<MenuItemAction>
|
||||
{
|
||||
new MenuItemAction("Add Printer".Localize(), addPrinter_Click),
|
||||
new MenuItemAction("Add File To Queue".Localize(), importFile_Click),
|
||||
//new MenuItemAction("Add Folder To Library".Localize(), addFolderToLibrar_Click),
|
||||
new MenuItemAction("Redeem Design Code".Localize(), redeemDesignCode_Click),
|
||||
new MenuItemAction("Enter Share Code".Localize(), enterShareCode_Click),
|
||||
new MenuItemAction("Add Printer".Localize(), () => ConnectionWizard.Show()),
|
||||
new MenuItemAction("Add File To Queue".Localize(), importFile_Click),
|
||||
new MenuItemAction("Redeem Design Code".Localize(), () => RedeemDesignCode?.Invoke(this, null)),
|
||||
new MenuItemAction("Enter Share Code".Localize(), () => EnterShareCode?.Invoke(this, null)),
|
||||
new MenuItemAction("------------------------", null),
|
||||
new MenuItemAction("Exit".Localize(), exit_Click),
|
||||
};
|
||||
}
|
||||
|
||||
private void redeemDesignCode_Click()
|
||||
{
|
||||
if (RedeemDesignCode != null)
|
||||
{
|
||||
RedeemDesignCode(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void enterShareCode_Click()
|
||||
{
|
||||
if (EnterShareCode != null)
|
||||
{
|
||||
UiThread.RunOnIdle(() => EnterShareCode(this, null));
|
||||
}
|
||||
}
|
||||
|
||||
private void addFolderToLibrar_Click()
|
||||
{
|
||||
if (AddLocalFolderToLibrary != null)
|
||||
{
|
||||
if (createFolderWindow == null)
|
||||
new MenuItemAction("Exit".Localize(), () =>
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
createFolderWindow = new CreateFolderWindow((returnInfo) =>
|
||||
{
|
||||
AddLocalFolderToLibrary(this, new StringEventArgs(returnInfo.newName));
|
||||
});
|
||||
createFolderWindow.Closed += (sender2, e2) => { createFolderWindow = null; };
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
createFolderWindow.BringToFront();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addPrinter_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(ConnectionWindow.Show);
|
||||
MatterControlApplication app = this.Parents<MatterControlApplication>().FirstOrDefault();
|
||||
app.RestartOnClose = false;
|
||||
app.Close();
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
private void importFile_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
FileDialog.OpenFileDialog(
|
||||
new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams)
|
||||
FileDialog.OpenFileDialog(
|
||||
new OpenFileDialogParams(ApplicationSettings.OpenPrintableFileParams)
|
||||
{
|
||||
MultiSelect = true,
|
||||
ActionButtonLabel = "Add to Queue",
|
||||
Title = "MatterControl: Select A File"
|
||||
},
|
||||
(openParams) =>
|
||||
{
|
||||
if (openParams.FileNames != null)
|
||||
{
|
||||
MultiSelect = true,
|
||||
ActionButtonLabel = "Add to Queue",
|
||||
Title = "MatterControl: Select A File"
|
||||
},
|
||||
(openParams) =>
|
||||
{
|
||||
if (openParams.FileNames != null)
|
||||
foreach (string loadedFileName in openParams.FileNames)
|
||||
{
|
||||
foreach (string loadedFileName in openParams.FileNames)
|
||||
if (Path.GetExtension(loadedFileName).ToUpper() == ".ZIP")
|
||||
{
|
||||
if (Path.GetExtension(loadedFileName).ToUpper() == ".ZIP")
|
||||
{
|
||||
ProjectFileHandler project = new ProjectFileHandler(null);
|
||||
List<PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName);
|
||||
if (partFiles != null)
|
||||
{
|
||||
foreach (PrintItem part in partFiles)
|
||||
{
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName))));
|
||||
}
|
||||
ProjectFileHandler project = new ProjectFileHandler(null);
|
||||
List<PrintItem> partFiles = project.ImportFromProjectArchive(loadedFileName);
|
||||
if (partFiles != null)
|
||||
{
|
||||
foreach (PrintItem part in partFiles)
|
||||
{
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(part.Name, part.FileLocation)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(Path.GetFileNameWithoutExtension(loadedFileName), Path.GetFullPath(loadedFileName))));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void exit_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
GuiWidget parent = this;
|
||||
while (parent as MatterControlApplication == null)
|
||||
{
|
||||
parent = parent.Parent;
|
||||
}
|
||||
|
||||
MatterControlApplication app = parent as MatterControlApplication;
|
||||
app.RestartOnClose = false;
|
||||
app.Close();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,81 +11,30 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
public class MenuOptionHelp : MenuBase
|
||||
{
|
||||
public MenuOptionHelp()
|
||||
: base("Help".Localize())
|
||||
public MenuOptionHelp() : base("Help".Localize())
|
||||
{
|
||||
Name = "Help Menu";
|
||||
}
|
||||
|
||||
override protected IEnumerable<MenuItemAction> GetMenuItems()
|
||||
protected override IEnumerable<MenuItemAction> GetMenuItems()
|
||||
{
|
||||
return new List<MenuItemAction>
|
||||
{
|
||||
new MenuItemAction("Getting Started".Localize(), gettingStarted_Click),
|
||||
new MenuItemAction("View Help".Localize(), help_Click),
|
||||
new MenuItemAction("Release Notes".Localize(), notes_Click),
|
||||
new MenuItemAction("User Manual".Localize(), manual_Click),
|
||||
new MenuItemAction("------------------------", null),
|
||||
new MenuItemAction("Report a Bug".Localize(), bug_Click),
|
||||
new MenuItemAction("Check For Update".Localize(), checkForUpdate_Click),
|
||||
{
|
||||
new MenuItemAction("Getting Started".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles/mattercontrol-getting-started")),
|
||||
new MenuItemAction("View Help".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles")),
|
||||
new MenuItemAction("Release Notes".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com/Release_Notes")),
|
||||
new MenuItemAction("User Manual".Localize(), () => MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com")),
|
||||
new MenuItemAction("------------------------", null),
|
||||
new MenuItemAction("About MatterControl".Localize(), about_Click),
|
||||
};
|
||||
}
|
||||
|
||||
private void bug_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
ContactFormWindow.Open();
|
||||
});
|
||||
}
|
||||
|
||||
private void help_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles");
|
||||
});
|
||||
}
|
||||
|
||||
private void checkForUpdate_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
ApplicationMenuRow.AlwaysShowUpdateStatus = true;
|
||||
UpdateControlData.Instance.CheckForUpdateUserRequested();
|
||||
CheckForUpdateWindow.Show();
|
||||
});
|
||||
}
|
||||
|
||||
private void about_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(AboutWindow.Show);
|
||||
}
|
||||
|
||||
private void notes_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
new MenuItemAction("Report a Bug".Localize(), () => ContactFormWindow.Open()),
|
||||
new MenuItemAction("Check For Update".Localize(), () =>
|
||||
{
|
||||
MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com/Release_Notes");
|
||||
});
|
||||
ApplicationMenuRow.AlwaysShowUpdateStatus = true;
|
||||
UpdateControlData.Instance.CheckForUpdateUserRequested();
|
||||
CheckForUpdateWindow.Show();
|
||||
}),
|
||||
new MenuItemAction("------------------------", null),
|
||||
new MenuItemAction("About MatterControl".Localize(), () => AboutWindow.Show()),
|
||||
};
|
||||
}
|
||||
|
||||
private void gettingStarted_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
MatterControlApplication.Instance.LaunchBrowser("http://www.mattercontrol.com/articles/mattercontrol-getting-started");
|
||||
});
|
||||
}
|
||||
|
||||
private void manual_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
MatterControlApplication.Instance.LaunchBrowser("http://wiki.mattercontrol.com");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,47 +17,18 @@ namespace MatterHackers.MatterControl
|
|||
static public PopOutTextTabWidget sliceSettingsPopOut = null;
|
||||
static public PopOutTextTabWidget controlsPopOut = null;
|
||||
|
||||
public MenuOptionSettings()
|
||||
: base("View".Localize())
|
||||
public MenuOptionSettings() : base("View".Localize())
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
override protected IEnumerable<MenuItemAction> GetMenuItems()
|
||||
protected override IEnumerable<MenuItemAction> GetMenuItems()
|
||||
{
|
||||
return new List<MenuItemAction>
|
||||
{
|
||||
new MenuItemAction("Settings".Localize(), openPrintingPanel_Click),
|
||||
new MenuItemAction("Controls".Localize(), openControlsPanel_Click),
|
||||
new MenuItemAction("Terminal".Localize(), openTermanialPanel_Click),
|
||||
};
|
||||
}
|
||||
|
||||
private void openPrintingPanel_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (sliceSettingsPopOut != null)
|
||||
{
|
||||
sliceSettingsPopOut.ShowInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openControlsPanel_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (controlsPopOut != null)
|
||||
{
|
||||
controlsPopOut.ShowInWindow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void openTermanialPanel_Click()
|
||||
{
|
||||
UiThread.RunOnIdle(TerminalWindow.Show);
|
||||
new MenuItemAction("Settings".Localize(), () => sliceSettingsPopOut?.ShowInWindow()),
|
||||
new MenuItemAction("Controls".Localize(), () => controlsPopOut?.ShowInWindow()),
|
||||
new MenuItemAction("Terminal".Localize(), () => UiThread.RunOnIdle(TerminalWindow.Show)),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue