コード例 #1
0
ファイル: Form1.cs プロジェクト: SergeyStaroletov/Patterns15
 public Form1()
 {
     InitializeComponent();
     this.bank = new Bank();
     this.facade = new MyFacade(bank);
     this.formImplementation = new FormImplementation();
     facade.setImplementation(this.formImplementation);
     facade.createWindows();
 }
コード例 #2
0
 public InfoAboutWindows(MyFacade facade)
 {
     InitializeComponent();
     this.facade = facade;
     List<BankWindow> bankWindows = this.facade.getListBankWindows();
     for(int i = 0; i < bankWindows.Count; i++)
     {
         this.comboBoxNumberWindow.Items.Add(bankWindows[i].getNumber());
     }
 }
コード例 #3
0
ファイル: Form1.cs プロジェクト: SergeyStaroletov/Patterns15
 public Form1()
 {
     InitializeComponent();
     this.bank = new Bank();
     this.facade = new MyFacade(bank);
     this.formImplementation = new FormImplementation();
     facade.setImplementation(this.formImplementation);
     facade.createWindows();
     this.pool = ObjectPoolClient.getInstance();
     this.buttonLoadBank.Enabled = false;
     this.buttonNotFollow.Enabled = false;
     memento = new ClientQueueMemento();
 }
コード例 #4
0
 private void buttonRus_Click(object sender, EventArgs e)
 {
     builder = new RusBuilder();
     director = new Director(builder);
     bank = new Bank(director);
     facade = new MyFacade(bank);
     facade.setImplementation(new FormImplementation());
     facade.createWindows();
     Form1 form1 = new Form1(facade);
     this.Hide();
     form1.ShowDialog();
     this.Close();
 }
コード例 #5
0
        static void Main()
        {
            facade = new MyFacade(bank);
            facade.createWindows();
            timer.Elapsed += OnTimedEvent;
            timerActive = false;

            ConsoleKeyInfo cki;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            do {
                Console.WriteLine("Выберите способ представления\n1 - На форме\n2 - В консоли\nEsc - Выход");
                cki = Console.ReadKey();
                Console.Clear();
                if (cki.Key == ConsoleKey.D1)
                {
                    facade.setImplementation(new FormImplementation());
                    Application.Run(new Form1(facade));
                }
                else if (cki.Key == ConsoleKey.D2)
                {
                    if (facade.isTimerActive())
                    {
                        timer.Start();
                    }
                    ConsoleKeyInfo cki2;
                    do {
                        Console.WriteLine("Выберите действие\n1 - Старт\n2 - Стоп\n3 - Показать\n4 - Увеличить кол-во приходящих клиентов в ед. времени\nEsc - Назад");
                        cki2 = Console.ReadKey();
                        Console.Clear();
                        if (cki2.Key == ConsoleKey.D1)
                        {
                            bank.startTimer();
                            timer.Start();
                        }
                        else if (cki2.Key == ConsoleKey.D2)
                        {
                            bank.stopTimer();
                            timer.Stop();
                        }
                        else if (cki2.Key == ConsoleKey.D3)
                        {
                            facade.setImplementation(new ConsoleImplementation());
                            facade.createWindowsDisplays();
                            timerActive = true;
                            ConsoleKeyInfo cki3;
                            do {
                                cki3 = Console.ReadKey();
                            } while(cki3.Key != ConsoleKey.Escape);
                            timerActive = false;
                            Console.Clear();
                        }
                        else if (cki2.Key == ConsoleKey.D4)
                        {
                            ConsoleKeyInfo cki4;
                            do {
                                Console.WriteLine("Выберите действие (текущее кол-во приходящих клиентов в ед. времени = "+ facade.getNumberOfNewClients() + ")\n1 - Увеличить на 1\n2 - Уменьшить на 1\nEsc - Назад");
                                cki4 = Console.ReadKey();
                                Console.Clear();
                                if (cki4.Key == ConsoleKey.D1)
                                {
                                    if(facade.getNumberOfNewClients() < 10)
                                        facade.setNumberOfNewClients(facade.getNumberOfNewClients() + 1);
                                }
                                else if (cki4.Key == ConsoleKey.D2)
                                {
                                    if(facade.getNumberOfNewClients() > 0)
                                        facade.setNumberOfNewClients(facade.getNumberOfNewClients() - 1);
                                }
                            } while (cki4.Key != ConsoleKey.Escape);
                        }
                    } while (cki2.Key != ConsoleKey.Escape);
                }

            } while (cki.Key != ConsoleKey.Escape);
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: SergeyStaroletov/Patterns15
 public Form1(MyFacade facade)
 {
     InitializeComponent();
     this.facade = facade;
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: SergeyStaroletov/Patterns15
 public Form1(MyFacade facade)
 {
     InitializeComponent();
     this.facade = facade;
     this.pool = ObjectPoolClient.getInstance();
 }
コード例 #8
0
 public ChangeWindowOperations(int numberWindow, MyFacade facade)
 {
     InitializeComponent();
     this.facade = facade;
     this.numberWindow = numberWindow;
 }