Example #1
0
 private void StartNowButtonClicked(object obj)
 {
     TimeToStart.Stop();
     if (ProgramsToStartList.Any())
     {
         ProgramsStartingProcedure();
     }
     else
     {
         ProgramsToStartListIsEmpty();
     }
 }
Example #2
0
        public StartProgramsViewModel()
        {
            //Assigning startup values for controls
            SecondsToStartTextBlockVisibility  = Visibility.Visible;
            StartAndDontStartButtonsVisibility = Visibility.Visible;
            ProgressBarVisibility                = Visibility.Collapsed;
            OptionsGridVisibility                = Visibility.Collapsed;
            FinalizeStartNoErrorsVisibility      = Visibility.Collapsed;
            FinalizeStartWithErrorsVisibility    = Visibility.Collapsed;
            ProgramsToStartListIsEmptyVisibility = Visibility.Collapsed;
            OptionsButtonContent          = "Options >>>";
            ProgramsToStartGridVisibility = Visibility.Collapsed;
            ProgramsToStartButtonContent  = "Programs to Start >>>";

            //Obtain configuration.xml path
            ObtainingConfigurationXMLPath();

            //Read all saved Programs from configuration file and assign them to ProgramsToStartList
            ReadingProgramsToStartCollection();

            //Read all options from configuration file and assign them to proper variables
            ReadingOptionsToVariables();


            //Binding for buttons
            StartNowButtonCommand                = new RelayCommand(StartNowButtonClicked);
            DontStartButtonCommand               = new RelayCommand(DontStartButtonClicked);
            CancelButtonCommand                  = new RelayCommand(CancelButtonClicked);
            OptionsButtonCommand                 = new RelayCommand(OptionsButtonClicked);
            ProgramsToStartButtonCommand         = new RelayCommand(ProgramsToStartButtonClicked);
            RemoveProgramFromProgramsToStartList = new RelayCommand(RemoveProgramContextMenuItemClicked);
            AddProgramToProgramsToStartList      = new RelayCommand(AddProgramContextMenuItemClicked);
            SaveButtonCommand     = new RelayCommand(SaveButtonClicked);
            TryAgainButtonCommand = new RelayCommand(TryAgainButtonClicked);
            ErrorLogButtonCommand = new RelayCommand(ErrorLogButtonClicked);
            ThankYouButtonCommand = new RelayCommand <Window>(ThankYouButtonClicked);

            //Check if ProgramsToStartList is not empty then start counting seconds to start
            if (ProgramsToStartList.Any())
            {
                //Start counting seconds to start and begin startin procedure of programs when countdown is done
                CountingSecondsToStart();
            }
            else
            {
                //Inform User that list is empty
                ProgramsToStartListIsEmpty();
            }
        }
Example #3
0
        private void TryAgainButtonClicked(object obj)
        {
            //Setting proper visibility
            FinalizeStartNoErrorsVisibility   = Visibility.Collapsed;
            FinalizeStartWithErrorsVisibility = Visibility.Collapsed;

            //Start programs again
            if (ProgramsToStartList.Any())
            {
                ProgramsStartingProcedure();
            }
            else
            {
                ProgramsToStartListIsEmpty();
            }
        }
Example #4
0
        /// <summary>
        /// Begining starting procedure for all programs in the list
        /// </summary>
        public void Start()
        {
            //if programs list is not empty then begin starting programs
            if (ProgramsToStartList.Any())
            {
                //Start first program in the list
                StartNextProgram();

                //Start GapCountTimer and every timer tick next program will be started
                GapCountTimer.Start();
            }
            //if list is empty then don't begin starting programs and update ErrorLog
            else
            {
                HasErrors     = true;
                IsStartupDone = true;
                ErrorLog log = new ErrorLog(DateTime.Now, LogNameProgramStarter, LogNameStartingProgramsHandler, "List of programs to start is empty!");
                ErrorsList.Add(log);
            }
        }