Ejemplo n.º 1
0
        private static void NodesControl_PropertyChanged(object sender, ConnectionViewModel viewModel, string propertyName)
        {
            var nodesControl = (ConnectionsControl)sender;

            if (propertyName == nameof(ConnectionViewModel.IsSelected) && viewModel.IsSelected)
            {
                Reselect(nodesControl, viewModel);
            }
        }
Ejemplo n.º 2
0
 public static IEnumerable <ConnectionViewModel> Build(INode node, int delay = 0, params INode[] nodes)
 {
     foreach (var n in nodes)
     {
         var conn = new ConnectionViewModel(node, n)
         {
             Delay = delay
         };
         yield return(conn);
     }
 }
Ejemplo n.º 3
0
        private static void Reselect(ConnectionsControl connectionsControl, ConnectionViewModel viewModel)
        {
            foreach (var item in connectionsControl.Items)
            {
                if (viewModel != ((ConnectionViewModel)item))
                {
                    (item as ConnectionViewModel).IsSelected = false;
                }
            }

            connectionsControl.Dispatcher.InvokeAsync(() => connectionsControl.SelectedObject = viewModel,
                                                      System.Windows.Threading.DispatcherPriority.Background, default);
        }