Пример #1
0
        /// <summary>
        /// Asynchronouly waits a user set period of time, then executes the specified application in the main thread
        /// </summary>
        static void waiter_DoWork(object sender, DoWorkEventArgs e)
        {
            ExecuteWinAppArgs args = e.Argument as ExecuteWinAppArgs;

            e.Result = args;
            Thread.Sleep(args.WaitTime);
        }
Пример #2
0
        /// <summary>
        /// Executes the specified application
        /// </summary>
        static void waiter_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            ExecuteWinAppArgs args = e.Result as ExecuteWinAppArgs;

            try
            {
                Process.Start(args.AppPath);
                writeEvent("Application successfully started: " + Environment.NewLine + Environment.NewLine + args.AppPath, false, false, 200);
            }
            catch (Exception ex)
            {
                writeEvent("Failed to start application: " + Environment.NewLine + Environment.NewLine + args.AppPath + Environment.NewLine + Environment.NewLine + ex.ToString(), true, false, 201);
            }
        }