private void _Toolbar_Advanced_Click(object sender, RoutedEventArgs e) { var service = _Tree.SelectedItem as ServiceDisplayInfo; if (service == null) { return; } // always use the root service service = service.Root; var dialog = new BatchDialog(); dialog.Init(service); var result = dialog.ShowDialog(); if (result != null && result.Value) { int startIndex = App.BindingData.Services.IndexOf(service); int count = 0; foreach (Dictionary <string, string> options in dialog.GetInstanceOptions()) { var dup = new ServiceDisplayInfo(service.Configuration) { IsDuplicate = true, IsExpanded = service.IsExpanded }; App.BindingData.Services.Insert(startIndex + (++count), dup); dup.Start(options); } } }
void Instance_ChildServiceRequested(object sender, ServiceRequestedEventArgs e) { ServiceDisplayInfo step = this.Children.Single(item => item.Name == e.ServiceName); if (step != null) { step.Start(e.RequestedService); } else { step = new ServiceDisplayInfo(e.RequestedService.Configuration) { Unplanned = true }; step.Start(e.RequestedService); this.Children.Add(step); } }