Users.CurrentUser static class with Stack<UserAndForm> userStack, Change() and Restore().
This commit is contained in:
@@ -38,25 +38,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)
|
||||
|
||||
@@ -8,8 +8,8 @@ using System.Windows.Forms;
|
||||
using log4net;
|
||||
using NHibernate;
|
||||
using Common;
|
||||
using Config.Entities;
|
||||
using Common.Forms;
|
||||
using Config.Entities;
|
||||
using TBF.Rig;
|
||||
using TBF.Rig.Generic;
|
||||
using TBF.Resources;
|
||||
@@ -69,7 +69,8 @@ namespace TBF.UI.Bench.Components
|
||||
selectComponentTypeDlg = new SelectComponentClassDlg();
|
||||
|
||||
/// SharedDlgButtons configuration
|
||||
sharedButtons.RequiredGroupMembership = new Common.GID[] { Common.GID.Metrologists };
|
||||
sharedButtons.ParentForm = this;
|
||||
sharedButtons.RequiredGroupMembership = new GID[] { GID.Metrologists };
|
||||
|
||||
sharedButtons.OptionalButtons = SharedButtons.Buttons.Add |
|
||||
SharedButtons.Buttons.Remove |
|
||||
@@ -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,8 +699,10 @@ namespace TBF.UI.Bench.Components
|
||||
SaveDBChanges(session);
|
||||
}
|
||||
}
|
||||
|
||||
if (Users.CurrentUser.Restore(this)) Program.MainWnd.UpdateUser();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates component configuration from a script file
|
||||
|
||||
Reference in New Issue
Block a user