public async Task RunAsync()
        {
            try
            {
                logger.Verbose("Invoking the startup preparation operation.");

                if (hasRunBefore)
                {
                    throw new InvalidOperationException(
                              "Can't run the startup preparation twice.");
                }

                if (Arguments == null)
                {
                    throw new ArgumentNullException(
                              nameof(Arguments));
                }

                hasRunBefore = true;

                processManager.CloseAllDuplicateProcessesExceptCurrent();
                await aggregateArgumentProcessor.ProcessArgumentsAsync(Arguments);

                logger.Verbose("Startup preparation operation completed.");
            }
            catch (Exception ex)
            {
                Program.OnGlobalErrorOccured(ex);
            }
        }
Beispiel #2
0
        public async Task RunAsync()
        {
            if (hasRunBefore)
            {
                throw new InvalidOperationException(
                          "Can't run the startup preparation twice.");
            }

            if (Arguments == null)
            {
                throw new ArgumentNullException(
                          nameof(Arguments));
            }

            hasRunBefore = true;

            processManager.CloseAllDuplicateProcessesExceptCurrent();
            aggregateArgumentProcessor.ProcessArguments(Arguments);
        }