Пример #1
0
        static void TransferMenu()
        {
            char r;

            do
            {
                Console.MainTitleText = "TRANSFER MENU";
                Console.PromptText    = "PLEASE ENTER YOUR CHOICE.";
                Console.MenuOptions   = Menu.TRANSFER_MENU;
                Console.DisplayMode   = SuperConsole.DISP_MENU;
                r = Console.UpdateGetChar();

                switch (r)
                {
                case 'Q':
                    if (MA == null)
                    {
                        Console.SetAlert("ERROR", "Matrix A not yet initialized!", 2);
                        Console.UpdateGetChar();
                    }
                    else
                    {
                        MA.CopyTo(ref MT);
                        Console.SetAlert("SUCCESS", "Matrix A copied to Matrix T.", 0);
                        Console.UpdateGetChar();
                    }
                    break;

                case 'W':
                    if (MB == null)
                    {
                        Console.SetAlert("ERROR", "Matrix B not yet initialized!", 2);
                        Console.UpdateGetChar();
                    }
                    else
                    {
                        MB.CopyTo(ref MT);
                        Console.SetAlert("SUCCESS", "Matrix B copied to Matrix T.", 0);
                        Console.UpdateGetChar();
                    }
                    break;

                case 'E':
                    if (MC == null)
                    {
                        Console.SetAlert("ERROR", "Matrix C not yet initialized!", 2);
                        Console.UpdateGetChar();
                    }
                    else
                    {
                        MC.CopyTo(ref MT);
                        Console.SetAlert("SUCCESS", "Matrix C copied to Matrix T.", 0);
                        Console.UpdateGetChar();
                    }
                    break;

                case 'A':
                    if (MT == null)
                    {
                        Console.SetAlert("ERROR", "Matrix T not yet initialized!", 2);
                        Console.UpdateGetChar();
                    }
                    else
                    {
                        MT.CopyTo(ref MA);
                        Console.SetAlert("SUCCESS", "Matrix T copied to Matrix A.", 0);
                        Console.UpdateGetChar();
                    }
                    break;

                case 'S':
                    if (MT == null)
                    {
                        Console.SetAlert("ERROR", "Matrix T not yet initialized!", 2);
                        Console.UpdateGetChar();
                    }
                    else
                    {
                        MT.CopyTo(ref MB);
                        Console.SetAlert("SUCCESS", "Matrix T copied to Matrix B.", 0);
                        Console.UpdateGetChar();
                    }
                    break;

                case 'D':
                    if (MA == null)
                    {
                        Console.SetAlert("ERROR", "Matrix A not yet initialized!", 2);
                        Console.UpdateGetChar();
                    }
                    else
                    {
                        if (MB == null)
                        {
                            Console.SetAlert("ERROR", "Matrix B not yet initialized!", 2);
                            Console.UpdateGetChar();
                        }
                        else
                        {
                            MA.CopyTo(ref MT);
                            MB.CopyTo(ref MA);
                            MT.CopyTo(ref MB);
                            MT = null;
                            Console.SetAlert("SUCCESS", "Matrix A and Matrix B were swapped.", 0);
                            Console.UpdateGetChar();
                        }
                    }
                    break;

                case 'X':
                    r = 'X';
                    break;

                default:
                    Console.SetAlert("ERROR", "Invalid selection", 2);
                    Console.UpdateGetChar();
                    break;
                }
            }while (r != 'X');
            MT = null;
        }