如何在C#上排队进程?

时间:2016-05-02 23:24:56

标签: c# stack

所以我必须暂停一个进程一秒钟然后启动另一个进程,所以基本上我必须暂停并恢复这个进程。

此外,我必须使用堆栈。 必须保存正在执行的过程,以便我可以恢复它。 必须有一个ID并显示优先级。

有人知道我必须使用什么吗?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Threading;
using System.Runtime.InteropServices;

namespace Práctica_2
{
    class Program
    {

            static void Main(string[] args)
            {

                Process Contador = new Process();
                Process Datos = new Process();
                Process Google = new Process();
                Process Numero = new Process();
                Process Finalizar = new Process();


                try
                {                    
                    System.Diagnostics.Process.Start("C:\\Users\\M-00\\Desktop\\Práctica 2\\Datos\\Datos\\obj\\Debug\\Datos.exe");
                    Datos.Start();
                    Thread.Sleep(250);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                try
                {
                    System.Diagnostics.Process.Start("C:\\Users\\M-00\\Desktop\\Práctica 2\\Contador\\Contador\\obj\\Debug\\Contador.exe");
                    Contador.Start();
                    Datos.WaitForExit(250);
                    Thread.Sleep(500);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                try
                {
                    System.Diagnostics.Process.Start("C:\\Users\\M-00\\Desktop\\Numeros\\Numeros\\obj\\Debug\\Numeros.exe");
                    Numero.Start();
                    Datos.WaitForExit(500);
                    Thread.Sleep(750);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
    }

0 个答案:

没有答案