DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/App.config
@@ -5,5 +5,6 @@ </startup> <appSettings> <add key="OP80QualityData_Test" value="X:\CA4GC20TD_Test\"/> <add key="OP60QualityData_Test" value="Q:\Measuring_Data_df_Test\"/> </appSettings> </configuration> DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.Designer.cs
@@ -29,23 +29,35 @@ private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(76, 55); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(135, 54); this.button1.Size = new System.Drawing.Size(244, 54); this.button1.TabIndex = 0; this.button1.Text = "测试移动文件"; this.button1.Text = "OP80测试移动文件"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(76, 142); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(244, 54); this.button2.TabIndex = 1; this.button2.Text = "OP60测试移动文件"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(800, 450); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; @@ -56,6 +68,7 @@ #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; } } DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_FormTest/Form1.cs
@@ -9,6 +9,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock; namespace iWare_SCADA_FormTest { @@ -43,5 +44,29 @@ } } private void button2_Click(object sender, EventArgs e) { try { string path = ConfigHelper.GetConfigString("OP60QualityData_Test"); var newFiles = FileHelper.DetectNewFiles(path, "*.dfq", 300, DateTime.Now.AddDays(-100), DateTime.Now.AddDays(1)); foreach (System.IO.FileInfo file in newFiles) { //MessageBox.Show("找到文件:" + file.FullName); var toPath = file.FullName.Replace("Measuring_Data_df_Test", "Measuring_Data_df_Copy"); //MessageBox.Show("要移动到:" + file.FullName); File.Move(file.FullName, toPath);//移动 } MessageBox.Show("成功"); } catch (Exception ex) { MessageBox.Show("异常:" + ex.Message); } } } }