Changed the Multi-user refresh so that the selected node is not changed between the adding and the finalizing of the section addition.
Use the selected node prior to setting the section properties so that the node is added at the correct location.
This commit is contained in:
parent
23f5ef318d
commit
2aa0057fa1
@ -918,12 +918,24 @@ namespace VEPROMS
|
||||
WindowsFormsSynchronizationContext mUIContext = new WindowsFormsSynchronizationContext();
|
||||
public void MyFindNodeAndExpand(object obj)
|
||||
{
|
||||
IVEDrillDownReadOnly veObj1 = ((tv.SelectedNode as VETreeNode).VEObject as IVEDrillDownReadOnly);
|
||||
int id = (int)obj;
|
||||
ItemInfo ii = ItemInfo.Get(id);
|
||||
ii.ResetParts();
|
||||
using (Item i = Item.Get(id))
|
||||
ItemInfo.Refresh(i);
|
||||
tv.RefreshRelatedNode(ii);
|
||||
IVEDrillDownReadOnly veObj2 = ((tv.SelectedNode as VETreeNode).VEObject as IVEDrillDownReadOnly);
|
||||
if (veObj1.ToString() != veObj2.ToString())
|
||||
{
|
||||
VETreeNode tnNew = null;
|
||||
foreach (VETreeNode tn in tv.SelectedNode.Nodes)
|
||||
{
|
||||
if (tn.VEObject.ToString() == veObj1.ToString())
|
||||
tnNew = tn;
|
||||
}
|
||||
if (tnNew != null) tv.SelectedNode = tnNew;
|
||||
}
|
||||
}
|
||||
private void RefreshChanged(Object obj)
|
||||
{
|
||||
@ -969,6 +981,13 @@ namespace VEPROMS
|
||||
}
|
||||
MySemaphore.Release();
|
||||
}
|
||||
private int TotalCount(TreeNodeCollection tns)
|
||||
{
|
||||
int total = tns.Count;
|
||||
foreach (TreeNode tn in tns)
|
||||
total += TotalCount(tn.Nodes);
|
||||
return total;
|
||||
}
|
||||
private bool ByteArrayIsEmpty(byte[] myArray)
|
||||
{
|
||||
for (int i = 0; i < myArray.Length; i++)
|
||||
|
@ -143,6 +143,19 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
//end jcb multiunit
|
||||
#endregion
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("Node={0},Destination={1},Index={2},Unit={3},UnitIndex={4}",NodePath(this.Node),this.Destination, this.Index,this.Unit, this.UnitIndex);
|
||||
}
|
||||
|
||||
private string NodePath(TreeNode node)
|
||||
{
|
||||
string retval = "";
|
||||
if (node.Parent != null)
|
||||
retval = NodePath(node.Parent) + ":";
|
||||
retval += node.Text;
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
public partial class vlnTreeItemInfoEventArgs
|
||||
{
|
||||
@ -1956,7 +1969,7 @@ namespace Volian.Controls.Library
|
||||
if (!hasMetaSubs) doPseudo = true;
|
||||
}
|
||||
}
|
||||
using(Section section = CreateNewSection())
|
||||
using (Section section = CreateNewSection())
|
||||
{
|
||||
ShowBrokenRules(section.BrokenRulesCollection);
|
||||
SetLastValues(SectionInfo.Get(section.ItemID));
|
||||
@ -2033,11 +2046,15 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
ShowBrokenRules(section.BrokenRulesCollection);
|
||||
SetLastValues(SectionInfo.Get(section.ItemID));
|
||||
TreeNode par = SelectedNode.Parent;
|
||||
if (OnNodeOpenProperty(this, new vlnTreePropertyEventArgs("New Section", section.SectionConfig)) == DialogResult.OK)
|
||||
{
|
||||
tn = new VETreeNode(_LastSectionInfo);
|
||||
TreeNode par = SelectedNode.Parent;
|
||||
par.Nodes.Insert(tvindex + ((newtype == MenuSelections.SectionBefore) ? 0 : 1), tn);
|
||||
int indx = tvindex + ((newtype == MenuSelections.SectionBefore) ? 0 : 1);
|
||||
if ((par.Nodes[indx] as VETreeNode).VEObject.ToString() != _LastSectionInfo.ToString())
|
||||
{
|
||||
tn = new VETreeNode(_LastSectionInfo);
|
||||
par.Nodes.Insert(indx, tn);
|
||||
}
|
||||
}
|
||||
else
|
||||
s2 = section.ItemID;
|
||||
|
Loading…
x
Reference in New Issue
Block a user