Beispiel #1
0
        private void button_Main456_Test_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (Channel_API[ch] == null)
                {
                    Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                }
                if (ocparams[ch] == null)
                {
                    ocparams[ch] = new DP213_OCParameters(Channel_API[ch], ch, richTextBoxes[ch]);
                }

                double[] xyl = Channel_API[ch].measure_XYL(ch);
                if (xyl[2] > 50)
                {
                    ICompensation main456 = new DP213_Mode456_Main_Compensation(Channel_API[ch], ocparams[ch], ch, new OCVars(Channel_API[ch]));
                    main456.Compensation();
                }
            }
        }
Beispiel #2
0
        public IActionResult CreateVendor([FromBody] VendorForm form)
        {
            var error     = new Error();
            var materials = new List <MaterialVendor>();

            foreach (var material in form.NewMaterial)
            {
                material.VendorId = form.VendorId;
                materials.Add(material.MapToCore());
            }
            foreach (var material in form.KnownMaterial)
            {
                material.VendorId = form.VendorId;
                materials.Add(material.MapToCore());
            }

            //Validate materials
            foreach (var material in materials)
            {
                _materialManager.ValidateMaterial(material, ref error);
                if (error.ErrorCode != ErrorCode.OKAY)
                {
                    return(BadRequest(error.Message));
                }
            }

            var vendorId = _vendorManager.CreateVendor(form.MapToCore(), ref error);

            if (error.ErrorCode != ErrorCode.OKAY)
            {
                return(BadRequest(error.Message));
            }

            return(Ok(new { VendorId = vendorId }));
        }
Beispiel #3
0
        private void button_Display_Pattern_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            byte R = Convert.ToByte(textBox_R.Text);
            byte G = Convert.ToByte(textBox_G.Text);
            byte B = Convert.ToByte(textBox_B.Text);

            byte[] RGB = new byte[3] {
                R, G, B
            };
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil)
                {
                    IsSampleDisplayed[ch] = true;
                }
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
                {
                    IsSampleDisplayed[ch] = true;                                                         //for test
                }
                if (IsSampleDisplayed[ch])
                {
                    if (Channel_API[ch] == null)
                    {
                        Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                    }
                    Channel_API[ch].DisplayMonoPattern(RGB, ch);
                }
            }
        }
Beispiel #4
0
        private void button_Read_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            byte Address = Convert.ToByte(Convert.ToInt32(textBox_Read_Address.Text, 16));
            int  amount  = Convert.ToInt32(textBox_Read_HowMany.Text);
            int  offset  = Convert.ToInt32(textBox_Read_Offset.Text, 16);

            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil)
                {
                    IsSampleDisplayed[ch] = true;
                }
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
                {
                    IsSampleDisplayed[ch] = true;
                }

                if (IsSampleDisplayed[ch])
                {
                    if (Channel_API[ch] == null)
                    {
                        Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                    }
                    ReadData[ch] = Channel_API[ch].ReadData(Address, amount, offset, ch);
                }
            }
        }
Beispiel #5
0
        private void button_Measure_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil)
                {
                    IsCAConnected[ch] = true;
                }
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
                {
                    IsCAConnected[ch] = true;
                }

                if (IsCAConnected[ch])
                {
                    if (Channel_API[ch] == null)
                    {
                        Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                    }
                    MeasuredXYLv[ch] = Channel_API[ch].measure_XYL(ch);
                }
            }
        }
Beispiel #6
0
        private void button_Compensation_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil ||
                    VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
                {
                    IsCAConnected[ch]     = true;
                    IsSampleDisplayed[ch] = true;
                }

                if (IsCAConnected[ch] && IsSampleDisplayed[ch])
                {
                    if (Channel_API[ch] == null)
                    {
                        Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                    }
                    if (ocparams[ch] == null)
                    {
                        ocparams[ch] = new DP213_OCParameters(Channel_API[ch], ch, richTextBoxes[ch]);
                    }

                    Channel_OC[ch] = new CompensationFacade(ModelName.DP213, Channel_API[ch], ocparams[ch], ch);
                    Channel_OC[ch].OpticCompensation();
                }
            }
        }
Beispiel #7
0
        private void button_Write_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            byte Address = Convert.ToByte(Convert.ToInt32(textBox_Write_Address.Text, 16));

            byte[] parameters = Get_pamaeters();

            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil)
                {
                    IsSampleDisplayed[ch] = true;
                }
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
                {
                    IsSampleDisplayed[ch] = true;                                                         //for test
                }
                if (IsSampleDisplayed[ch])
                {
                    richTextBoxes[ch].AppendText("ch : " + ch);

                    if (Channel_API[ch] == null)
                    {
                        Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                    }
                    Channel_API[ch].WriteData(Address, parameters, ch);
                }
            }
        }
