Common..CurrentUser static class with Stack<UserAndForm> userStack, Change( ) and Restore( ).
This commit is contained in:
@@ -37,25 +37,31 @@ namespace TBF.UI.Bench.Components
|
||||
|
||||
int cmpntEntityId;
|
||||
|
||||
ComponentParametersDlg()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a window to edit component configuration
|
||||
/// </summary>
|
||||
/// <param name="cmpntEntityId">Config.Entities.Component.Id or 0 when this is a new/copied/immported component</param>
|
||||
public ComponentParametersDlg(int cmpntEntityId = 0)
|
||||
public ComponentParametersDlg(Form parentForm, int cmpntEntityId = 0)
|
||||
: this()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.cmpntEntityId = cmpntEntityId;
|
||||
Flags = CfgUpdateFlags.None;
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = parentForm;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
sharedButtons.MoreButtonTop = ComponentCfgCtrlHeight - 45;
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.None;
|
||||
sharedButtons.Unlocked += Unlock;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.MoreClicked += moreButton_Click;
|
||||
sharedButtons.Unlocked += Unlock;
|
||||
sharedButtons.OKClicked += okButton_Click;
|
||||
sharedButtons.CancelClicked += cancelButton_Click;
|
||||
sharedButtons.MoreClicked += moreButton_Click;
|
||||
|
||||
Flags = CfgUpdateFlags.None;
|
||||
}
|
||||
|
||||
private void ComponentCfgForm_Load(object sender, EventArgs e)
|
||||
|
||||
@@ -69,6 +69,7 @@ namespace TBF.UI.Bench.Components
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
@@ -421,7 +422,7 @@ namespace TBF.UI.Bench.Components
|
||||
cfgControl.Config = cfg;
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@@ -502,7 +503,7 @@ namespace TBF.UI.Bench.Components
|
||||
IComponentCfg cfg = TbfComponents.CmpntCfgFromCmpntEntity(component);
|
||||
if (cfg != null)
|
||||
{
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(component.Id);
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this, component.Id);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfg.GetControl(cmpntEntities);
|
||||
cfgForm.ComponentCfgCtrl.Config = cfg;
|
||||
@@ -544,7 +545,7 @@ namespace TBF.UI.Bench.Components
|
||||
cfgControl.Config = cfg;
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@@ -589,7 +590,7 @@ namespace TBF.UI.Bench.Components
|
||||
cfgControl.Config.Name = cfgControl.Config.Name + " imported";
|
||||
cfgControl.Config.ItemNr = (cmpntEntities.Count > 0) ? (cmpntEntities[cmpntEntities.Count - 1].ItemNr + 1) : 1;
|
||||
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg();
|
||||
ComponentParametersDlg cfgForm = new ComponentParametersDlg(this);
|
||||
cfgForm.CmpntEntities = cmpntEntities;
|
||||
cfgForm.ComponentCfgCtrl = cfgControl;
|
||||
cfgForm.UnlockAfterStart = true;
|
||||
@@ -698,6 +699,8 @@ namespace TBF.UI.Bench.Components
|
||||
SaveDBChanges(session);
|
||||
}
|
||||
}
|
||||
|
||||
if (CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user