private void buttonAdd_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(STFLoginManager.SystemDatabase))
            {
                if (STFLoginManager.Login())
                {
                    _currentDatabase = STFLoginManager.SystemDatabase;
                }
                else
                {
                    return;
                }
            }

            ScenarioSelection scenarios = new ScenarioSelection();
            {
                scenarios.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                if (scenarios.ShowDialog() == true)
                {
                    ScenarioQueueList temp = new ScenarioQueueList
                    {
                        ScenarioId   = scenarios.ScenarioId,
                        ScenarioName = scenarios.ScenarioName,
                        Status       = "Yet to Start"
                    };
                    _scenarioList.Add(temp);
                    buttonRemove.IsEnabled = true;
                }
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (STFLoginManager.Login())
            {
                _currentDatabase = STFLoginManager.SystemDatabase;
                //Set whether STF or STB based on the worker type in the database.
                GlobalSettings.IsDistributedSystem = false;
                //string officeWorkerType = VirtualResourceType.OfficeWorker.ToString();
                //using (EnterpriseTestContext dataContext = new EnterpriseTestContext(_currentDatabase))
                //{
                //    GlobalSettings.IsDistributedSystem = dataContext.VirtualResources.Any(r => r.ResourceType == officeWorkerType);
                //}
                LoggedInTextBlock.Text = $"Logged in as: {UserManager.CurrentUserName} to {STFLoginManager.SystemDatabase}";
            }
            else
            {
                Environment.Exit(1);
            }

            _edtAssetSelectionControl?.Initialize(AssetAttributes.None);
            GlobalSettings.Load(_currentDatabase);
            FrameworkServicesInitializer.InitializeConfiguration();


            BuildComboBox.DataContext    = _accessDds.GetBuilds();
            ProductComboBox.DataContext  = _accessDds.GetProducts();
            ScenarioDataGrid.DataContext = _scenarioList;
            GroupComboBox.DataContext    = _groupCollection;
        }
