Tree node fixes when deleting nodes
This commit is contained in:
parent
61c9d01516
commit
cdf14f6328
@ -32,20 +32,21 @@ namespace VEPROMS
|
|||||||
private bool _panelExpandedChanging = false;
|
private bool _panelExpandedChanging = false;
|
||||||
Color _CommentTitleBckColor;
|
Color _CommentTitleBckColor;
|
||||||
DocVersionInfo _SelectedDVI = null;
|
DocVersionInfo _SelectedDVI = null;
|
||||||
StepTabPanel _SelectedStepTabPanel=null;
|
StepTabPanel _SelectedStepTabPanel = null;
|
||||||
public FindReplace dlgFindReplace = null;
|
public FindReplace dlgFindReplace = null;
|
||||||
|
|
||||||
public StepTabPanel SelectedStepTabPanel
|
public StepTabPanel SelectedStepTabPanel
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _SelectedStepTabPanel;
|
return _SelectedStepTabPanel;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
_SelectedStepTabPanel = value;
|
_SelectedStepTabPanel = value;
|
||||||
if (value == null) // DSO Tab Panel
|
if (value == null) // DSO Tab Panel
|
||||||
{
|
{
|
||||||
|
//dlgFindReplace.Visible = false; // Find/Replace dialog should not be visable for DSO tab panels
|
||||||
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyItemInfo != null) // 2nd part is for unassociated libdocs
|
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.MyItemInfo != null) // 2nd part is for unassociated libdocs
|
||||||
SelectedDVI = tc.SelectedDisplayTabItem.MyItemInfo.ActiveParent.ActiveParent as DocVersionInfo;
|
SelectedDVI = tc.SelectedDisplayTabItem.MyItemInfo.ActiveParent.ActiveParent as DocVersionInfo;
|
||||||
else
|
else
|
||||||
@ -58,15 +59,15 @@ namespace VEPROMS
|
|||||||
public DocVersionInfo SelectedDVI
|
public DocVersionInfo SelectedDVI
|
||||||
{
|
{
|
||||||
get { return _SelectedDVI; }
|
get { return _SelectedDVI; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_SelectedDVI != value)
|
if (_SelectedDVI != value)
|
||||||
{
|
{
|
||||||
_SelectedDVI = value;
|
_SelectedDVI = value;
|
||||||
_SelectedROFst = null;
|
_SelectedROFst = null;
|
||||||
}
|
}
|
||||||
InitiateSearch(false);
|
InitiateSearch(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// TODO: Should the following be an info
|
// TODO: Should the following be an info
|
||||||
// For the initial release, we are assuming there will be only one rofst fro a docversion. Changes
|
// For the initial release, we are assuming there will be only one rofst fro a docversion. Changes
|
||||||
@ -74,11 +75,11 @@ namespace VEPROMS
|
|||||||
private ROFstInfo _SelectedROFst;
|
private ROFstInfo _SelectedROFst;
|
||||||
public ROFstInfo SelectedROFst
|
public ROFstInfo SelectedROFst
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if(_SelectedROFst == null && SelectedDVI != null)
|
if (_SelectedROFst == null && SelectedDVI != null)
|
||||||
_SelectedROFst = SelectedDVI.DocVersionAssociations[0].MyROFst;
|
_SelectedROFst = SelectedDVI.DocVersionAssociations[0].MyROFst;
|
||||||
return _SelectedROFst;
|
return _SelectedROFst;
|
||||||
}
|
}
|
||||||
set { _SelectedROFst = value; }
|
set { _SelectedROFst = value; }
|
||||||
}
|
}
|
||||||
@ -131,8 +132,8 @@ namespace VEPROMS
|
|||||||
if (!btnAnnoDetailsPushPin.Checked)
|
if (!btnAnnoDetailsPushPin.Checked)
|
||||||
epAnnotations.Expanded = false;
|
epAnnotations.Expanded = false;
|
||||||
infoPanel.Expanded = false;
|
infoPanel.Expanded = false;
|
||||||
toolsPanel.Expanded = false;
|
toolsPanel.Expanded = false;
|
||||||
ribbonControl1.ExpandedChanged +=new EventHandler(ribbonControl1_ExpandedChanged);
|
ribbonControl1.ExpandedChanged += new EventHandler(ribbonControl1_ExpandedChanged);
|
||||||
dlgFindReplace = new FindReplace();
|
dlgFindReplace = new FindReplace();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ namespace VEPROMS
|
|||||||
//si.RemoveItem();
|
//si.RemoveItem();
|
||||||
//return true;
|
//return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
|
private void frmVEPROMS_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
// Save the location and size of the VE-PROMS appication for this user
|
// Save the location and size of the VE-PROMS appication for this user
|
||||||
@ -305,8 +306,8 @@ namespace VEPROMS
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
//private void tv_Click(object sender, EventArgs e)
|
//private void tv_Click(object sender, EventArgs e)
|
||||||
//{
|
//{
|
||||||
//tv.Enabled = false;
|
//tv.Enabled = false;
|
||||||
//tmrTreeView.Enabled = true;
|
//tmrTreeView.Enabled = true;
|
||||||
//}
|
//}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This opens nodes if the mouse is within the bounds of a node.
|
/// This opens nodes if the mouse is within the bounds of a node.
|
||||||
@ -330,6 +331,8 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (tn != null && tn.Bounds.Left < newPoint.X + 30)
|
||||||
|
return;
|
||||||
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null)
|
if (tc.SelectedDisplayTabItem != null && tc.SelectedDisplayTabItem.SelectedItemInfo != null)
|
||||||
{
|
{
|
||||||
tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo);
|
tv.AdjustTree(tc.SelectedDisplayTabItem.SelectedItemInfo);
|
||||||
@ -395,7 +398,7 @@ namespace VEPROMS
|
|||||||
// ii = ItemInfo.Get(tmp.ItemID);
|
// ii = ItemInfo.Get(tmp.ItemID);
|
||||||
// if (!ii.IsStepSection) tc.CloseWordItem(ii);
|
// if (!ii.IsStepSection) tc.CloseWordItem(ii);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
frmSectionProperties frmsec = new frmSectionProperties(args.SectionConfig);
|
frmSectionProperties frmsec = new frmSectionProperties(args.SectionConfig);
|
||||||
dr = frmsec.ShowDialog();
|
dr = frmsec.ShowDialog();
|
||||||
if (dr == DialogResult.OK && displayLibDocs.LibDocList != null)
|
if (dr == DialogResult.OK && displayLibDocs.LibDocList != null)
|
||||||
@ -407,11 +410,11 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
this.Cursor = Cursors.Default;
|
this.Cursor = Cursors.Default;
|
||||||
return dr;
|
return dr;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
#region ColorStuff
|
#region ColorStuff
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a System.Drawing.Color from an Argb or color name
|
/// Get a System.Drawing.Color from an Argb or color name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="strColor">Color Name or "[(alpha,)red,green,blue]"</param>
|
/// <param name="strColor">Color Name or "[(alpha,)red,green,blue]"</param>
|
||||||
@ -607,9 +610,9 @@ namespace VEPROMS
|
|||||||
/// <param name="e"></param>
|
/// <param name="e"></param>
|
||||||
private void btnSimStps_Click(object sender, EventArgs e)
|
private void btnSimStps_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//infoPanel.Expanded = true;
|
//infoPanel.Expanded = true;
|
||||||
//infoTabs.SelectedTab = toolstabResults;
|
//infoTabs.SelectedTab = toolstabResults;
|
||||||
//btnSimStpsRslt.Checked = true;
|
//btnSimStpsRslt.Checked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -651,7 +654,7 @@ namespace VEPROMS
|
|||||||
if (!epProcedures.Expanded) // If panel not expanded - expand it.
|
if (!epProcedures.Expanded) // If panel not expanded - expand it.
|
||||||
{
|
{
|
||||||
epProcedures.Expanded = true;
|
epProcedures.Expanded = true;
|
||||||
if(tv.Nodes.Count > 0 && tv.SelectedNode==null)
|
if (tv.Nodes.Count > 0 && tv.SelectedNode == null)
|
||||||
tv.SelectedNode = tv.Nodes[0];
|
tv.SelectedNode = tv.Nodes[0];
|
||||||
tv.Focus();
|
tv.Focus();
|
||||||
}
|
}
|
||||||
@ -669,7 +672,7 @@ namespace VEPROMS
|
|||||||
if (vtn == null) return; // nothing was selected.
|
if (vtn == null) return; // nothing was selected.
|
||||||
if (btnNew.SubItems.Count > 0) return; // submenu will be displayed
|
if (btnNew.SubItems.Count > 0) return; // submenu will be displayed
|
||||||
vtn.Expand();
|
vtn.Expand();
|
||||||
|
|
||||||
// Determine type of 'new' based on tree node's object type. The
|
// Determine type of 'new' based on tree node's object type. The
|
||||||
// only options here are those that would not have created, based on
|
// only options here are those that would not have created, based on
|
||||||
// containers, a submenu (see the office2007buttonstartbutton1_click code)
|
// containers, a submenu (see the office2007buttonstartbutton1_click code)
|
||||||
@ -690,7 +693,7 @@ namespace VEPROMS
|
|||||||
// All other types are handled with sub-menus.
|
// All other types are handled with sub-menus.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Options button on the dialog that appears when the V icon is clicked (top left of application window)
|
/// Options button on the dialog that appears when the V icon is clicked (top left of application window)
|
||||||
/// note that the "V icon" is also called the Office 2007 Start Button
|
/// note that the "V icon" is also called the Office 2007 Start Button
|
||||||
@ -725,7 +728,7 @@ namespace VEPROMS
|
|||||||
displayRO.MyROFST = SelectedROFst;
|
displayRO.MyROFST = SelectedROFst;
|
||||||
displayRO.MyRTB = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedStepItem.MyStepRTB;
|
displayRO.MyRTB = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedStepItem.MyStepRTB;
|
||||||
displayRO.TabControl = tc;
|
displayRO.TabControl = tc;
|
||||||
|
|
||||||
displayRO.ProgressBar = bottomProgBar;
|
displayRO.ProgressBar = bottomProgBar;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -784,7 +787,7 @@ namespace VEPROMS
|
|||||||
private void tc_WordSectionDeleted(object sender, WordSectionEventArgs args)
|
private void tc_WordSectionDeleted(object sender, WordSectionEventArgs args)
|
||||||
{
|
{
|
||||||
// is it a library document - if so and libdoc panel is visible, update lists on panel.
|
// is it a library document - if so and libdoc panel is visible, update lists on panel.
|
||||||
if ((!args.MySectionInfo.IsStepSection) && ((args.MySectionInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "")!="") && (toolsPanel.Expanded))
|
if ((!args.MySectionInfo.IsStepSection) && ((args.MySectionInfo.MyContent.MyEntry.MyDocument.LibTitle ?? "") != "") && (toolsPanel.Expanded))
|
||||||
{
|
{
|
||||||
if (toolsTabs.SelectedTab == tabItemLibDocs)
|
if (toolsTabs.SelectedTab == tabItemLibDocs)
|
||||||
{
|
{
|
||||||
@ -824,6 +827,7 @@ namespace VEPROMS
|
|||||||
else if (args.PanelTabName == "FndRpl")
|
else if (args.PanelTabName == "FndRpl")
|
||||||
{
|
{
|
||||||
dlgFindReplace.InApproved = (_SelectedDVI != null && _SelectedDVI.VersionType == 127);
|
dlgFindReplace.InApproved = (_SelectedDVI != null && _SelectedDVI.VersionType == 127);
|
||||||
|
//dlgFindReplace.Mydocversion = _SelectedDVI;
|
||||||
dlgFindReplace.Visible = true;
|
dlgFindReplace.Visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -834,7 +838,7 @@ namespace VEPROMS
|
|||||||
private ItemInfo _CurrentItem = null;
|
private ItemInfo _CurrentItem = null;
|
||||||
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
|
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
|
||||||
{
|
{
|
||||||
|
|
||||||
lblEditView.Text = " ";
|
lblEditView.Text = " ";
|
||||||
if (args == null)
|
if (args == null)
|
||||||
{
|
{
|
||||||
@ -876,7 +880,7 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
infotabRO.Visible = infotabTransition.Visible = infotabTags.Visible = true;
|
infotabRO.Visible = infotabTransition.Visible = infotabTags.Visible = true;
|
||||||
|
|
||||||
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
|
||||||
// When infotabTags is set to Visible, the matching panel also needs to be set to visible
|
// When infotabTags is set to Visible, the matching panel also needs to be set to visible
|
||||||
// the other panels will appear as they are selected by the user.
|
// the other panels will appear as they are selected by the user.
|
||||||
@ -892,7 +896,7 @@ namespace VEPROMS
|
|||||||
_CurrentItem.Deleted += new ItemInfoEvent(_CurrentItem_Deleted);
|
_CurrentItem.Deleted += new ItemInfoEvent(_CurrentItem_Deleted);
|
||||||
dlgFindReplace.MyStepItem = args.MyStepItem;
|
dlgFindReplace.MyStepItem = args.MyStepItem;
|
||||||
}
|
}
|
||||||
if(tc.SelectedDisplayTabItem != null)
|
if (tc.SelectedDisplayTabItem != null)
|
||||||
SelectedStepTabPanel = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
|
SelectedStepTabPanel = ((DisplayTabItem)tc.SelectedDisplayTabItem).MyStepTabPanel;
|
||||||
}
|
}
|
||||||
ctrlAnnotationDetails.UpdateAnnotationGrid(_CurrentItem);
|
ctrlAnnotationDetails.UpdateAnnotationGrid(_CurrentItem);
|
||||||
@ -986,31 +990,31 @@ namespace VEPROMS
|
|||||||
}
|
}
|
||||||
// if at top, 'VE-PROMS', folder and childfolders below this only
|
// if at top, 'VE-PROMS', folder and childfolders below this only
|
||||||
// option is to create a new (sub)folder, i.e. no submenu items.
|
// option is to create a new (sub)folder, i.e. no submenu items.
|
||||||
if (fi.ChildFolderCount > 0 && fi.MyParent==null) return;
|
if (fi.ChildFolderCount > 0 && fi.MyParent == null) return;
|
||||||
//if (fi.ChildFolderCount == 0) // submenu folders/docversion
|
//if (fi.ChildFolderCount == 0) // submenu folders/docversion
|
||||||
//{
|
//{
|
||||||
if (fi.MyParent != null)
|
if (fi.MyParent != null)
|
||||||
{
|
{
|
||||||
ButtonItem fldbbtn = new ButtonItem("fldbtn", "Folder Before");
|
ButtonItem fldbbtn = new ButtonItem("fldbtn", "Folder Before");
|
||||||
ButtonItem fldabtn = new ButtonItem("fldabtn", "Folder After");
|
ButtonItem fldabtn = new ButtonItem("fldabtn", "Folder After");
|
||||||
btnNew.SubItems.Add(fldbbtn);
|
btnNew.SubItems.Add(fldbbtn);
|
||||||
btnNew.SubItems.Add(fldabtn);
|
btnNew.SubItems.Add(fldabtn);
|
||||||
fldbbtn.Click += new EventHandler(fldbbtn_Click);
|
fldbbtn.Click += new EventHandler(fldbbtn_Click);
|
||||||
fldabtn.Click += new EventHandler(fldabtn_Click);
|
fldabtn.Click += new EventHandler(fldabtn_Click);
|
||||||
}
|
}
|
||||||
ButtonItem fldbtn = new ButtonItem("fldbtn", "Folder");
|
ButtonItem fldbtn = new ButtonItem("fldbtn", "Folder");
|
||||||
btnNew.SubItems.Add(fldbtn);
|
btnNew.SubItems.Add(fldbtn);
|
||||||
fldbtn.Click += new EventHandler(fldbtn_Click);
|
fldbtn.Click += new EventHandler(fldbtn_Click);
|
||||||
if (fi.ChildFolderCount == 0)
|
if (fi.ChildFolderCount == 0)
|
||||||
{
|
{
|
||||||
ButtonItem dvbtn = new ButtonItem("dvbtn", "Document Version");
|
ButtonItem dvbtn = new ButtonItem("dvbtn", "Document Version");
|
||||||
btnNew.SubItems.Add(dvbtn);
|
btnNew.SubItems.Add(dvbtn);
|
||||||
dvbtn.Click += new EventHandler(dvbtn_Click);
|
dvbtn.Click += new EventHandler(dvbtn_Click);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DocVersions can only have procedures, so no sub-menu
|
// DocVersions can only have procedures, so no sub-menu
|
||||||
DocVersionInfo dvi = vtn.VEObject as DocVersionInfo;
|
DocVersionInfo dvi = vtn.VEObject as DocVersionInfo;
|
||||||
if (dvi != null) return;
|
if (dvi != null) return;
|
||||||
@ -1142,15 +1146,15 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
displayTags.MyRTB = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedStepItem.MyStepRTB;
|
displayTags.MyRTB = (SelectedStepTabPanel == null) ? null : SelectedStepTabPanel.MyStepPanel.SelectedStepItem.MyStepRTB;
|
||||||
}
|
}
|
||||||
//private void tv_SectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args)
|
//private void tv_SectionShouldClose(object sender, vlnTreeSectionInfoEventArgs args)
|
||||||
//{
|
//{
|
||||||
// if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo);
|
// if (!args.MySectionInfo.IsStepSection) tc.CloseWordItem(args.MySectionInfo);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
private void infotabResults_Click(object sender, EventArgs e)
|
private void infotabResults_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
toolsPanel.Expanded = true;
|
toolsPanel.Expanded = true;
|
||||||
InitiateSearch(true);
|
InitiateSearch(true);
|
||||||
}
|
}
|
||||||
private void InitiateSearch(bool searchFocus)
|
private void InitiateSearch(bool searchFocus)
|
||||||
{
|
{
|
||||||
@ -1170,7 +1174,7 @@ namespace VEPROMS
|
|||||||
|
|
||||||
private void ribbonControl1_ExpandedChanged(object sender, EventArgs e)
|
private void ribbonControl1_ExpandedChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Size {0}",ribbonControl1.Expanded);
|
Console.WriteLine("Size {0}", ribbonControl1.Expanded);
|
||||||
// TODO: Need to send message to all StepTabPanels and tell them to minimize their ribbons.
|
// TODO: Need to send message to all StepTabPanels and tell them to minimize their ribbons.
|
||||||
tc.RibbonExpanded = ribbonControl1.Expanded;
|
tc.RibbonExpanded = ribbonControl1.Expanded;
|
||||||
}
|
}
|
||||||
@ -1257,9 +1261,5 @@ namespace VEPROMS
|
|||||||
StepRTB.MyFontFamily = cmbFont.SelectedValue as FontFamily;
|
StepRTB.MyFontFamily = cmbFont.SelectedValue as FontFamily;
|
||||||
}
|
}
|
||||||
|
|
||||||
//protected override void WndProc(ref Message m)
|
|
||||||
//{
|
|
||||||
// base.WndProc(ref m);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1078,7 +1078,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((MyContent.Number ?? "") == "" ? MyContent.Text : MyContent.Number));
|
string number = (MyContent.Type >= 20000 ? Ordinal.ToString() + "." : ((MyContent.Number ?? "") == "" ? MyContent.Text : MyContent.Number));
|
||||||
ItemInfo parent = this;
|
ItemInfo parent = this;
|
||||||
while (parent.MyPrevious != null) parent = parent.MyPrevious;
|
while (parent.MyPrevious != null) parent = parent.MyPrevious;
|
||||||
if (parent.ItemPartCount == 0)
|
if (parent.ItemPartCount <= 0 || parent.ItemParts.Count == 0)
|
||||||
return null;
|
return null;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -183,6 +183,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
internal void OnDeleted(object sender)
|
internal void OnDeleted(object sender)
|
||||||
{
|
{
|
||||||
if (Deleted != null) Deleted(sender);
|
if (Deleted != null) Deleted(sender);
|
||||||
|
if (MyParent != null) MyParent.OnChildrenDeleted(sender);
|
||||||
|
}
|
||||||
|
public event ItemInfoEvent ChildrenDeleted;
|
||||||
|
internal void OnChildrenDeleted(object sender)
|
||||||
|
{
|
||||||
|
if (_CacheByPrimaryKey.ContainsKey(ItemID.ToString()))
|
||||||
|
{
|
||||||
|
List<ItemInfo> itmlst = _CacheByPrimaryKey[ItemID.ToString()];
|
||||||
|
foreach (ItemInfo itm in itmlst)
|
||||||
|
if (itm.ChildrenDeleted != null)
|
||||||
|
{
|
||||||
|
itm.ChildrenDeleted(itm);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public event ItemInfoInsertEvent NewSiblingAfter;
|
public event ItemInfoInsertEvent NewSiblingAfter;
|
||||||
internal void OnNewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
|
internal void OnNewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
|
||||||
|
@ -323,12 +323,24 @@ namespace VEPROMS.CSLA.Library
|
|||||||
if (myItemInfo != null)
|
if (myItemInfo != null)
|
||||||
{
|
{
|
||||||
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
|
myItemInfo.ChildrenDeleted += new ItemInfoEvent(myItemInfo_ChildrenDeleted);
|
||||||
myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
|
myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
|
||||||
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void myItemInfo_ChildrenDeleted(object sender)
|
||||||
|
{
|
||||||
|
//Console.WriteLine("Fix Children");
|
||||||
|
ItemInfo myItemInfo = VEObject as ItemInfo;
|
||||||
|
//if (Nodes.Count > 1)
|
||||||
|
// Console.WriteLine("{0}, {1}",Nodes[0], Nodes[1]);
|
||||||
|
|
||||||
|
if (!myItemInfo.HasChildren && !(Nodes[0] is VETreeNode))
|
||||||
|
Nodes.Clear();
|
||||||
|
}
|
||||||
void myItemInfo_NewChild(object sender, ItemInfoInsertEventArgs args)
|
void myItemInfo_NewChild(object sender, ItemInfoInsertEventArgs args)
|
||||||
{
|
{
|
||||||
bool isExpanded = IsExpanded;
|
bool isExpanded = IsExpanded;
|
||||||
@ -337,7 +349,8 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Nodes.Clear();
|
Nodes.Clear();
|
||||||
_ChildrenLoaded = false;
|
_ChildrenLoaded = false;
|
||||||
ResetNode("Dummy myItemInfo_NewChild");
|
ResetNode("Dummy myItemInfo_NewChild");
|
||||||
if (isExpanded) Expand();
|
//if (isExpanded) Expand();
|
||||||
|
Collapse();
|
||||||
}
|
}
|
||||||
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
||||||
{
|
{
|
||||||
|
@ -1637,9 +1637,12 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
// start at the top parent and walk down the nodes to find child
|
// start at the top parent and walk down the nodes to find child
|
||||||
VETreeNode node = FindNodeAndExpand(selectedItem);
|
VETreeNode node = FindNodeAndExpand(selectedItem);
|
||||||
_AdjustingTree = true;
|
if (node != null)
|
||||||
this.SelectedNode = node;
|
{
|
||||||
_AdjustingTree = false;
|
_AdjustingTree = true;
|
||||||
|
this.SelectedNode = node;
|
||||||
|
_AdjustingTree = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public VETreeNode FindNodeAndExpand(IVEDrillDownReadOnly selectedItem)
|
public VETreeNode FindNodeAndExpand(IVEDrillDownReadOnly selectedItem)
|
||||||
{
|
{
|
||||||
@ -1648,15 +1651,23 @@ namespace Volian.Controls.Library
|
|||||||
return (VETreeNode)this.Nodes[0]; // Return the top node
|
return (VETreeNode)this.Nodes[0]; // Return the top node
|
||||||
}
|
}
|
||||||
VETreeNode parent = FindNodeAndExpand(selectedItem.ActiveParent);
|
VETreeNode parent = FindNodeAndExpand(selectedItem.ActiveParent);
|
||||||
|
if (parent == null) return null;
|
||||||
if (!parent.IsExpanded)
|
if (!parent.IsExpanded)
|
||||||
parent.Expand();
|
parent.Expand();
|
||||||
foreach (VETreeNode child in parent.Nodes)
|
foreach (TreeNode childNode in parent.Nodes)
|
||||||
if (CompareVEObject(child.VEObject, selectedItem))
|
{
|
||||||
|
VETreeNode child = childNode as VETreeNode;
|
||||||
|
if (child != null && CompareVEObject(child.VEObject, selectedItem))
|
||||||
return child;
|
return child;
|
||||||
foreach (VETreeNode child in parent.Nodes)
|
}
|
||||||
foreach (VETreeNode grandchild in child.Nodes)
|
foreach (TreeNode childNode in parent.Nodes)
|
||||||
if (CompareVEObject(grandchild.VEObject, selectedItem))
|
{
|
||||||
return grandchild;
|
VETreeNode child = childNode as VETreeNode;
|
||||||
|
if (child.VEObject is PartInfo)
|
||||||
|
foreach (VETreeNode grandchild in child.Nodes)
|
||||||
|
if (CompareVEObject(grandchild.VEObject, selectedItem))
|
||||||
|
return grandchild;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public bool CompareVEObject(IVEDrillDownReadOnly obj1, IVEDrillDownReadOnly obj2)
|
public bool CompareVEObject(IVEDrillDownReadOnly obj1, IVEDrillDownReadOnly obj2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user