Improving simple mode
This commit is contained in:
parent
11d6b659fb
commit
51d1e33f9d
9 changed files with 112 additions and 68 deletions
|
|
@ -383,6 +383,27 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public event EventHandler<WorkspacesChangedEventArgs> WorkspacesChanged;
|
||||
|
||||
public void ReloadSliceSettings(PrinterConfig printerConfig)
|
||||
{
|
||||
if (this.Workspaces.FirstOrDefault(w => w.Printer?.Settings.ID == printer.Settings.ID) is PartWorkspace workspace)
|
||||
{
|
||||
var xxx = workspace.SceneContext.EditContext.
|
||||
UserSettings.Instance.set(UserSettingsKey.SliceSettingsViewDetail, level);
|
||||
var printerTabPage = this.Parents<PrinterTabPage>().FirstOrDefault();
|
||||
if (printerTabPage != null)
|
||||
{
|
||||
var sideBar = printerTabPage.Descendants<DockingTabControl>().FirstOrDefault();
|
||||
sideBar.ReplacePage("Slice Settings",
|
||||
new SliceSettingsWidget(printer,
|
||||
new SettingsContext(
|
||||
printer,
|
||||
null,
|
||||
NamedSettingsLayers.All),
|
||||
theme));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Action WebRequestFailed;
|
||||
public static Action WebRequestSucceeded;
|
||||
|
||||
|
|
|
|||
|
|
@ -312,11 +312,23 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
// Fire ReloadAll if changed setting marked with ReloadUiWhenChanged
|
||||
if (PrinterSettings.SettingsData.TryGetValue(stringEvent.Data, out SliceSettingData settingsData)
|
||||
&& settingsData.ReloadUiWhenChanged)
|
||||
&& settingsData.UiUpdate != SliceSettingData.UiUpdateRequired.None)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
ApplicationController.Instance.ReloadAll().ConfigureAwait(false);
|
||||
switch (settingsData.UiUpdate)
|
||||
{
|
||||
case SliceSettingData.UiUpdateRequired.Application:
|
||||
ApplicationController.Instance.ReloadAll().ConfigureAwait(false);
|
||||
break;
|
||||
|
||||
case SliceSettingData.UiUpdateRequired.SliceSettings:
|
||||
ApplicationController.Instance.ReloadSliceSettings(this);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
});
|
||||
|
||||
// No further processing if changed setting has ReloadUiWhenChanged set
|
||||
|
|
|
|||
|
|
@ -98,6 +98,25 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
}
|
||||
|
||||
public void ReplacePage(string key, GuiWidget widget, bool allowRebuild = true)
|
||||
{
|
||||
foreach (var tab in allTabs)
|
||||
{
|
||||
if (tab.key == key)
|
||||
{
|
||||
var index = allTabs.IndexOf(tab);
|
||||
allTabs.Remove(tab);
|
||||
allTabs.Add((tab.key, tab.text, widget));
|
||||
if (allowRebuild)
|
||||
{
|
||||
this.Rebuild();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void RemovePage(string key, bool allowRebuild = true)
|
||||
{
|
||||
foreach (var tab in allTabs)
|
||||
|
|
|
|||
|
|
@ -418,8 +418,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
if (value)
|
||||
{
|
||||
UserSettings.Instance.set(UserSettingsKey.SliceSettingsViewDetail, level);
|
||||
ApplicationController.Instance.ReloadAll().ConfigureAwait(false);
|
||||
ApplicationController.Instance.ReloadSliceSettings(printer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue