章政 5 жил өмнө
parent
commit
57acf57129
1 өөрчлөгдсөн 5 нэмэгдсэн , 5 устгасан
  1. 5 5
      FileWatcher/Form1.cs

+ 5 - 5
FileWatcher/Form1.cs

@@ -16,7 +16,7 @@ namespace FileWatcher
 
         private void Form1_Load(object sender, EventArgs e)
         {
-            FileWatcher.Path = @"C:\";
+            FileWatcher.Path = @"D:\";
             FileWatcher.Filter = "*.jdf";
             FileWatcher.EnableRaisingEvents = true;
             FileWatcher.Created += new FileSystemEventHandler(Watcher_Created);
@@ -28,6 +28,7 @@ namespace FileWatcher
             rk2.Close();
             rk.Close();
             timer1.Interval = 1800000;
+            //timer1.Interval = 30000;
             timer1.Start();
 
         }
@@ -51,21 +52,20 @@ namespace FileWatcher
                 //不存在同名的文件则进行转换
                 if (!File.Exists(StartPath + Filename + ".xls") && File.Exists(FullName))
                 {
-                    exec(@"C:\FileWatcher\DTS-JDFData2Excel.exe", @"C:\FileWatcher\DTS-JDFData2Excel.exe " + FullName);
+                    exec(@"D:\FileWatcher\DTS-JDFData2Excel.exe", @"D:\FileWatcher\DTS-JDFData2Excel.exe " + FullName);
                 }
             }
         }
 
         public void exec(string exePath, string parameters)
         {
-            Process process = new System.Diagnostics.Process();
+            Process process = new Process();
             process.StartInfo.FileName = exePath;
             process.StartInfo.Arguments = parameters;
             process.StartInfo.UseShellExecute = false;
             process.StartInfo.CreateNoWindow = true;
             process.StartInfo.RedirectStandardOutput = true;
-            process.BeginOutputReadLine();
-            process.OutputDataReceived += new DataReceivedEventHandler(Process_OutputDataReceived);
+            process.Start();
         }
 
         private void Process_OutputDataReceived(object sender, DataReceivedEventArgs e)