public Engine(Config config) { this.config = config; this.colorimeter = new Colorimeter(); this.xml = new Xml(this.config.ScriptName); if (!this.config.IsSimulation) { this.fixture = new Fixture(this.config.FixturePortName); //this.ca310Pipe = new Ca310Pipe(System.Windows.Forms.Application.StartupPath); IDevice intergrate = new IntegratingSphere(this.fixture, this.config.LCP3005PortName); DevManage.Instance.AddDevice(fixture); DevManage.Instance.AddDevice(intergrate); } dut = (DUT)Activator.CreateInstance(Type.GetType("DUTclass." + this.config.ProductType)); mode = (TestMode)Enum.Parse(typeof(TestMode), this.config.TestMode); ip = new imagingpipeline(); args = new DataChangeEventArgs(); tableArgs = new TableViewEventArgs(); tableArgs.Items = xml.Items; log = new Testlog(); SerialNumber = ""; if (!System.IO.Directory.Exists(IMAGE_SAVE_PATH)) { System.IO.Directory.CreateDirectory(IMAGE_SAVE_PATH); } }
private void engine_tableDataChange(object sender, TableViewEventArgs args) { if (args.CurrentDevice == "Camera") { dgvData.Rows[args.Index].SetValues(args.Items[args.Index].TestName, args.Items[args.Index].TestNodes[3].Value, args.Items[args.Index].TestNodes[4].Value, args.Items[args.Index].TestNodes[5].Value, args.Items[args.Index].TestNodes[0].Value, args.Items[args.Index].TestNodes[1].Value, args.Items[args.Index].TestNodes[2].Value); double result = args.Items[args.Index].TestNodes[1].Value; bool bresult = args.Items[args.Index].TestNodes[1].Value <= args.Items[args.Index].TestNodes[1].Upper && args.Items[args.Index].TestNodes[1].Value >= args.Items[args.Index].TestNodes[1].Lower; if (!bresult && result > 0) { dgvData[5, args.Index].Style.BackColor = Color.Red; } else { dgvData[5, args.Index].Style.BackColor = Color.FloralWhite; } } else if (args.CurrentDevice == "Ca310") { dgvCa310Data.Rows[args.Index].SetValues(args.Items[args.Index].TestName, args.Items[args.Index].TestNodes[3].Value, args.Items[args.Index].TestNodes[4].Value, args.Items[args.Index].TestNodes[5].Value); for (int i = 3; i <= 5; i++) { if (args.Items[args.Index].TestNodes[i].Result == false && args.Items[args.Index].TestNodes[i].Value > 0) { dgvCa310Data[i - 2, args.Index].Style.BackColor = Color.Red; } else { dgvCa310Data[i - 2, args.Index].Style.BackColor = Color.FloralWhite; } } } }