コード例 #1
0
 protected override void DoWork()
 {
     try
     {
         McuReleaseSubmitWorkerThread parent = (McuReleaseSubmitWorkerThread)ParentThread;
         var workingdirectory = parent.AutomationDir;
         var startInfo        = new ProcessStartInfo();
         startInfo.UseShellExecute = false;
         startInfo.CreateNoWindow  = false;
         startInfo.FileName        = "python";
         var backendPythonApp = @"McuReleaseAutomation.py";
         var argus            = string.Format(@"{0} {1}", backendPythonApp, parent.InvokeParameters);
         startInfo.Arguments = argus;
         startInfo.Verb      = "runas";
         Directory.SetCurrentDirectory(workingdirectory);
         var process = new Process()
         {
             StartInfo = startInfo
         };
         process.Start();
         if (null != process && !process.HasExited)
         {
             process.WaitForExit();
         }
     }
     catch (Exception ex)
     {
         _logger.ErrorFormat(@"Exception caught at InvokeWorkflow, error = {0}", ex.Message);
         _success = false;
     }
 }
コード例 #2
0
ファイル: TearDownState.cs プロジェクト: lyh3/automation
        protected override void DoWork()
        {
            McuReleaseSubmitWorkerThread parent = (McuReleaseSubmitWorkerThread)ParentThread;

            for (var i = 0; i < 3; i++)
            {
                try
                {
                    if (File.Exists(parent.Request))
                    {
                        File.Delete(parent.Request);
                    }
                }
                catch (Exception ex)
                {
                    _logger.ErrorFormat(@"Exception caught at TearDownState, error = {0}", ex.Message);
                    _success = false;
                }
            }
        }