예제 #1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            switch (Lab)
            {
            case 2:
                Phone formPhone = new Phone();
                formPhone.FormTopLabel = "Select playback component (specify index):";
                formPhone.FormOption1  = "1 - MeizuHeadset";
                formPhone.FormOption2  = "2 - SamsungHeadset";
                formPhone.FormOption3  = "3 - UnofficialiPhoneHeadset";
                formPhone.FormOption4  = "4 - PortableSpeaker";
                IOutput output = new WinFormOutput(formPhone);
                formPhone.Output = output;
                Application.Run(formPhone);
                break;

            case 3:
            case 4:
                SMSScreen formSMS = new SMSScreen();
                Application.Run(formSMS);
                break;
            }
        }
예제 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            switch (Lab)
            {
            case 2:
                Phone formPhone = new Phone();
                formPhone.FormTopLabel = "Select playback component (specify index):";
                formPhone.FormOption1  = "1 - MeizuHeadset";
                formPhone.FormOption2  = "2 - SamsungHeadset";
                formPhone.FormOption3  = "3 - UnofficialiPhoneHeadset";
                formPhone.FormOption4  = "4 - PortableSpeaker";
                IOutput output = new WinFormOutput(formPhone);
                formPhone.Output = output;
                Application.Run(formPhone);
                break;

            case 3:
            case 4:
            case 5:
                bool isTaskForMessages, isTaskForBattery;
                Console.WriteLine("Select approach to asynchronous message processing:");
                Console.WriteLine("1 - Threads");
                Console.WriteLine("2 - Tasks");
                int  value;
                bool isBadInput;
                do
                {
                    isBadInput = !int.TryParse(Console.ReadLine(), out value);
                    if (isBadInput || value > 2 || value < 1)
                    {
                        Console.WriteLine("Wrong value, please try again: ");
                        isBadInput = true;
                    }
                } while (isBadInput);
                switch (value)
                {
                case 1:
                    isTaskForMessages = false;
                    break;

                case 2:
                    isTaskForMessages = true;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                Console.WriteLine("Select approach to asynchronous battery charging:");
                Console.WriteLine("1 - Threads");
                Console.WriteLine("2 - Tasks");
                do
                {
                    isBadInput = !int.TryParse(Console.ReadLine(), out value);
                    if (isBadInput || value > 2 || value < 1)
                    {
                        Console.WriteLine("Wrong value, please try again: ");
                        isBadInput = true;
                    }
                } while (isBadInput);
                switch (value)
                {
                case 1:
                    isTaskForBattery = false;
                    break;

                case 2:
                    isTaskForBattery = true;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                var formSMS = new SMSScreen(isTaskForMessages, isTaskForBattery);
                Application.Run(formSMS);
                break;
            }
        }