示例#1
0
        static void Main(string[] args)
        {
            Trace.TraceInformation("启动任务");

            AMSTask.StartAllTasks(cancellationTokenSource.Token);

            while (cancellationTokenSource.IsCancellationRequested == false)
            {
                Console.WriteLine("Please input command...");
                string cmd = Console.ReadLine();

                switch (cmd.ToLower())
                {
                case "exit":
                    cancellationTokenSource.Cancel();
                    break;

                case "clearevents":
                    DataHelper.ClearAllEvents();
                    Console.WriteLine("All events cleared");
                    break;

                case "addevent":
                    DataHelper.AddEvent(DataHelper.TestChannelName);
                    break;

                case "addtwochannelsevent":
                    DataHelper.AddEvent(DataHelper.TestChannelName, DataHelper.TestChannel2Name);
                    break;

                case "addmooncakeevent":
                    DataHelper.AddEvent(DataHelper.MooncakeTestChannelName);
                    break;

                case "clearqueue":
                    DataHelper.ClearQueue();
                    Console.WriteLine("Queue cleared");
                    break;

                case "clearlocks":
                    LockHelper.ClearAll();
                    Console.WriteLine("Lock cleared");
                    break;

                case "endevents":
                    Console.WriteLine("{0} events updated.", DataHelper.EndAllRunningEvents());
                    break;

                default:
                    Console.WriteLine("{0}是不能识别的命令", cmd);
                    break;
                }
            }
        }