Esempio n. 1
0
 //added to ComponentSelected Event when Link button is clicked
 public void StartTempConnector(ComponentViewModel start, EventArgs e)
 {
     //Create temporary connector for visual display
     TemporaryConnectorViewModel temp = new TemporaryConnectorViewModel(start as SystemViewModel);
     ComponentVMs.Add(temp);
     //remove handler from event to prevent being called again
     ComponentSelected -= StartTempConnector;
     //create event handler closure to remember start
     ComponentSelectionHandler h = null;
     h = (end, args) =>
     {
         //create real connector with remembered start and new end
         CreateConnector(start as SystemViewModel, end as SystemViewModel);
         //remove h so not called again
         ComponentSelected -= h;
         //remove temporary connector
         ComponentVMs.Remove(temp);
     };
     //add anonymous event handler "h" to ComponentSelected
     ComponentSelected += h;
 }
Esempio n. 2
0
 void OnComponentSelected(ComponentViewModel cvm, EventArgs e)
 {
     SelectedComponentVM = cvm;
 }