//复制图片到指定的文件夹 private void CopyPictures(ref TestingSample ts) { FileInfo[] arrfi = null; ProjectManager.WindowsHelper.LoadPictrueFiles(IsSortTimeCheckBox.IsChecked, IsReverseCheckBox.IsChecked, out arrfi); if (arrfi != null) { for (int i = 0; i < arrfi.Length; ++i) { arrfi[i].CopyTo(ts.PicturesPath.Name + "//" + i.ToString() + arrfi[i].Extension, true); } } }
//添加按钮的Click事件 private void AppendButton_Click(object sender, RoutedEventArgs e) { int result; if (isInputCorrectFlag) { nodeName = NodeNameTextBox.Text; if (int.TryParse(NodeNameTextBox.Text, out result)) { if (oldResult == result) { nodeName = (oldResult + 1).ToString(); NodeNameTextBox.Text = nodeName; } oldResult = result; } else { nodeName = NodeNameTextBox.Text; } //创建目录,并向TreeView添加 int startWl, spaceWl; if (int.TryParse(WaveLengthStartTB.Text, out startWl) && int.TryParse(WaveLengthSpaceTB.Text, out spaceWl)) { TestingSample ts = new TestingSample(); ts.StartWL = startWl; ts.SpaceWL = spaceWl; ts.PicturesPath = Directory.CreateDirectory(haPrj.GetActualProjFolderPath() + "\\".ToString() + nodeName); CopyPictures(ref ts); haPrj.TestsSamples.Add(ts); } else { TipsTextBlock.Text = "开始波长和步长必须是整数!"; } } else { TipsTextBlock.Text = "请输入合法的检测样品名称!"; } }