Ejemplo 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;
            }
        }
Ejemplo n.º 2
0
        private void Launch_Click(object sender, RoutedEventArgs e)
        {
            AppEntry app = (sender as Control)?.DataContext as AppEntry;

            if (app != null)
            {
                StartLaunching(app);
            }
        }
Ejemplo 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;
 }
Ejemplo 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;
     }
 }
Ejemplo 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);
            }
        }
Ejemplo n.º 6
0
 private bool IsCooldownOver(AppEntry app)
 {
     return(app.ExecuteTick != 0 && (Environment.TickCount - app.ExecuteTick) > 0);
 }