private void SelectedIndexChanged(object sender, EventArgs e) { if (sender.Equals(cbxPixels) && cbxPixels.SelectedItem != null) { int past = scanPixels; scanPixels = ((KeyValuePair <int, string>)cbxPixels.SelectedItem).Key; if (past != scanPixels) { Logger.Info(string.Format("change scan pixels from [{0}] to [{1}].", past, scanPixels)); } } else if (sender.Equals(cbxGalvNum) && cbxGalvNum.SelectedItem != null) { GalvSystem past = galvNum; galvNum = ((KeyValuePair <GalvSystem, string>)cbxGalvNum.SelectedItem).Key; if (past != galvNum) { Logger.Info(string.Format("change galv num from [{0}] to [{1}].", past, galvNum)); } } else if (sender.Equals(cbxDirection) && cbxDirection.SelectedItem != null) { ScanDirection past = scanDirection; scanDirection = ((KeyValuePair <ScanDirection, string>)cbxDirection.SelectedItem).Key; if (scanDirection != past) { Logger.Info(string.Format("change scan direction from [{0}] to [{1}].", past, scanDirection)); } } }
private void InitVariables() { scanPixelsDict = new Dictionary <int, string>(); scanPixelsDict.Add(256, "256x256"); scanPixelsDict.Add(512, "512x512"); scanPixelsDict.Add(1024, "1024x1024"); scanPixelsDict.Add(2048, "2048x2048"); scanPixelsDict.Add(4096, "4096x4096"); galvNumDict = new Dictionary <GalvSystem, string>(); galvNumDict.Add(GalvSystem.TwoGalv, "双振镜"); galvNumDict.Add(GalvSystem.ThreeGalv, "三振镜"); scanDirectionDict = new Dictionary <ScanDirection, string>(); scanDirectionDict.Add(ScanDirection.Single, "单向"); scanDirectionDict.Add(ScanDirection.Double, "双向"); galvResponseTime = DEFAULT_GALV_RESPONSE_TIME; fieldSize = DEFAULT_FIELD_SIZE; scanPixels = DEFAULT_SCAN_PIXELS; pixelTime = DEFAULT_PIXEL_TIME; calibrationVoltage = DEFAULT_CALIBRATION_VOLTAGE; curveCoff = DEFAULT_CURVE_COFF; galvNum = DEFAULT_GALV_SYSTEM; scanDirection = DEFAULT_SCAN_DIRECTION; }
private void UpdateVariables() { galvResponseTime = double.Parse(tbxResponseTime.Text); fieldSize = double.Parse(tbxFieldSize.Text); scanPixels = ((KeyValuePair <int, string>)cbxPixels.SelectedItem).Key; pixelTime = double.Parse(tbxPixelTime.Text); calibrationVoltage = double.Parse(tbxCalibrationV.Text); curveCoff = double.Parse(tbxCurveCoff.Text); galvNum = ((KeyValuePair <GalvSystem, string>)cbxGalvNum.SelectedItem).Key; scanDirection = ((KeyValuePair <ScanDirection, string>)cbxDirection.SelectedItem).Key; }