示例#1
0
 public void markDoneTask(LabTasks congviec, MyEventArgs e)
 {
     //tìm trong list labtasks
     //congviec.NumOfTasks la index trong LabTasks
     this.labtasks[congviec.NumOfTasks].isDone = true;
     //đánh dấu congviec.isDone = true;
 }
示例#2
0
 public void noteTask(LabTasks congviec, MyEventArgs e)
 {
     this.labtasks.Add(congviec);
 }
 //Mỗi công việc do instructor giao cho phòng máy (Distribute tasks)
 //Người vận hành phòng máy hoặc student sẽ nhận được những công việc đó
 //Mỗi đối tượng công việc sẽ có các cách thực thi khác nhau tùy theo nội dung công việc được truyền vào (topic)
 public void giveTask(LabTasks congviec, MyEventArgs e)
 {
     EVgiveTask?.Invoke(congviec, e);
     //chỉ thực hiện truy vấn khi có subscribe event
 }
 public LabTasks(LabTasks a)
 {
     this.NumOfTasks = taskIndex++;
     this.Topics     = a.Topics;
     this.isDone     = a.isDone;
 }
示例#5
0
 public void Broken()
 {
     this.IsBroken = true;
     LabTasks fixBroken = new LabTasks($"Sua may {this.Device_id}");
 }
 public static void confirmTask(LabTasks congviec, MyEventArgs e)
 {
     Console.WriteLine($"{e.Data}: {congviec.Topics}");
 }
        static void Main(string[] args)
        {
            Console.WriteLine("============= QUAN LY THIET BI VAT TU PHONG MAY =============");
            LabInstructor nguyen = new LabInstructor("Nguyen Van A", "Thiet bi phan cung");
            LabIncharge   minh   = new LabIncharge("Nguyen Van B", Level.Bronze);
            Lab           a      = new Lab("A5-303", "Phong may 1", nguyen, minh, new DateTime(125), new DateTime(263));

            Console.WriteLine(a.Print_LabInfo());

            //Default
            a.labIns.EVgiveTask        += a.noteTask; //subscribe event: theo dõi sự kiện
            a.labIns.EVgiveTask        += confirmTask;
            a.labInc.EVconfirmDoneTask += a.markDoneTask;
            a.labInc.EVconfirmDoneTask += confirmTask;

            LabTasks b = new LabTasks();

            Console.Write($"Nhap cong viec thu {b.NumOfTasks + 1}: ");
            b.Topics = Console.ReadLine();
            a.labIns.giveTask(b, new MyEventArgs("Da ban giao cong viec "));
            a.labInc.confirmDoneTask(b, new MyEventArgs("Da lam xong "));
            Console.WriteLine(a.labtasks[0].isDone);

            //LabTasks task2 = new LabTasks();
            //Console.Write($"Nhap cong viec thu {task2.NumOfTasks + 1}: ");
            //task2.Topics = Console.ReadLine();
            //a.labIns.giveTask(task2, new MyEventArgs("taks2"));
            //a.labInc.confirmDoneTask(task2, new MyEventArgs("Da lam xong "));
            //Console.WriteLine(a.labtasks[1].isDone);

            Devices PC01 = new PC(new DateTime(100), new DateTime(225), "may1", CPU.i5, RAM.DDR4, "700W");

            //Console.WriteLine(PC01.Print_Info());
            Console.Write($"Nhap ID thiet bi can kiem tra: ");
            PC01.Device_id = Console.ReadLine();
            a.addDevice(PC01);
            a.labInc.EVcheckDevice += a.SeekingAndChecking;
            a.labInc.EVcheckDevice += confirmCheckDevices;
            a.labInc.CheckDevices(PC01, new MyEventArgs($"Da kiem tra thiet bi {PC01.Device_id}"));
            Console.WriteLine(PC01.Print_Info());

            //Install
            Console.Write($"Nhap phan mem can tien hanh cac thao tac: ");
            Software ungdung1 = new Software();

            ungdung1.SoftWare_name = Console.ReadLine();
            ungdung1.addSoftware(ungdung1);
            a.labInc.EventInstall += a.SoftwareChecking;
            a.labInc.EventInstall += Install;
            a.labInc.thucThiEventInstall(ungdung1, new MyEventArgs($"Dang cai dat phan mem { ungdung1.SoftWare_name }..... CAI DAT THANH CONG!"));

            //UnInstall
            a.labInc.EventUninstall += a.SoftwareChecking;
            a.labInc.EventUninstall += Uninstall;
            a.labInc.thucThiEventUninstall(ungdung1, new MyEventArgs($"Dang go cai dat phan mem { ungdung1.SoftWare_name }..... GO CAI DAT THANH CONG!"));


            //Update
            a.labInc.EventUpdate += a.SoftwareChecking;
            a.labInc.EventUpdate += Update;
            a.labInc.thucThiEventUpdate(ungdung1, new MyEventArgs($"Dang go cai dat phan mem { ungdung1.SoftWare_name }..... CAP NHAT THANH CONG!"));

            Software ungdung2 = new Software("unikey", SubCpu.Ryzen);
            Software c        = ungdung1 + ungdung2;

            Console.WriteLine(c.SoftWare_name + " " + c.subCpu);

            PC01.EventCheckSoft += CheckSoft;
            Console.WriteLine(PC01.thucThiEventCheckSoft(PC01, ungdung1));

            PC test = new PC(PC01.Enumerate_date, PC01.LastCheck_date, PC01.Device_id, CPU.i5, RAM.DDR4, "550W");

            a.labInc.EventCheckSoftSuiCpu += CheckSoftSuiCpu;
            Console.WriteLine(a.labInc.thucThiEventCheckSoftSuiCpu(test, ungdung1));

            PC01.EventDriver += Driver;
            Console.WriteLine(PC01.thucThiEventDriver(PC01));

            a.labInc.EventCheckDriver += CheckDriver;
            Console.WriteLine(a.labInc.thucThiEventCheckDriver(PC01));
        }