Пример #1
0
 public Librarian(int _id, Que _que, Cartoteka _cart, Dictionary <int, lb_Book> _Books, Dictionary <int, lb_Abonement> _Abon)
 {
     id        = _id;
     state     = "Empty";
     curr_que  = _que;
     type      = "Libr";
     type1     = "Libr_no";
     curr_cart = _cart;
     curr_hra  = null;
     Books     = _Books;
     Abon      = _Abon;
 }
Пример #2
0
 public Librarian(int _id, Depot _hra, Dictionary <int, lb_Book> _Books, Dictionary <int, lb_Abonement> _Abon)
 {
     id        = _id;
     state     = "Empty";
     curr_hra  = _hra;
     type      = "Libr";
     type1     = "Libr_no";
     curr_cart = null;
     curr_que  = null;
     Abon      = _Abon;
     Books     = _Books;
 }
Пример #3
0
        public Form1()
        {
            InitializeComponent();

            textBox_diagn.Enabled = false;
            textBox_diagn.Hide();

            check_Abon.Enabled = false;
            check_Book.Enabled = false;
            check_Cart.Enabled = false;
            check_Peop.Enabled = false;

            //инициализация нужных моделей и их взаимосвязь
            que2 = new Que(1);
            que2.t_que.Interval = 50;

            kart2 = new Cartoteka(1, que2, 3, Kartoteka);
            kart2.t_que.Interval = 3000;
            kart2.rnd_f          = 7000;
            kart2.rnd_l          = 7000;

            libr1       = new Librarian(1, que2, kart2, Books, Abon);
            libr1.rnd_f = 1500;
            libr1.rnd_l = 3000;

            libr2       = new Librarian(2, que2, kart2, Books, Abon);
            libr2.rnd_f = 1000;
            libr2.rnd_l = 2000;

            hra = new Depot(1, Books);
            hra.t_que.Interval = 1500;
            hra.rnd_f          = 3000;
            hra.rnd_l          = 3000;

            libr_out       = new Librarian(3, hra, Books, Abon);
            libr_out.rnd_f = 1000;
            libr_out.rnd_l = 1000;



            //соединение объектов событиями

            que2.notEmpty += kart2.getRequest;
            que2.notEmpty += libr1.getReq_fromQue;
            que2.notEmpty += libr2.getReq_fromQue;

            kart2.notEmpty += libr1.getReq_fromCart;
            kart2.notEmpty += libr2.getReq_fromCart;
            kart2.giveReq  += this.deny_Add;

            libr1.giveReq += hra.Add;
            libr2.giveReq += hra.Add;

            libr1.giveReq += this.done_Add;
            libr2.giveReq += this.done_Add;
            libr1.giveReq += this.deny_Add;
            libr2.giveReq += this.deny_Add;

            hra.notEmpty += libr_out.getReq_fromDepot;

            libr_out.giveReq += this.done_Add;
            libr_out.giveReq += this.deny_Add;


            //запуск настроенных таймеров

            que2.t_que.Stop();
            kart2.t_que.Stop();
            hra.t_que.Stop();
            timer_new.Stop();

            //настройка кнопок
            button_finish.Enabled = false;
            button_off.Enabled    = false;
            button_start.Enabled  = false;
            button_Reset.Enabled  = false;

            rnd       = new Random();
            this.Text = home + state;
        }