@@ -18,6 +18,7 @@ public enum Direction
1818 BACKWARD = - 1 ,
1919 FORWARD = 1
2020 }
21+ private bool listReordered = false ;
2122
2223 // sets of data to keep track of which items in the treeview are open, selected, visible etc., so that
2324 // when we reload the tree, we can keep it looking relatively consistent with what the user had before.
@@ -710,25 +711,32 @@ public void ReorderSelectedNodes(Direction direction)
710711 // Reinsert the node at the new index.
711712 treeview . Nodes . Insert ( insertionPoint , holdTreeNode [ index ] ) ;
712713 }
714+
715+ listReordered = true ;
713716 }
714717
715718 /// <summary>
716719 /// Reorder the output controllers in the system to match the new order in the treeview.
717720 /// </summary>
718721 public void ReorderControllers ( )
719722 {
720- // Get the list of controller names in the order they are displayed in the treeview.
721- var sortList = new List < Guid > ( ) ;
722- foreach ( TreeNode node in treeview . Nodes )
723+ if ( listReordered == true )
723724 {
724- if ( node . Tag is IControllerDevice device )
725- {
726- sortList . Add ( device . Id ) ;
727- }
728- }
725+ // Get the list of controller names in the order they are displayed in the treeview.
726+ var sortList = new List < Guid > ( ) ;
727+ foreach ( TreeNode node in treeview . Nodes )
728+ {
729+ if ( node . Tag is IControllerDevice device )
730+ {
731+ sortList . Add ( device . Id ) ;
732+ }
733+ }
729734
730- // Reorder the controllers in the system to match the new order in the treeview.
731- VixenSystem . OutputControllers . Reorder ( sortList ) ;
735+ // Reorder the controllers in the system to match the new order in the treeview.
736+ VixenSystem . OutputControllers . Reorder ( sortList ) ;
737+
738+ listReordered = false ;
739+ }
732740 }
733741
734742 #endregion
@@ -958,6 +966,7 @@ private void treeview_DoubleClick(object sender, EventArgs e)
958966 private void Treeview_DragOverVerify ( object sender , DragVerifyEventArgs e )
959967 {
960968 e . ValidDragTarget = e . DragBetweenNodes != DragBetweenNodes . DragOnTargetNode ;
969+ listReordered = true ;
961970 }
962971 }
963972}
0 commit comments