コード例 #1
0
        public InfoAboutWindows(Bank b)
        {
            InitializeComponent();
            bank = b;
            Iterator iterator = bank.getBankWindows().createIterator();
            while (iterator.hasNext())
            {
                BankWindowComponent component = (BankWindowComponent)iterator.Next();
                try
                {
                    if (component.GetType() == typeof(BankWindow))
                    {
                        this.comboBoxNumberWindow.Items.Add(component.getNumber());
                    }
                }
                catch (NotImplementedException) { }
            }
            bank.getBankWindows().deleteIterator();

            /*
            List<BankWindow> bankWindows = this.bank.getListBankWindows();
            for(int i = 0; i < bankWindows.Count; i++)
            {
                this.comboBoxNumberWindow.Items.Add(bankWindows[i].getNumber());
            }       */
        }
コード例 #2
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();
 }
コード例 #3
0
 public FormInformationExpert(Bank bank)
 {
     this.bank = bank;
     this.credits = 0;
     this.deposits = 0;
     this.cards = 0;
     this.transfers = 0;
     this.payments = 0;
     this.allOperations = 0;
 }
コード例 #4
0
 public InfoAboutWindows(Bank b)
 {
     InitializeComponent();
     bank = b;
     List<BankWindow> bankWindows = this.bank.getListBankWindows();
     for(int i = 0; i < bankWindows.Count; i++)
     {
         this.comboBoxNumberWindow.Items.Add(bankWindows[i].getNumber());
     }
 }
コード例 #5
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();
 }
コード例 #6
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();
 }
コード例 #7
0
ファイル: Bank.cs プロジェクト: SergeyStaroletov/Patterns15
        public Bank(Bank bank)
        {
            this.manager = new OperationManager(bank.manager);
            this.listBankWindows = new List<BankWindow>();
            for (int i = 0; i < bank.countBankWindows; i++)
            {
                BankWindow bw = new BankWindow(bank.listBankWindows[i]);
                bw.setManager(this.manager);
                this.listBankWindows.Add(bw);
            }

            this.clientQueue = new ClientQueue(bank.clientQueue);
            this.timer = new Timer(bank.periodTimer);
            this.periodTimer = bank.periodTimer;

            this.timer.Elapsed += OnTimedEvent;
            this.numberOfNewClients = bank.numberOfNewClients;
            this.countBankWindows = bank.countBankWindows;
            this.nameClients = bank.nameClients;
            //this.timerActive = bank.timerActive;
        }
コード例 #8
0
 public MyFacade(Bank bank)
 {
     this.bank = bank;
     this.impl = null;
 }
コード例 #9
0
 public void setBank(Bank bank)
 {
     this.bank = bank;
     this.expert = new ConsoleInformationExpert(bank);
 }
コード例 #10
0
 public ConsoleInformationExpert(Bank bank)
 {
     this.bank = bank;
 }
コード例 #11
0
 public ChangeWindowOperations(int numberWindow, Bank bank)
 {
     InitializeComponent();
     this.bank = bank;
     this.numberWindow = numberWindow + 1;
 }
コード例 #12
0
 public FormInformationExpert(Bank bank)
 {
     this.bank = bank;
 }