Beispiel #3
0
 private bool ConnectToEnvironment()
 {
     if (!STFLoginManager.Login())
     {
         return(false); //User canceled the login
     }
     return(true);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="VirtualMachineManagamentForm"/> class.
        /// </summary>
        public VirtualMachineManagamentForm()
        {
            InitializeComponent();
            if (!STFLoginManager.Login())
            {
                Environment.Exit(1);
            }
            UserInterfaceStyler.Configure(this, FormStyle.FixedDialog);
            _entities = new EnterpriseTestContext();

            //bind the virtual machine list to the combobox, the display will always the name
            // and the value will be the platformId
            platformFilter_ToolStripComboBox.ComboBox.DisplayMember = "Name";
            platformFilter_ToolStripComboBox.ComboBox.ValueMember   = "PlatformId";
            executables_dataGridView.AutoGenerateColumns            = false;
        }
Beispiel #5
0
        private bool ConnectToEnvironment()
        {
            if (!STFLoginManager.Login())
            {
                return(false); //User canceled the login
            }

            Cursor.Current = Cursors.WaitCursor;

            // Update status labels
            main_StatusLabel.Text        = "Connecting to {0}".FormatWith(STFLoginManager.SystemDatabase);
            userName_StatusLabel.Text    = UserManager.CurrentUserName;
            environment_StatusLabel.Text = "{0} {1} Environment".FormatWith(GlobalSettings.Items[Setting.Organization], GlobalSettings.Items[Setting.Environment]);
            SetLoggingContext();

            // DoEvents so the screen will refresh, and then set the wait cursor
            Application.DoEvents();

            try
            {
                // Initialize framework services
                FrameworkServicesInitializer.InitializeConfiguration();

                // Populate the config tree view
                InitializeConfigurationTreeView();

                // Set up the dashboard
                _dashboardControl.Initialize();

                // Apply user security settings
                ApplySecurity();

                // Refresh the status label and return true to indicate success
                main_StatusLabel.Text = "Connected to {0} ({1})".FormatWith(GlobalSettings.Environment, GlobalSettings.Database);
                return(true);
            }
            catch (EnvironmentConnectionException ex)
            {
                MessageBox.Show(ex.Message, "Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
 private void ConnectToDispatcher()
 {
     if (string.IsNullOrEmpty(STFLoginManager.SystemDatabase))
     {
         if (STFLoginManager.Login())
         {
             _currentDatabase = STFLoginManager.SystemDatabase;
         }
         else
         {
             return;
         }
     }
     if (STFDispatcherManager.ConnectToDispatcher())
     {
         _currentDispatcher = STFDispatcherManager.Dispatcher.HostName;
     }
 }
Beispiel #7
0
 protected override void OnLoad(EventArgs e)
 {
     if (STFLoginManager.Login())
     {
         _currentDatabase = STFLoginManager.SystemDatabase;
         //Set whether STF or STB based on the worker type in the database.
         string officeWorkerType = VirtualResourceType.OfficeWorker.ToString();
         using (EnterpriseTestContext dataContext = new EnterpriseTestContext(_currentDatabase))
         {
             GlobalSettings.IsDistributedSystem = dataContext.VirtualResources.Any(r => r.ResourceType == officeWorkerType);
         }
         loggedIn_textBox.Text = $@"Logged in as: {UserManager.CurrentUserName} to {STFLoginManager.SystemDatabase}";
     }
     else
     {
         Environment.Exit(1);
     }
     base.OnLoad(e);
 }
Beispiel #8
0
        private void OnLoaded(object sender, EventArgs e)
        {
            Application.Idle -= new EventHandler(OnLoaded);

            try
            {
                if (!ConnectToEnvironment())
                {
                    Application.Exit();
                }

                logIn_MenuItem.Visible = STFLoginManager.MultipleEnvironmentsAvailable();
            }
            catch (Exception ex)
            {
                // Inform the user of the error and allow them to send but do not kill the app unless they choose
                // For example, they may instead want to change environment.
                ApplicationExceptionHandler.UnhandledException(ex);
            }
        }
        public STFUWindow()
        {
            InitializeComponent();
            _scenarioList = new ObservableCollection <ScenarioQueueList>();
            ScenarioDataGrid.DataContext            = _scenarioList;
            STFDispatcherManager.DispatcherChanged += STFDispatcherManager_DispatcherChanged;

            if (STFLoginManager.Login())
            {
                _currentDatabase = STFLoginManager.SystemDatabase;
                //Set whether STF or STB based on the worker type in the database.
                string officeWorkerType = VirtualResourceType.OfficeWorker.ToString();
                using (EnterpriseTestContext dataContext = new EnterpriseTestContext(_currentDatabase))
                {
                    GlobalSettings.IsDistributedSystem = dataContext.VirtualResources.Any(r => r.ResourceType == officeWorkerType);
                }
                environment_StatusLabel.Text = STFLoginManager.SystemDatabase;
            }
            else
            {
                Environment.Exit(1);
            }

            SessionClient.Instance.DispatcherExceptionReceived      += Instance_DispatcherExceptionReceived;
            SessionClient.Instance.SessionStateReceived             += Instance_SessionStateReceived;
            SessionClient.Instance.SessionStartupTransitionReceived += Instance_SessionStartupTransitionReceived;
            SessionClient.Instance.SessionMapElementReceived        += Instance_SessionMapElementReceived;

            comboBoxRetention.ItemsSource   = SessionLogRetentionHelper.ExpirationList;
            comboBoxRetention.SelectedIndex = Convert.ToInt32(GlobalSettings.Items[Setting.DefaultLogRetention]);

            _shutdownOptions = new ShutdownOptions()
            {
                AllowWorkerToComplete = false,
                CopyLogs       = false,
                PowerOff       = true,
                PowerOffOption = VMPowerOffOption.PowerOff
            };
        }