Пример #1
0
        private void MenuBulkEdit_OnClick(object sender, RoutedEventArgs e)
        {
            if (_scenarioList.Count == 0 || !_scenarioList.Any(x => x.Active))
            {
                MessageBox.Show("There are no scenarios to edit!", ApplicationName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            var activeScenarioList      = _scenarioList.Where(x => x.Active).ToList();
            BulkEditorWindow bulkEditor = new BulkEditorWindow(activeScenarioList);

            Visibility = Visibility.Collapsed;
            try
            {
                bulkEditor.ShowDialog();
            }
            catch (Exception exception)
            {
                MessageBox.Show($"An error occurred. {Extension.JoinAllErrorMessages(exception)}", ApplicationName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }

            Visibility = Visibility.Visible;
        }
Пример #2
0
        private void StartButton_Click(object sender, RoutedEventArgs e)
        {
            string exceptionMessage = string.Empty;

            if (!_edtAssetSelectionControl.HasSelection)
            {
                MessageBox.Show("Please select a device to continue.", ApplicationName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            if (_scenarioList.Count == 0)
            {
                MessageBox.Show("There are no scenarios to execute!", ApplicationName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }

            if (_isFim && (string.IsNullOrEmpty(BaseFirmwareTextBox.Text) ||
                           string.IsNullOrEmpty(TargetFirmwareTextBox.Text) ||
                           !Directory.Exists(BaseFirmwareTextBox.Text) ||
                           !Directory.Exists(TargetFirmwareTextBox.Text)))
            {
                MessageBox.Show("Please validate the firmware locations for the device.", ApplicationName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
                return;
            }


            //kick start the execution
            TestInstanceData activeTestInstanceData =
                new TestInstanceData
            {
                ActiveScenarios           = _scenarioList.Where(x => x.Active).ToList(),
                DeviceAssetInfoCollection = ConfigurationServices.AssetInventory.GetAssets(_edtAssetSelectionControl.AssetSelectionData.SelectedAssets),
                BaseFirmwarePath          = BaseFirmwareTextBox.Text,
                TargetFirmwarePath        = TargetFirmwareTextBox.Text,
                RunName = RunComboBox.Text,
                RunId   = (Guid)RunComboBox.SelectedValue
            };

            if (BashCollectorCheckBox.IsChecked.HasValue)
            {
                activeTestInstanceData.BashCollectorHost = BashCollectorCheckBox.IsChecked.Value ? _addressControl.Text : string.Empty;
            }

            this.Visibility = Visibility.Collapsed;
            try
            {
                ExecutionWindow executionWindow = new ExecutionWindow(activeTestInstanceData);
                executionWindow.ShowDialog();
            }
            catch (Exception ex)
            {
                exceptionMessage = Extension.JoinAllErrorMessages(ex);
            }

            this.Visibility = Visibility.Visible;
            if (!string.IsNullOrEmpty(exceptionMessage))
            {
                MessageBox.Show($"An error occurred. {exceptionMessage}", ApplicationName, MessageBoxButton.OK,
                                MessageBoxImage.Error);
            }
        }