コード例 #13
0
ファイル: Form1.cs プロジェクト: SergeyStaroletov/Patterns15
        //действия при загрузке окна
        private void Form1_Load(object sender, EventArgs e)
        {
            this.bank = new Bank();
            this.pictureBankWindows = new List<PictureBox>();
            this.pictureClientQueue = new PictureBox();
            this.pictureClients = new List<PictureBox>();
            this.toolTipBankWindows = new List<ToolTip>();
            this.toolTipClientQueue = new ToolTip();
            this.toolTipClients = new List<ToolTip>();

            //создаем окна
            List<string> operations = new List<string>();

            operations.Add(Credit.CREDIT);
            operations.Add(Deposit.DEPOSIT);
            this.bank.addBankWindow(operations);

            PictureBox pictureBox1 = new PictureBox();
            pictureBox1.Name = "bankWindow1";
            pictureBox1.Image = Properties.Resources.BankWindow;
            pictureBox1.Location = new System.Drawing.Point(20, 17);
            pictureBox1.Size = new System.Drawing.Size(55, 55);
            pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox1);

            operations.Add(Card.CARD);
            this.bank.addBankWindow(operations);

            PictureBox pictureBox2 = new PictureBox();
            pictureBox2.Name = "bankWindow2";
            pictureBox2.Image = Properties.Resources.BankWindow;
            pictureBox2.Location = new System.Drawing.Point(105, 17);
            pictureBox2.Size = new System.Drawing.Size(55, 55);
            pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox2);

            operations.Clear();
            operations.Add(Payment.PAYMENT);
            operations.Add(Transfer.TRANSFER);
            this.bank.addBankWindow(operations);

            PictureBox pictureBox3 = new PictureBox();
            pictureBox3.Name = "bankWindow3";
            pictureBox3.Image = Properties.Resources.BankWindow;
            pictureBox3.Location = new System.Drawing.Point(190, 17);
            pictureBox3.Size = new System.Drawing.Size(55, 55);
            pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox3);

            operations.Clear();
            operations.Add(Deposit.DEPOSIT);
            operations.Add(Transfer.TRANSFER);
            this.bank.addBankWindow(operations);

            PictureBox pictureBox4 = new PictureBox();
            pictureBox4.Name = "bankWindow4";
            pictureBox4.Image = Properties.Resources.BankWindow;
            pictureBox4.Location = new System.Drawing.Point(275, 17);
            pictureBox4.Size = new System.Drawing.Size(55, 55);
            pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox4);

            operations.Add(Card.CARD);
            this.bank.addBankWindow(operations);

            PictureBox pictureBox5 = new PictureBox();
            pictureBox5.Name = "bankWindow5";
            pictureBox5.Image = Properties.Resources.BankWindow;
            pictureBox5.Location = new System.Drawing.Point(360, 17);
            pictureBox5.Size = new System.Drawing.Size(55, 55);
            pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox5);

            for (int i = 0; i < this.pictureBankWindows.Count; i++)
            {
                this.panel1.Controls.Add(this.pictureBankWindows[i]);
            }

            //создаем картинку очереди
            this.pictureClientQueue.Name = "ClientQueue";
            this.pictureClientQueue.Image = Properties.Resources.ClientQueue;
            this.pictureClientQueue.Location = new System.Drawing.Point(20, 230);
            this.pictureClientQueue.Size = new System.Drawing.Size(450, 55);
            this.pictureClientQueue.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.panel1.Controls.Add(this.pictureClientQueue);

            //создаем всплывающие подсказки для очереди
            this.toolTipClientQueue.ToolTipTitle = "Очередь";
            this.toolTipClientQueue.ToolTipIcon = ToolTipIcon.Info;
            this.toolTipClientQueue.SetToolTip(this.pictureClientQueue,"");

            //создаем всплывающие подсказки для окон
            for(int i = 0; i<this.pictureBankWindows.Count; i++)
            {
                ToolTip toolTip1 = new ToolTip();
                toolTip1.ToolTipTitle = "Окно № " + (i+1);
                toolTip1.ToolTipIcon = ToolTipIcon.Info;
                toolTip1.SetToolTip(this.pictureBankWindows[i], "");
                this.toolTipBankWindows.Add(toolTip1);
            }

            //создаем картики для клиентов
            PictureBox pictureClient1 = new PictureBox();
            pictureClient1.Name = "Client1";
            pictureClient1.Location = new System.Drawing.Point(20, 92);
            pictureClient1.Size = new System.Drawing.Size(55, 55);
            pictureClient1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient1);

            PictureBox pictureClient2 = new PictureBox();
            pictureClient2.Name = "Client2";
            pictureClient2.Location = new System.Drawing.Point(105, 92);
            pictureClient2.Size = new System.Drawing.Size(55, 55);
            pictureClient2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient2);

            PictureBox pictureClient3 = new PictureBox();
            pictureClient3.Name = "Client3";
            pictureClient3.Location = new System.Drawing.Point(190, 92);
            pictureClient3.Size = new System.Drawing.Size(55, 55);
            pictureClient3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient3);

            PictureBox pictureClient4 = new PictureBox();
            pictureClient4.Name = "Client4";
            pictureClient4.Location = new System.Drawing.Point(275, 92);
            pictureClient4.Size = new System.Drawing.Size(55, 55);
            pictureClient4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient4);

            PictureBox pictureClient5 = new PictureBox();
            pictureClient5.Name = "Client5";
            pictureClient5.Location = new System.Drawing.Point(360, 92);
            pictureClient5.Size = new System.Drawing.Size(55, 55);
            pictureClient5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient5);

            for (int i = 0; i < this.pictureClients.Count; i++)
            {
                this.panel1.Controls.Add(this.pictureClients[i]);

            }

            //создаем всплывающие подсказки для клиентов
            for (int i = 0; i < this.pictureClients.Count; i++)
            {
                ToolTip toolTip1 = new ToolTip();
                //toolTip1.ToolTipTitle = "Информация о клиенте № " + (i + 1);
                toolTip1.ToolTipIcon = ToolTipIcon.Info;
                toolTip1.SetToolTip(this.pictureClients[i], "");
                this.toolTipClients.Add(toolTip1);
            }
        }