Beispiel #8
0
        public IActionResult EditMaterials([FromBody] VendorForm form)
        {
            var error = new Error();

            var materials = new List <MaterialVendor>();

            foreach (var material in form.NewMaterial)
            {
                material.VendorId = form.VendorId;
                materials.Add(material.MapToCore());
            }
            foreach (var material in form.KnownMaterial)
            {
                material.VendorId = form.VendorId;
                materials.Add(material.MapToCore());
            }

            //Validate materials
            foreach (var material in materials)
            {
                _materialManager.ValidateMaterial(material, ref error);
                if (error.ErrorCode != ErrorCode.OKAY)
                {
                    return(BadRequest(error.Message));
                }
            }

            _materialManager.AddMaterials(materials, ref error);


            return(GetVendorDetails(form.VendorId));
        }
Beispiel #9
0
 private void button_ThreadWithout_Test_Click(object sender, EventArgs e)
 {
     for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
     {
         Test test = new Test(richTextBoxes[ch]);
         test.TestThread();
     }
 }
Beispiel #10
0
        private void button_display_box_pattern_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());

            byte f_red   = Convert.ToByte(textBox_box_fore_R.Text);
            byte f_green = Convert.ToByte(textBox_box_fore_G.Text);
            byte f_blue  = Convert.ToByte(textBox_box_fore_B.Text);

            byte[] Box_RGB = new byte[3] {
                f_red, f_green, f_blue
            };

            byte b_red   = Convert.ToByte(textBox_box_back_R.Text);
            byte b_green = Convert.ToByte(textBox_box_back_G.Text);
            byte b_blue  = Convert.ToByte(textBox_box_back_B.Text);

            byte[] BackGround_RGB = new byte[3] {
                b_red, b_green, b_blue
            };

            int box_left = Convert.ToInt32(textBox_Pos_BoxLeft.Text);
            int box_top  = Convert.ToInt32(textBox_Pos_BoxTop.Text);

            int[] Pos_BoxLeftTop = new int[2] {
                box_left, box_top
            };

            int box_right  = Convert.ToInt32(textBox_Pos_BoxRight.Text);
            int box_bottom = Convert.ToInt32(textBox_Pos_BoxBottom.Text);

            int[] Pos_BoxRightBottom = new int[2] {
                box_right, box_bottom
            };

            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil)
                {
                    IsSampleDisplayed[ch] = true;
                }
                if (VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
                {
                    IsSampleDisplayed[ch] = true;                                                         //for test
                }
                if (IsSampleDisplayed[ch])
                {
                    if (Channel_API[ch] == null)
                    {
                        Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                    }
                    Channel_API[ch].DisplayBoxPattern(Box_RGB, BackGround_RGB, Pos_BoxLeftTop, Pos_BoxRightBottom, ch);
                }
            }
        }
Beispiel #11
0
 private void button_CA_Connect_Click(object sender, EventArgs e)
 {
     if (VendorForm.GetInstance().GetVendor() == WhichVendor.Gooil)
     {
         GooilMeasurement.CA_Connect();
     }
     else if (VendorForm.GetInstance().GetVendor() == WhichVendor.LGD)
     {
         LGDMeasurement.CA_Connect();
     }
 }
Beispiel #12
0
        public override void Run()
        {
            VendorForm        form = new VendorForm();
            IVendorRepository dao  = new NHibernateVendorRepository();

            form.VendorSave += delegate(object sender, VendorEventArgs e) {
                dao.SaveOrUpdate(e.Vendor);
                form.Close();
            };
            WorkbenchSingleton.AddChild(form);
        }
Beispiel #13
0
        private void button_ThreadWith_Test_Click(object sender, EventArgs e)
        {
            Thread[] th   = new Thread[VendorForm.GetInstance().GetChannelLength()];
            Test[]   test = new Test[VendorForm.GetInstance().GetChannelLength()];

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                test[ch] = new Test(richTextBoxes[ch]);
                th[ch]   = new Thread(test[ch].TestThread);
                th[ch].Start();
            }
        }
Beispiel #14
0
        public IActionResult EditVendor([FromBody] VendorForm form)
        {
            var error  = new Error();
            var vendor = _vendorManager.UpdateVendor(form.MapToCore(), ref error);

            if (error.ErrorCode != ErrorCode.OKAY)
            {
                return(BadRequest(error.Message));
            }

            return(Ok(VendorDetails.MapFromObject(vendor, _responseGenerator)));
        }
