void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.DefiningBenchmarkDialog = ((TraceLab.UI.WPF.Views.DefineBenchmarkDialog)(target));
                return;

            case 3:
                this.headingLabel = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Example #2
0
        private void ShowDefineBenchmarkDialog(object param)
        {
            ApplicationViewModelWrapper appvm = (ApplicationViewModelWrapper)DataContext;
            var experiment = appvm.ExperimentDocumentWrapper[0] as ExperimentViewModel;

            if (experiment != null)
            {
                var loggerNameRoot = new TraceLab.Core.Components.LoggerNameRoot(experiment.TopLevel.ExperimentInfo.Id);
                //validate experiment first
                bool isValid = TraceLab.Core.ExperimentExecution.ExperimentValidator.ValidateExperiment((IExperiment)experiment.TopLevel,
                                                                                                        appvm.WorkspaceViewModel.WorkspaceTypeDirectories, loggerNameRoot);

                if (isValid == false)
                {
                    //show error dialog
                    string caption   = TraceLab.Core.Messages.ExperimentNotValid;
                    string errorText = TraceLab.Core.Messages.InvalidExperimentErrorMessage;
                    MessageBox.Show(errorText, caption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    //create dialog with data contex of Define Benchmark
                    DefineBenchmarkDialog box = new DefineBenchmarkDialog();

                    //until multiple benchmark directories are not implemented
                    List <string> benchmarkDirectories = new List <string>();
                    benchmarkDirectories.Add(appvm.BenchmarkWizardViewModel.BenchmarksDirectory);

                    //create view model
                    DefiningBenchmarkViewModel definingBenchmarkViewModel = new DefiningBenchmarkViewModel((Experiment)experiment.TopLevel,
                                                                                                           benchmarkDirectories,
                                                                                                           (TraceLab.Core.Components.ComponentsLibrary)appvm.ComponentLibraryViewModel,
                                                                                                           (TraceLab.Core.Workspaces.Workspace)appvm.WorkspaceViewModel,
                                                                                                           appvm.WorkspaceViewModel.WorkspaceTypeDirectories,
                                                                                                           appvm.SettingsViewModel.WebserviceAddress);

                    box.DataContext = definingBenchmarkViewModel;
                    box.Owner       = this;
                    box.ShowDialog();
                }
            }
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.DefiningBenchmarkDialog = ((TraceLab.UI.WPF.Views.DefineBenchmarkDialog)(target));
     return;
     case 3:
     this.headingLabel = ((System.Windows.Controls.Label)(target));
     return;
     }
     this._contentLoaded = true;
 }
        private void ShowDefineBenchmarkDialog(object param)
        {
            ApplicationViewModelWrapper appvm = (ApplicationViewModelWrapper)DataContext;
            var experiment = appvm.ExperimentDocumentWrapper[0] as ExperimentViewModel;

            if (experiment != null)
            {
                var loggerNameRoot = new TraceLab.Core.Components.LoggerNameRoot(experiment.TopLevel.ExperimentInfo.Id);
                //validate experiment first
                bool isValid = TraceLab.Core.ExperimentExecution.ExperimentValidator.ValidateExperiment((IExperiment)experiment.TopLevel, 
                                                                            appvm.WorkspaceViewModel.WorkspaceTypeDirectories, loggerNameRoot);

                if (isValid == false)
                {
                    //show error dialog
                    string caption = TraceLab.Core.Messages.ExperimentNotValid;
                    string errorText = TraceLab.Core.Messages.InvalidExperimentErrorMessage;
                    MessageBox.Show(errorText, caption, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
                else
                {
                    //create dialog with data contex of Define Benchmark
                    DefineBenchmarkDialog box = new DefineBenchmarkDialog();

                    //until multiple benchmark directories are not implemented
                    List<string> benchmarkDirectories = new List<string>();
                    benchmarkDirectories.Add(appvm.BenchmarkWizardViewModel.BenchmarksDirectory);

                    //create view model
                    DefiningBenchmarkViewModel definingBenchmarkViewModel = new DefiningBenchmarkViewModel((Experiment)experiment.TopLevel, 
                                                                                benchmarkDirectories,
                                                                                (TraceLab.Core.Components.ComponentsLibrary)appvm.ComponentLibraryViewModel,
                                                                                (TraceLab.Core.Workspaces.Workspace)appvm.WorkspaceViewModel,
                                                                                appvm.WorkspaceViewModel.WorkspaceTypeDirectories,
                                                                                appvm.SettingsViewModel.WebserviceAddress);

                    box.DataContext = definingBenchmarkViewModel;
                    box.Owner = this;
                    box.ShowDialog();
                }
            }
        }