コード例 #14
0
 public void setBank(Bank bank)
 {
     this.bank = bank;
     this.expert = new FormInformationExpert(bank);
     this.bank.getClientQueue().attachObserver(this.expert);
 }
コード例 #15
0
 public void setBank(Bank bank)
 {
     this.bank = bank;
 }
コード例 #16
0
ファイル: Form1.cs プロジェクト: SergeyStaroletov/Patterns15
        //действия при загрузке окна
        private void Form1_Load(object sender, EventArgs e)
        {
            this.bank = new Bank();
            this.pictureBankWindows = new List<PictureBox>();
            this.pictureClientQueue = new PictureBox();
            this.pictureClients = new List<PictureBox>();
            this.toolTipBankWindows = new List<ToolTip>();
            this.toolTipClientQueue = new ToolTip();
            this.toolTipClients = new List<ToolTip>();

            /*//создаем окна
            List<int> operations = new List<int>();

            operations.Add(Credit.CREDIT);
            operations.Add(Deposit.DEPOSIT);
            this.bank.addBankWindow(operations);
            */
            PictureBox pictureBox1 = new PictureBox();
            pictureBox1.Name = "bankWindow1";
            pictureBox1.Image = Properties.Resources.BankWindow;
            pictureBox1.Location = new System.Drawing.Point(20, 17);
            pictureBox1.Size = new System.Drawing.Size(55, 55);
            pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox1);
            /*
            operations.Add(Card.CARD);
            this.bank.addBankWindow(operations);
            */
            PictureBox pictureBox2 = new PictureBox();
            pictureBox2.Name = "bankWindow2";
            pictureBox2.Image = Properties.Resources.BankWindow;
            pictureBox2.Location = new System.Drawing.Point(105, 17);
            pictureBox2.Size = new System.Drawing.Size(55, 55);
            pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox2);

            /*
            operations.Clear();
            operations.Add(Payment.PAYMENT);
            operations.Add(Transfer.TRANSFER);
            operations.Add(CurrencyExchangeAdapter.CURRENCYEXCHANGE);
            this.bank.addBankWindow(operations);
            */
            PictureBox pictureBox3 = new PictureBox();
            pictureBox3.Name = "bankWindow3";
            pictureBox3.Image = Properties.Resources.BankWindow;
            pictureBox3.Location = new System.Drawing.Point(190, 17);
            pictureBox3.Size = new System.Drawing.Size(55, 55);
            pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox3);
            /*
            operations.Clear();
            operations.Add(Deposit.DEPOSIT);
            operations.Add(Transfer.TRANSFER);
            this.bank.addBankWindow(operations);
            */
            PictureBox pictureBox4 = new PictureBox();
            pictureBox4.Name = "bankWindow4";
            pictureBox4.Image = Properties.Resources.BankWindow;
            pictureBox4.Location = new System.Drawing.Point(275, 17);
            pictureBox4.Size = new System.Drawing.Size(55, 55);
            pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox4);
            /*
            operations.Add(Card.CARD);
            this.bank.addBankWindow(operations);
            */
            PictureBox pictureBox5 = new PictureBox();
            pictureBox5.Name = "bankWindow5";
            pictureBox5.Image = Properties.Resources.BankWindow;
            pictureBox5.Location = new System.Drawing.Point(360, 17);
            pictureBox5.Size = new System.Drawing.Size(55, 55);
            pictureBox5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureBankWindows.Add(pictureBox5);

            for (int i = 0; i < this.pictureBankWindows.Count; i++)
            {
                this.panel1.Controls.Add(this.pictureBankWindows[i]);
            }

            //создаем картинку очереди
            this.pictureClientQueue.Name = "ClientQueue";
            this.pictureClientQueue.Image = Properties.Resources.ClientQueue;
            this.pictureClientQueue.Location = new System.Drawing.Point(20, 230);
            this.pictureClientQueue.Size = new System.Drawing.Size(450, 55);
            this.pictureClientQueue.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            this.panel1.Controls.Add(this.pictureClientQueue);

            //создаем всплывающие подсказки для очереди
            this.toolTipClientQueue.ToolTipTitle = "Очередь";
            this.toolTipClientQueue.ToolTipIcon = ToolTipIcon.Info;
            this.toolTipClientQueue.SetToolTip(this.pictureClientQueue,"");

            //создаем всплывающие подсказки для окон
            for(int i = 0; i<this.pictureBankWindows.Count; i++)
            {
                ToolTip toolTip1 = new ToolTip();
                toolTip1.ToolTipTitle = "Окно № " + (i+1);
                toolTip1.ToolTipIcon = ToolTipIcon.Info;
                toolTip1.SetToolTip(this.pictureBankWindows[i], "");
                this.toolTipBankWindows.Add(toolTip1);
            }

            //создаем картики для клиентов
            PictureBox pictureClient1 = new PictureBox();
            pictureClient1.Name = "Client1";
            pictureClient1.Location = new System.Drawing.Point(20, 92);
            pictureClient1.Size = new System.Drawing.Size(55, 55);
            pictureClient1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient1);

            PictureBox pictureClient2 = new PictureBox();
            pictureClient2.Name = "Client2";
            pictureClient2.Location = new System.Drawing.Point(105, 92);
            pictureClient2.Size = new System.Drawing.Size(55, 55);
            pictureClient2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient2);

            PictureBox pictureClient3 = new PictureBox();
            pictureClient3.Name = "Client3";
            pictureClient3.Location = new System.Drawing.Point(190, 92);
            pictureClient3.Size = new System.Drawing.Size(55, 55);
            pictureClient3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient3);

            PictureBox pictureClient4 = new PictureBox();
            pictureClient4.Name = "Client4";
            pictureClient4.Location = new System.Drawing.Point(275, 92);
            pictureClient4.Size = new System.Drawing.Size(55, 55);
            pictureClient4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient4);

            PictureBox pictureClient5 = new PictureBox();
            pictureClient5.Name = "Client5";
            pictureClient5.Location = new System.Drawing.Point(360, 92);
            pictureClient5.Size = new System.Drawing.Size(55, 55);
            pictureClient5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

            this.pictureClients.Add(pictureClient5);

            for (int i = 0; i < this.pictureClients.Count; i++)
            {
                this.panel1.Controls.Add(this.pictureClients[i]);
            }

            //создаем всплывающие подсказки для клиентов
            for (int i = 0; i < this.pictureClients.Count; i++)
            {
                ToolTip toolTip1 = new ToolTip();
                toolTip1.ToolTipIcon = ToolTipIcon.Info;
                toolTip1.SetToolTip(this.pictureClients[i], "");
                this.toolTipClients.Add(toolTip1);
            }

            Iterator iterator = bank.getBankWindows().createIterator();
            while (iterator.hasNext())
            {
                BankWindowComponent component = (BankWindowComponent)iterator.Next();
                try
                {
                    if (component.GetType() == typeof(BankWindow))
                    {
                        this.comboBoxWindow.Items.Add(component.getNumber());
                    }
                }
                catch (NotImplementedException) { }
            }
            bank.getBankWindows().deleteIterator();

            /*
            //заполнить листбокс номерами окон
            List<BankWindow> bankWindows = this.bank.getListBankWindows();
            for (int i = 0; i < bankWindows.Count; i++)
            {
                this.comboBoxWindow.Items.Add(bankWindows[i].getNumber());
            }*/
            this.comboBoxWindow.SelectedIndex = 0; //выбрать первое
        }