Exemple #1
0
        void Instance_ChildServiceRequested(object sender, ServiceRequestedEventArgs e)
        {
            DisplayNode step = this.Children.Single(item => item.Name == e.ServiceName);

            if (step != null)
            {
                step.Start(e.RequestedService);
            }
            else
            {
                step = new DisplayNode(e.RequestedService.Configuration)
                {
                    Unplanned = true
                };
                step.Start(e.RequestedService);
                this.Children.Add(step);
            }
        }
        private void _Toolbar_Advanced_Click(object sender, RoutedEventArgs e)
        {
            var service = _Tree.SelectedItem as DisplayNode;

            if (service == null)
            {
                return;
            }

            // always use the root service
            service = service.Root;

            var dialog = new BatchDialog();

            if (!dialog.Init(service))
            {
                return;
            }

            var result = dialog.ShowDialog();

            if (result != null && result.Value)
            {
                int startIndex = MainWindow.BindingData.Services.IndexOf(service);
                int count      = 0;
                foreach (Dictionary <string, string> options in dialog.GetInstanceOptions())
                {
                    var dup = new DisplayNode(service.Configuration)
                    {
                        IsDuplicate = true, IsExpanded = service.IsExpanded
                    };
                    MainWindow.BindingData.Services.Insert(startIndex + (++count), dup);
                    dup.Start(options);
                }
            }
        }