Beispiel #15
0
        public IActionResult Get(long id)
        {
            var vendor = _vendorRepository.Query().Include(x => x.Users).FirstOrDefault(x => x.Id == id);
            var model  = new VendorForm
            {
                Id          = vendor.Id,
                Name        = vendor.Name,
                Email       = vendor.Email,
                Description = vendor.Description,
                IsActive    = vendor.IsActive,
                Managers    = vendor.Users.Select(x => new VendorManager {
                    UserId = x.Id, Email = x.Email
                }).ToList()
            };

            return(Json(model));
        }
        public IActionResult Put(long id, [FromBody] VendorForm model)
        {
            if (ModelState.IsValid)
            {
                var vendor = _vendorRepository.Query().FirstOrDefault(x => x.Id == id);
                vendor.Name        = model.Name;
                vendor.SeoTitle    = model.Name.ToUrlFriendly();
                vendor.Email       = model.Email;
                vendor.Description = model.Description;
                vendor.IsActive    = model.IsActive;

                _vendorService.Update(vendor);

                return(Ok());
            }

            return(new BadRequestObjectResult(ModelState));
        }
Beispiel #17
0
        public async Task <IActionResult> Put(long id, [FromBody] VendorForm model)
        {
            if (ModelState.IsValid)
            {
                var vendor = _vendorRepository.Query().FirstOrDefault(x => x.Id == id);
                vendor.Name        = model.Name;
                vendor.Slug        = model.Slug;
                vendor.Email       = model.Email;
                vendor.Description = model.Description;
                vendor.IsActive    = model.IsActive;
                vendor.UpdatedOn   = DateTimeOffset.Now;

                await _vendorService.Update(vendor);

                return(Accepted());
            }

            return(BadRequest(ModelState));
        }
Beispiel #18
0
        public async Task <IActionResult> Post([FromBody] VendorForm model)
        {
            if (ModelState.IsValid)
            {
                var vendor = new Vendor
                {
                    Name        = model.Name,
                    Slug        = model.Slug,
                    Email       = model.Email,
                    Description = model.Description,
                    IsActive    = model.IsActive
                };

                await _vendorService.Create(vendor);

                return(CreatedAtAction(nameof(Get), new { id = vendor.Id }, null));
            }
            return(BadRequest(ModelState));
        }
Beispiel #19
0
        public IActionResult Post([FromBody] VendorForm model)
        {
            if (ModelState.IsValid)
            {
                var vendor = new Vendor
                {
                    Name        = model.Name,
                    SeoTitle    = model.Name.ToUrlFriendly(),
                    Email       = model.Email,
                    Description = model.Description,
                    IsActive    = model.IsActive
                };

                _vendorService.Create(vendor);

                return(Ok());
            }
            return(new BadRequestObjectResult(ModelState));
        }
Beispiel #20
0
        private void button_Test_AOD_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (Channel_API[ch] == null)
                {
                    Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                }
                if (ocparams[ch] == null)
                {
                    ocparams[ch] = new DP213_OCParameters(Channel_API[ch], ch, richTextBoxes[ch]);
                }
                ICompensation graylowrefOC = new DP213_AODCompensation(Channel_API[ch], ocparams[ch], ch, new OCVars(Channel_API[ch]));
                graylowrefOC.Compensation();
            }
        }
Beispiel #21
0
        private void button_Flash_Erase_and_Write_Click(object sender, EventArgs e)
        {
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (Channel_API[ch] == null)
                {
                    Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                }
                if (ocparams[ch] == null)
                {
                    ocparams[ch] = new DP213_OCParameters(Channel_API[ch], ch, richTextBoxes[ch]);
                }

                IFlashMemory dP213Flash = new DP213Flash(Channel_API[ch], ocparams[ch], ch, new OCVars(Channel_API[ch]));
                dP213Flash.FlashEraseAndWrite();
            }
        }
