public ShowResultsViewModel(ExperimentStatusViewModel st, string sharedDirectory, ExperimentManager manager,
                             AzureExperimentManagerViewModel managerVm, ExperimentListViewModel experimentsVm, RecentValuesStorage recentValues, IUIService uiService)
 {
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     if (managerVm == null)
     {
         throw new ArgumentNullException(nameof(managerVm));
     }
     if (uiService == null)
     {
         throw new ArgumentNullException("uiService");
     }
     if (experimentsVm == null)
     {
         throw new ArgumentNullException(nameof(experimentsVm));
     }
     this.manager               = manager;
     this.managerVm             = managerVm;
     this.experimentsVm         = experimentsVm;
     this.uiService             = uiService;
     this.statusVm              = st;
     this.id                    = st.ID;
     this.sharedDirectory       = sharedDirectory;
     this.benchmarkTimeout      = st.Definition.BenchmarkTimeout;
     this.jobStatus             = ExperimentExecutionStateVM.Loading;
     this.benchmarkContainerUri = st.Definition.BenchmarkContainerUri;
     this.recentValues          = recentValues;
     RefreshResultsAsync();
 }
        private async void btnConnect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnConnect.IsEnabled = false;
                if (experimentsVm == null)
                {
                    var handle = uiService.StartIndicateLongOperation("Connecting...");
                    try
                    {
                        managerVm = await ConnectAsync(connectionString.Text);

                        experimentsVm = managerVm.BuildListView();
                    }
                    finally
                    {
                        uiService.StopIndicateLongOperation(handle);
                    }

                    DataContext = experimentsVm;
                    recentValues.ConnectionString = connectionString.Text;
                    connectionString.IsReadOnly   = true;
                    btnConnect.Content            = "Disconnect";
                    btnConnect.IsEnabled          = true;
                    btnNewJob.IsEnabled           = true;
                    btnUpdate.IsEnabled           = true;
                    menuNewJob.IsEnabled          = true;
                    menuNewCatchAll.IsEnabled     = true;
                    btnEdit.Visibility            = Visibility.Collapsed;
                }
                else // disconnect
                {
                    experimentsVm = null;
                    connectionString.IsReadOnly = false;
                    btnConnect.Content          = "Connect";
                    btnConnect.IsEnabled        = true;
                    DataContext               = null;
                    btnNewJob.IsEnabled       = false;
                    btnUpdate.IsEnabled       = false;
                    menuNewJob.IsEnabled      = false;
                    menuNewCatchAll.IsEnabled = false;
                    btnEdit.Visibility        = Visibility.Visible;
                }
            }
            catch (Exception ex)
            {
                btnConnect.IsEnabled = true;
                uiService.ShowError(ex, "Failed to connect");
            }
        }
Beispiel #3
0
 public RequeueSettingsViewModel(string benchmarkContainerUri, AzureExperimentManagerViewModel managerVm, RecentValuesStorage recentValues, IUIService uiService)
 {
     if (managerVm == null)
     {
         throw new ArgumentNullException(nameof(managerVm));
     }
     if (uiService == null)
     {
         throw new ArgumentNullException(nameof(uiService));
     }
     if (recentValues == null)
     {
         throw new ArgumentNullException(nameof(recentValues));
     }
     this.managerVm                       = managerVm;
     this.service                         = uiService;
     this.recentValues                    = recentValues;
     this.benchmarkContainerUri           = benchmarkContainerUri;
     isNotDefaultBenchmarkContainerUri    = benchmarkContainerUri != ExperimentDefinition.DefaultContainerUri;
     this.benchmarkContainerUriNotDefault = isNotDefaultBenchmarkContainerUri ? benchmarkContainerUri : "";
     isChosenDefaultContainer             = benchmarkContainerUri == ExperimentDefinition.DefaultContainerUri;
     ChoosePoolCommand                    = new DelegateCommand(ListPools);
     selectedPool                         = recentValues.BatchPool;
 }
Beispiel #4
0
        public NewExperimentViewModel(AzureExperimentManagerViewModel manager, IUIService service, RecentValuesStorage recentValues, string creator, IDomainResolver domainResolver)
        {
            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }
            if (recentValues == null)
            {
                throw new ArgumentNullException(nameof(recentValues));
            }
            if (domainResolver == null)
            {
                throw new ArgumentNullException(nameof(domainResolver));
            }
            this.manager        = manager;
            this.service        = service;
            this.recentValues   = recentValues;
            this.creator        = creator;
            this.domainResolver = domainResolver;

            benchmarkContainerUri           = ExperimentDefinition.DefaultContainerUri;
            benchmarkContainerUriNotDefault = "";
            isDefaultBenchmarkContainerUri  = true;
            ChooseDirectoryCommand          = new DelegateCommand(ChooseDirectory);
            ChooseCategoriesCommand         = new DelegateCommand(ChooseCategories);
            ChooseExecutableCommand         = new DelegateCommand(ChooseExecutable);
            ChoosePoolCommand = new DelegateCommand(ListPools);

            benchmarkDirectory = recentValues.BenchmarkDirectory;
            categories         = recentValues.BenchmarkCategories;
            timelimit          = recentValues.BenchmarkTimeLimit.TotalSeconds;
            exptimelimit       = recentValues.ExperimentTimeLimit.TotalSeconds;
            memlimit           = recentValues.BenchmarkMemoryLimit;
            note = recentValues.ExperimentNote;
            allowAdaptiveRuns      = recentValues.AllowAdaptiveRuns;
            maxRepetitions         = recentValues.MaxRepetitions;
            maxTimeForAdaptiveRuns = recentValues.MaxTimeForAdaptiveRuns;

            Domain = Domains[0];
            // Following will override the defaults given when setting the Domain above.
            string storedExt = recentValues.BenchmarkExtension;

            if (!string.IsNullOrEmpty(storedExt))
            {
                extension = storedExt;
            }
            string storedParam = recentValues.ExperimentExecutableParameters;

            if (!string.IsNullOrEmpty(storedParam))
            {
                parameters = storedParam;
            }


            UseMostRecentExecutable = true;
            RecentBlobDisplayName   = "searching...";
            taskRecentBlob          = FindRecentExecutable();

            selectedPool = recentValues.BatchPool;
        }