DataReadConfigurationForm.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace OTSExtremum
  11. {
  12. public partial class DataReadConfigurationForm : Form
  13. {
  14. int _loadCount = 0;
  15. string _filepath = "";
  16. public int LoadCount
  17. {
  18. set { _loadCount = value; }
  19. get { return _loadCount; }
  20. }
  21. public string Filepath
  22. {
  23. set { _filepath = value; }
  24. get { return _filepath; }
  25. }
  26. public DataReadConfigurationForm()
  27. {
  28. InitializeComponent();
  29. }
  30. private void btn_open_Click(object sender, EventArgs e)
  31. {
  32. System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
  33. dialog.Description = "请选择测量结果所在文件夹";
  34. if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  35. {
  36. tB_filepath.Text = dialog.SelectedPath;
  37. }
  38. }
  39. private void DataReadConfigurationForm_Load(object sender, EventArgs e)
  40. {
  41. }
  42. private void btn_load_Click(object sender, EventArgs e)
  43. {
  44. if(tB_filepath.Text==null)
  45. {
  46. MessageBox.Show("请选择一个测量结果!");
  47. }
  48. int count = 0;
  49. if(!int.TryParse(tB_loadCount.Text,out count))
  50. {
  51. MessageBox.Show("请填写正确数据格式!");
  52. tB_loadCount.Focus();
  53. return;
  54. }
  55. LoadCount = count;
  56. Filepath = tB_filepath.Text;
  57. this.DialogResult = DialogResult.OK;
  58. Close();
  59. }
  60. }
  61. }