Beispiel #22
0
        private void button_OCParameters_Class_Verify_Click(object sender, EventArgs e)
        {
            //Verify OK
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            int height = Convert.ToInt32(textBox_Full_Height.Text);
            int width  = Convert.ToInt32(textBox_Full_Width.Text);

            for (int ch = 0; ch < VendorForm.GetInstance().GetChannelLength(); ch++)
            {
                if (Channel_API[ch] == null)
                {
                    Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
                }
                DP213_OCParameters oc_param = new DP213_OCParameters(Channel_API[ch], ch, richTextBoxes[ch]);

                richTextBoxes[ch].AppendText("\n\n--Mode1--");
                oc_param.ShowOCParamData(OC_Mode.Mode1);
                oc_param.ShowVoltageData(OC_Mode.Mode1);

                richTextBoxes[ch].AppendText("\n\n--Mode2--");
                oc_param.ShowOCParamData(OC_Mode.Mode2);
                oc_param.ShowVoltageData(OC_Mode.Mode2);

                richTextBoxes[ch].AppendText("\n\n--Mode3--");
                oc_param.ShowOCParamData(OC_Mode.Mode3);
                oc_param.ShowVoltageData(OC_Mode.Mode3);

                richTextBoxes[ch].AppendText("\n\n--Mode4--");
                oc_param.ShowOCParamData(OC_Mode.Mode4);
                oc_param.ShowVoltageData(OC_Mode.Mode4);

                richTextBoxes[ch].AppendText("\n\n--Mode5--");
                oc_param.ShowOCParamData(OC_Mode.Mode5);
                oc_param.ShowVoltageData(OC_Mode.Mode5);

                richTextBoxes[ch].AppendText("\n\n--Mode6--");
                oc_param.ShowOCParamData(OC_Mode.Mode6);
                oc_param.ShowVoltageData(OC_Mode.Mode6);
            }
        }
Beispiel #23
0
        public async Task <IActionResult> Get(long id)
        {
            var vendor = await _vendorRepository.Query().Include(x => x.Users).FirstOrDefaultAsync(x => x.Id == id);

            if (vendor == null)
            {
                return(NotFound());
            }

            var model = new VendorForm
            {
                Id          = vendor.Id,
                Name        = vendor.Name,
                Slug        = vendor.Slug,
                Email       = vendor.Email,
                Description = vendor.Description,
                IsActive    = vendor.IsActive,
                Managers    = vendor.Users.Select(x => new VendorManager {
                    UserId = x.Id, Email = x.Email
                }).ToList()
            };

            return(Json(model));
        }
Beispiel #24
0
        private void button_Test_DP213CMD_Class_Click(object sender, EventArgs e)
        {
            //Verify OK
            ChannelWinformAPIFactory channelAPIFactory = new ChannelWinformAPIFactory(VendorForm.GetInstance().GetVendor());
            const int ch     = 0;
            int       height = Convert.ToInt32(textBox_Full_Height.Text);
            int       width  = Convert.ToInt32(textBox_Full_Width.Text);

            Channel_API[ch] = channelAPIFactory.GetIBusinessAPI(richTextBoxes[ch], height, width);
            DP213CMD cmd = new DP213CMD(Channel_API[ch], ch);

            cmd.SendGammaSetApplyCMD(Gamma_Set.Set1);
            cmd.SendGammaSetApplyCMD(Gamma_Set.Set2);
            cmd.SendGammaSetApplyCMD(Gamma_Set.Set3);
            cmd.SendGammaSetApplyCMD(Gamma_Set.Set4);
            cmd.SendGammaSetApplyCMD(Gamma_Set.Set5);
            cmd.SendGammaSetApplyCMD(Gamma_Set.Set6);

            cmd.DBV_Setting("FFF");
            cmd.DBV_Setting("DDD");
            cmd.DBV_Setting("ABC");

            if (ocparams[0] == null)
            {
                ocparams[0] = new DP213_OCParameters(Channel_API[0], 0, richTextBoxes[ch]);
            }
            cmd.Measure(ocparams[0], OC_Mode.Mode1, band: 0, gray: 0);
        }
Beispiel #25
0
 private void Form1_Load(object sender, EventArgs e)
 {
     VendorForm.GetInstance().Show();
     this.Enabled = false;
 }
Beispiel #26
0
 private void vendorsToolStripMenuItem_Click(object sender, EventArgs e)
 {
     VendorForm.Show(this);
 }
Beispiel #27
0
 protected void LoadRelatedFormData(VendorForm model)
 {
     model.Countries        = _countryService.Query.Where(c => c.Enabled).Select(c => new SelectListItem(c.Name, c.Id.ToString())).ToList();
     model.GoogleCategories = _categoryService.Query.Where(c => c.Enabled).Select(c => new SelectListItem(c.Name, c.Id.ToString())).ToList();
 }
Beispiel #28
0
 protected override void LoadRelatedEditModelData(VendorForm model)
 {
     LoadRelatedFormData(model);
 }