Beispiel #1
0
        public ScanTaskInfo(SettingFile.scanParameter para, bool isBackground, string spectrumFile)
        {
            this.spectrumFile = spectrumFile;
            scanPara          = para.Clone();
            //检查是否没有指定路径,如果没有,表示该文件在Setting目录下
            if (scanPara.scanSettingFile.IndexOf("\\") < 0 && scanPara.scanSettingFile.IndexOf("/") < 0)
            {
                scanPara.scanSettingFile = System.IO.Path.Combine(SettingData.settingFolder, scanPara.scanSettingFile);
            }

            this.isBackground  = isBackground;
            this.scanSuccessed = false;
        }
        public SettingFile.scanParameter GetScanParameter()
        {
            try
            {
                curpara.autoScan       = checkAutoScan.IsChecked == true;
                curpara.autoScanTime   = float.Parse(txtScanTime.Text);
                curpara.integrateTime  = curpara.autoScanTime;
                curpara.scanCount      = int.Parse(txtScanCount.Text);
                curpara.autoScanFirstX = float.Parse(txtFirstX.Text);
                curpara.autoScanLastX  = float.Parse(txtLastX.Text);

                return(curpara.Clone());     //返回一个新值,防止引用错误
            }
            catch (Exception ex)
            {
                CommonMethod.ErrorMsgBox(ex.Message);
                return(null);
            }
        }
 public void SetScanParameter(SettingFile.scanParameter newpara)
 {
     if (newpara != null)
     {
         curpara = newpara.Clone();
     }
     else
     {
         curpara = new SettingFile.scanParameter();      //设置为初始化数据
     }
     if (checkAutoScan.IsChecked == curpara.autoScan)    //AutoScan相同,需要强制刷新
     {
         checkAutoScan_Checked(null, null);
     }
     else    //将会自动刷新
     {
         checkAutoScan.IsChecked = curpara.autoScan;
     }
 }