diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 86a422b5..7e329551 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -39,6 +39,7 @@ namespace VEPROMS VETreeNode _LastTreeNode = null; Step _LastStep = null; StepInfo _LastStepInfo = null; + ItemInfo _LastItemInfo = null; Color _CommentTitleBckColor; StepRTB _MyRTB; VETreeNode _PrevBookMark = null; @@ -185,65 +186,45 @@ namespace VEPROMS /// VETreeNode void SetupNodes(VETreeNode node) { - _LastTreeNode = node; - _LastFolderInfo = null; - _LastFolder = null; - _LastDocVersion = null; - _LastProcedure = null; - _LastSection = null; - _LastStep = null; epAnnotations.Expanded = false; epAnnotations.TitleStyle.BackColor1.Color = _CommentTitleBckColor; - if (_MyMRIList.Add(node.VEObject) != null) - SetupMRU(); - if (node.VEObject.GetType() == typeof(FolderInfo)) - { - _LastFolderInfo = (FolderInfo)(_LastTreeNode.VEObject); - _LastFolder = _LastFolderInfo.Get(); - } - else if (node.VEObject.GetType() == typeof(DocVersionInfo)) - { - _LastDocVersionInfo = (DocVersionInfo)(node.VEObject); - _LastDocVersion = _LastDocVersionInfo.Get(); - } - else if (node.VEObject.GetType() == typeof(ProcedureInfo)) - { - _LastProcedureInfo = (ProcedureInfo)(_LastTreeNode.VEObject); - _LastProcedure = _LastProcedureInfo.Get(); - - tc.OpenItem((ItemInfo)_LastProcedureInfo); - } - else if (node.VEObject.GetType() == typeof(SectionInfo)) - { - _LastSectionInfo = (SectionInfo)(_LastTreeNode.VEObject); - _LastSection = _LastSectionInfo.Get(); - tc.OpenItem((ItemInfo)_LastSectionInfo); - } - else if (node.VEObject.GetType() == typeof(StepInfo)) - { - _LastStepInfo = (StepInfo)(_LastTreeNode.VEObject); - _LastStep = _LastStepInfo.Get(); - tc.OpenItem((ItemInfo)_LastStepInfo); - #region Sample Display Table Code - // display an exiting table in that rtf grid thing - //if ((_LastStepInfo.MyContent.Type == 20007) || (_LastStepInfo.MyContent.Type == 20009)) - //{ - // //MessageBox.Show("Source Grid"); - // //frmTable newtable1 = new frmTable(_LastStepInfo.MyContent.Text); - // //newtable1.ShowDialog(); - // //MessageBox.Show("IGrid"); - // //frmIGrid newtable2 = new frmIGrid(_LastStepInfo.MyContent.Text); - // //newtable2.ShowDialog(); - // //MessageBox.Show("GridView"); //standard Visual Studio Control - // //frmGridView newtable3 = new frmGridView(_LastStepInfo.MyContent.Text); - // //newtable3.ShowDialog(); - // MessageBox.Show("FlexCell"); - // frmFlexCell newtable4 = new frmFlexCell(_LastStepInfo.MyContent.Text); - // newtable4.ShowDialog(); - //} - #endregion - } - SetCaption((VETreeNode)node); + SetLastValues(node); + #region Sample Display Table Code + // display an exiting table in that rtf grid thing + //if ((_LastStepInfo.MyContent.Type == 20007) || (_LastStepInfo.MyContent.Type == 20009)) + //{ + // //MessageBox.Show("Source Grid"); + // //frmTable newtable1 = new frmTable(_LastStepInfo.MyContent.Text); + // //newtable1.ShowDialog(); + // //MessageBox.Show("IGrid"); + // //frmIGrid newtable2 = new frmIGrid(_LastStepInfo.MyContent.Text); + // //newtable2.ShowDialog(); + // //MessageBox.Show("GridView"); //standard Visual Studio Control + // //frmGridView newtable3 = new frmGridView(_LastStepInfo.MyContent.Text); + // //newtable3.ShowDialog(); + // MessageBox.Show("FlexCell"); + // frmFlexCell newtable4 = new frmFlexCell(_LastStepInfo.MyContent.Text); + // newtable4.ShowDialog(); + //} + #endregion + if (_LastItemInfo != null) tc.OpenItem(_LastItemInfo); + SetCaption(node); + } + private void SetLastValues(VETreeNode node) + { + SaveIfChanged(); + _LastTreeNode = node; + _LastFolderInfo = _LastTreeNode.VEObject as FolderInfo; + _LastFolder = _LastFolderInfo == null ? null : _LastFolderInfo.Get(); + _LastDocVersionInfo = node.VEObject as DocVersionInfo; + _LastDocVersion = _LastDocVersionInfo == null ? null : _LastDocVersionInfo.Get(); + _LastProcedureInfo = _LastTreeNode.VEObject as ProcedureInfo; + _LastProcedure = _LastProcedureInfo == null ? null : _LastProcedureInfo.Get(); + _LastSectionInfo = _LastTreeNode.VEObject as SectionInfo; + _LastSection = _LastSectionInfo == null ? null : _LastSectionInfo.Get(); + _LastStepInfo = _LastTreeNode.VEObject as StepInfo; + _LastStep = _LastStepInfo == null ? null : _LastStepInfo.Get(); + _LastItemInfo = _LastTreeNode.VEObject as ItemInfo; } private void SetCaption(VETreeNode tn) @@ -378,7 +359,6 @@ namespace VEPROMS private void tmrTreeView_Tick(object sender, EventArgs e) { tmrTreeView.Enabled = false; // Timer has now fired - SaveIfChanged(); VETreeNode tn = tv.SelectedNode as VETreeNode; if (tn != null) SetupNodes(tn); } @@ -422,6 +402,7 @@ namespace VEPROMS // 1 - Button dialog interface // 2 - Tab dialog interface // 3 - Property Grid interface + SetLastValues((VETreeNode)(tv.SelectedNode)); this.Cursor = Cursors.WaitCursor; if ((int)Settings.Default["PropPageStyle"] == (int)PropPgStyle.Grid) DoPropertyGrid(); // Will display a Property Grid interface @@ -505,26 +486,26 @@ namespace VEPROMS private void DoPropertyPages() { // Display a property page. (the ppStyle selects either a tabbed or button interface) - VETreeNode tn = (VETreeNode)(tv.SelectedNode); - if (tn.VEObject.GetType() == typeof(FolderInfo)) + //VETreeNode tn = (VETreeNode)(tv.SelectedNode); + if (_LastFolder != null) { frmFolderProperties frmfld = new frmFolderProperties(_LastFolder.FolderConfig); if (frmfld.ShowDialog() == DialogResult.OK) _LastFolder.Save(); } - else if (tn.VEObject.GetType() == typeof(DocVersionInfo)) + else if (_LastDocVersion != null) { frmVersionsProperties frmver = new frmVersionsProperties(_LastDocVersion.DocVersionConfig); if (frmver.ShowDialog() == DialogResult.OK) _LastDocVersion.Save(); } - else if (tn.VEObject.GetType() == typeof(ProcedureInfo)) + else if (_LastProcedure != null) { frmProcedureProperties frmproc = new frmProcedureProperties(_LastProcedure.ProcedureConfig); if (frmproc.ShowDialog() == DialogResult.OK) _LastProcedure.Save(); } - else if (tn.VEObject.GetType() == typeof(SectionInfo)) + else if (_LastSection != null) { frmSectionProperties frmsec = new frmSectionProperties(_LastSection.SectionConfig); if (frmsec.ShowDialog() == DialogResult.OK) @@ -538,31 +519,31 @@ namespace VEPROMS private void DoPropertyGrid() { // Display a property grid - VETreeNode tn = (VETreeNode)(tv.SelectedNode); + //VETreeNode tn = (VETreeNode)(tv.SelectedNode); frmPropGrid propGrid = null; string title = ""; - if (tn.VEObject.GetType() == typeof(FolderInfo)) + if (_LastFolder != null) { title = string.Format("{0} Properties", _LastFolder.FolderConfig.Name); propGrid = new frmPropGrid(_LastFolder.FolderConfig, title); if (propGrid.ShowDialog() == DialogResult.OK) _LastFolder.Save(); } - else if (tn.VEObject.GetType() == typeof(DocVersionInfo)) + else if (_LastDocVersion != null) { title = string.Format("{0} Properties", _LastDocVersion.DocVersionConfig.Name); propGrid = new frmPropGrid(_LastDocVersion.DocVersionConfig, title); if (propGrid.ShowDialog() == DialogResult.OK) _LastDocVersion.Save(); } - else if (tn.VEObject.GetType() == typeof(ProcedureInfo)) + else if (_LastProcedure != null) { title = string.Format("{0} {1} Properties", _LastProcedure.ProcedureConfig.Number, _LastProcedure.ProcedureConfig.Title); propGrid = new frmPropGrid(_LastProcedure.ProcedureConfig, title); if (propGrid.ShowDialog() == DialogResult.OK) _LastProcedure.Save(); } - else if (tn.VEObject.GetType() == typeof(SectionInfo)) + else if (_LastSection != null) { if (_LastSection.SectionConfig.Number.Length > 0) title = string.Format("{0} {1} Properties", _LastSection.SectionConfig.Number, _LastSection.SectionConfig.Title);