Made the queue item index preserve (again)
Made the main screen tab preserve (again) Made a pre and post change panels event (much cleaner, but not everything is using it yet).
This commit is contained in:
parent
0d38435ed7
commit
fb2d34a1bb
4 changed files with 13 additions and 12 deletions
|
|
@ -99,6 +99,8 @@ namespace MatterHackers.MatterControl
|
|||
QueueData.Instance.ItemRemoved.RegisterEvent(NumQueueItemsChanged, ref unregisterEvents);
|
||||
UpdateControlData.Instance.UpdateStatusChanged.RegisterEvent(SetUpdateNotification, ref unregisterEvents);
|
||||
|
||||
WidescreenPanel.PreChangePannels.RegisterEvent(SaveCurrentTab, ref unregisterEvents);
|
||||
|
||||
SelectedTabIndex = tabStateBeforeClose;
|
||||
}
|
||||
|
||||
|
|
@ -109,10 +111,9 @@ namespace MatterHackers.MatterControl
|
|||
QueueTabPage.Text = string.Format(queueString, QueueData.Instance.Count);
|
||||
}
|
||||
|
||||
public override void OnClosing(out bool cancelClose)
|
||||
void SaveCurrentTab(object sender, EventArgs e)
|
||||
{
|
||||
tabStateBeforeClose = SelectedTabIndex;
|
||||
base.OnClosing(out cancelClose);
|
||||
}
|
||||
|
||||
public override void OnClosed(EventArgs e)
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
event EventHandler unregisterEvents;
|
||||
|
||||
public static RootedObjectEventHandler PreChangePannels = new RootedObjectEventHandler();
|
||||
public static RootedObjectEventHandler PostChangePannels = new RootedObjectEventHandler();
|
||||
|
||||
QueueDataView queueDataView = null;
|
||||
|
||||
public WidescreenPanel()
|
||||
|
|
@ -206,10 +209,6 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public void StoreUiState()
|
||||
{
|
||||
if (queueDataView != null)
|
||||
{
|
||||
MainScreenUiState.lastSelectedIndex = queueDataView.SelectedIndex;
|
||||
}
|
||||
if (advancedControls != null)
|
||||
{
|
||||
MainScreenUiState.lastAdvancedControlsTab = advancedControls.SelectedTabIndex;
|
||||
|
|
@ -218,10 +217,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
void RestoreUiState()
|
||||
{
|
||||
if (MainScreenUiState.lastSelectedIndex != MainScreenUiState.EmpytValue && queueDataView != null)
|
||||
{
|
||||
queueDataView.SelectedIndex = MainScreenUiState.lastSelectedIndex;
|
||||
}
|
||||
queueDataView.SelectedIndex = QueueDataView.lastSelectedTabOnAnyView;
|
||||
|
||||
if (MainScreenUiState.lastAdvancedControlsTab != MainScreenUiState.EmpytValue && advancedControls != null)
|
||||
{
|
||||
advancedControls.SelectedTabIndex = MainScreenUiState.lastAdvancedControlsTab;
|
||||
|
|
@ -295,6 +292,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
return;
|
||||
}
|
||||
PreChangePannels.CallEvents(this, null);
|
||||
StoreUiState();
|
||||
RemovePanelsAndCreateEmpties();
|
||||
|
||||
|
|
@ -326,6 +324,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
RestoreUiState();
|
||||
lastNumberVisible = numberOfPanels;
|
||||
PostChangePannels.CallEvents(this, null);
|
||||
}
|
||||
|
||||
void SetColumnVisibility(object state = null)
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@ namespace MatterHackers.MatterControl
|
|||
public static class MainScreenUiState
|
||||
{
|
||||
public static readonly int EmpytValue = -2;
|
||||
public static int lastMainScreenTabIndex = 0;
|
||||
public static int lastSelectedIndex = EmpytValue;
|
||||
public static int lastAdvancedControlsTab = EmpytValue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -193,6 +193,8 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
}
|
||||
}
|
||||
|
||||
public static int lastSelectedTabOnAnyView = 0;
|
||||
|
||||
public int SelectedIndex
|
||||
{
|
||||
get
|
||||
|
|
@ -206,6 +208,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
lastSelectedTabOnAnyView = value;
|
||||
selectedIndex = value;
|
||||
OnSelectedIndexChanged();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue