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

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