private void ImportConcentration_Click(object sender, RoutedEventArgs e) { try { OpenFileDialog op = new OpenFileDialog(); op.InitialDirectory = "C:\\";//默认的打开路径 if (importPath != null) { op.InitialDirectory = importPath; } op.RestoreDirectory = true; op.Filter = " 文本文件(*.txt)|*.txt|所有文件(*.*)|*.* "; if (op.ShowDialog() == true) { importPath = op.FileName.Substring(0, op.FileName.LastIndexOf('\\')); MessageBox.Show(op.FileName, "选择文件", MessageBoxButton.OK, MessageBoxImage.Information); string filenames = op.FileName; int piexNumber = 512;//Global.ConnectInst.Pixels float[] xVer = new float[piexNumber]; for (int i = 0; i < piexNumber; i++) { xVer[i] = i + 1; } if (File.Exists(filenames))//for (int files = 0; files < filenames.Length; files++) { int number = FileOperate.GetCurveNumber(filenames); bool isInteg = true; float[][] spec = FileOperate.GetSpecData(filenames, piexNumber, number, ref isInteg); for (int i = 0; i < spec.Length; i++) { //DataCacheControl.GetInstance().SetValue(spec[i], null, null, null, null, null); } } } } catch (Exception ex) { ExceptionUtil.Instance.ExceptionMethod("导入失败:" + ex.Message, true); } }