Fixing bug on property selection

This commit is contained in:
Rich 2008-05-30 10:20:54 +00:00
parent fe9b4ebac8
commit 663e999037

View File

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