|
|
@@ -137,13 +137,13 @@ namespace FileWatcher
|
|
|
Device.Text = BaseUtil.GetCacheData("Device").ToString();
|
|
|
}
|
|
|
catch (Exception ex) { MessageBox.Show(ex.Message); }
|
|
|
- StartWatch.PerformClick();
|
|
|
- bool hide = true;
|
|
|
- if (hide)
|
|
|
- {
|
|
|
- this.WindowState = FormWindowState.Minimized;
|
|
|
- this.ShowInTaskbar = true;
|
|
|
- }
|
|
|
+ //StartWatch.PerformClick();
|
|
|
+ //bool hide = true;
|
|
|
+ //if (hide)
|
|
|
+ //{
|
|
|
+ // this.WindowState = FormWindowState.Minimized;
|
|
|
+ // this.ShowInTaskbar = true;
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
private void ConnectDB()
|
|
|
@@ -186,8 +186,10 @@ namespace FileWatcher
|
|
|
{
|
|
|
XmlWatcher.Created += new FileSystemEventHandler(XmlWatcher_Created);
|
|
|
}
|
|
|
- Timer.Interval = 1000 * int.Parse(TimerInter.Text.ToString());
|
|
|
- Timer.Start();
|
|
|
+ else {
|
|
|
+ Timer.Interval = 1000 * int.Parse(TimerInter.Text.ToString());
|
|
|
+ Timer.Start();
|
|
|
+ }
|
|
|
//设置按钮不可点击
|
|
|
StartWatch.Enabled = false;
|
|
|
ChooseFolder.Enabled = false;
|
|
|
@@ -334,17 +336,18 @@ namespace FileWatcher
|
|
|
{
|
|
|
OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
string Backupfilename = BackUpFolderPath.Text + @"\" + MachineType.Text + @"\" + SN;
|
|
|
- if (!Directory.Exists(BackUpFolderPath.Text + @"\" + MachineType.Text))
|
|
|
- {
|
|
|
- Directory.CreateDirectory(BackUpFolderPath.Text + @"\" + MachineType.Text);
|
|
|
- }
|
|
|
+ //if (!Directory.Exists(BackUpFolderPath.Text + @"\" + MachineType.Text))
|
|
|
+ //{
|
|
|
+ // Directory.CreateDirectory(BackUpFolderPath.Text + @"\" + MachineType.Text);
|
|
|
+ //}
|
|
|
//if (File.Exists(Backupfilename))
|
|
|
//{
|
|
|
// File.Delete(Backupfilename);
|
|
|
//}
|
|
|
- if (!deleteFile.Checked)
|
|
|
+
|
|
|
+ if (deleteFile.Checked)
|
|
|
{
|
|
|
- File.Move(FileName, Backupfilename);
|
|
|
+ File.Delete(FileName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -354,12 +357,16 @@ namespace FileWatcher
|
|
|
if (num > 0)
|
|
|
{
|
|
|
OperateResult.AppendText("序列号:" + SN + "上传成功\n");
|
|
|
- string Backupfilename = BackUpFolderPath.Text + @"\" + MachineType.Text + @"\" + SN;
|
|
|
- if (!Directory.Exists(BackUpFolderPath.Text + @"\" + MachineType.Text))
|
|
|
+ if (deleteFile.Checked)
|
|
|
{
|
|
|
- Directory.CreateDirectory(BackUpFolderPath.Text + @"\" + MachineType.Text);
|
|
|
+ File.Delete(FileName);
|
|
|
}
|
|
|
- File.Move(FileName, Backupfilename);
|
|
|
+ //string Backupfilename = BackUpFolderPath.Text + @"\" + MachineType.Text + @"\" + SN;
|
|
|
+ //if (!Directory.Exists(BackUpFolderPath.Text + @"\" + MachineType.Text))
|
|
|
+ //{
|
|
|
+ // Directory.CreateDirectory(BackUpFolderPath.Text + @"\" + MachineType.Text);
|
|
|
+ //}
|
|
|
+ //File.Move(FileName, Backupfilename);
|
|
|
}
|
|
|
}
|
|
|
}
|