private void btndrawhistory_Click(object sender, EventArgs e) { try { g_timer1.Stop(); showindex = 0; main.Clear_JI(); btn_startShow.Text = "播放"; folderBrowserDialog1.SelectedPath = NetDataFilesPath; folderBrowserDialog1.Description = "select"; if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { selectpath = folderBrowserDialog1.SelectedPath; } if (selectpath != "") { DialogResult dr = MessageBox.Show(selectpath, "所选文件夹", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { richTextBox1.Text += "界面操作 点击\'选择\'按钮,并选择了文件夹:\n" + selectpath + "\r\n"; } else { return; } System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(selectpath); //int wjfileNum = dir.GetFiles("*.wj").Length; // 该目录下的文件数量。 FileInfo[] wjFiles = dir.GetFiles("*.txt"); wjfilesnum = wjFiles.Length; richTextBox1.Text += DateTime.Now.ToString() + "\r\n" + "选择数据文件夹,共有" + wjfilesnum.ToString() + "条数据" + "\r\n"; string readpath = selectpath + "\\" + wjFiles[0].ToString(); //ScanArrayJiYToDraw = WriteOrReadFiles.Readtxt(readpath, ScanDrawDataLength);// readtxt(readpath); List <string> ListDataReadFromFile = WriteOrReadFiles.ReadDataFromFileByStreamOneLine(readpath); for (int i = 0; i < ListDataReadFromFile.Count; i++) { ScanArrayJiYToDraw[i] = Convert.ToDouble(ListDataReadFromFile[i]); } main.Draw_JI(ScanArrayJiYToDraw); ArrayFileInfo.Clear(); ArrayFileInfo.AddRange(wjFiles); txt_jump.Text = 0.ToString(); } } catch { return; } }
private void timer1_Tick(object sender, EventArgs e) { try { if (showindex < ArrayFileInfo.Count) { string readpath = selectpath + "\\" + ArrayFileInfo[showindex++].ToString(); ScanArrayJiYToDraw = WriteOrReadFiles.Readtxt(readpath, ScanDrawDataLength);// readtxt(readpath); main.Draw_JI(ScanArrayJiYToDraw); MethodInvoker mi = new MethodInvoker(show_index); this.BeginInvoke(mi); } } catch { return; } }
private void btn_jump_Click(object sender, EventArgs e) { try { int fileindex = Convert.ToInt32(txt_jump.Text); int arraycount = ArrayFileInfo.Count; if (fileindex < arraycount) { string readpath = selectpath + "\\" + ArrayFileInfo[fileindex].ToString(); ScanArrayJiYToDraw = WriteOrReadFiles.Readtxt(readpath, ScanDrawDataLength);// readtxt(readpath); main.Draw_JI(ScanArrayJiYToDraw); showindex = fileindex; } else { MessageBox.Show("输入的索引值超过文件个数!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { return; } }
private void btnnext_Click(object sender, EventArgs e) { try { int fileindex = Convert.ToInt32(txt_jump.Text); int arraycount = ArrayFileInfo.Count; if (fileindex < arraycount) { if (fileindex <= arraycount - 2) { fileindex += 1; string readpath = selectpath + "\\" + ArrayFileInfo[fileindex].ToString(); //ScanArrayJiYToDraw = WriteOrReadFiles.Readtxt(readpath, ScanDrawDataLength);// readtxt(readpath); List <string> ListDataReadFromFile = WriteOrReadFiles.ReadDataFromFileByStreamOneLine(readpath); for (int i = 0; i < ListDataReadFromFile.Count; i++) { ScanArrayJiYToDraw[i] = Convert.ToDouble(ListDataReadFromFile[i]); } main.Draw_JI(ScanArrayJiYToDraw); txt_jump.Text = fileindex.ToString(); showindex = fileindex; } else { MessageBox.Show("已经是最后一组数据!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("输入的索引值超过文件个数!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch { return; } }