Esempio n. 1
0
        private void CancelLaunch_Click(object sender, RoutedEventArgs e)
        {
            AppEntry app = (sender as Control)?.DataContext as AppEntry;

            if (app != null)
            {
                app.Phase = LaunchPhase.Done;
            }
        }
Esempio n. 2
0
        private void Launch_Click(object sender, RoutedEventArgs e)
        {
            AppEntry app = (sender as Control)?.DataContext as AppEntry;

            if (app != null)
            {
                StartLaunching(app);
            }
        }
Esempio n. 3
0
 private void BeginAppCooldown(AppEntry app, bool first)
 {
     if (mConfig.FirstIsSpecial)
     {
         app.ExecuteTick = first ? Environment.TickCount : Environment.TickCount + (1000 * app.Timeout);
     }
     else
     {
         app.ExecuteTick = Environment.TickCount + (1000 * app.Timeout);
     }
     app.Phase = LaunchPhase.Next;
 }
Esempio n. 4
0
 private void StartLaunching(AppEntry app)
 {
     app.Phase      = LaunchPhase.Launching;
     app.LaunchDate = DateTime.Now;
     try
     {
         app.Process = Process.Start(new ProcessStartInfo(app.FullPath)
         {
             UseShellExecute = true
         });
     }
     catch (Exception)
     {
         app.Phase = LaunchPhase.Error;
     }
 }
Esempio n. 5
0
        private bool IsAppReady(AppEntry app)
        {
            if (app.Process == null)
            {
                return(true);
            }

            if (app.Process.HasExited)
            {
                return(true);
            }

            try
            {
                return(app.Process.WaitForInputIdle(0));
            }
            catch (InvalidOperationException)
            {
                return(true);
            }
        }
Esempio n. 6
0
 private bool IsCooldownOver(AppEntry app)
 {
     return(app.ExecuteTick != 0 && (Environment.TickCount - app.ExecuteTick) > 0);
 }