Exemplo n.º 1
0
        /// <summary>
        /// Запустить внешний процесс, используя procInterface
        /// </summary>
        /// <param name="procInterface"></param>
        /// <param name="AppName"></param>
        /// <param name="Switch"></param>
        /// <param name="args"></param>
        /// <param name="TaskName"></param>
        /// <returns></returns>
        private bool ExecuteProcess(ProcessInterface.ProcessInterface procInterface, string AppName, string args, string TaskName)
        {
            isBusy = true;
            ProcessStartInfo psi         = CreateProcessStartInfo(AppName, args);
            string           erroroutput = string.Empty;

            // Start process
            bool res = procInterface.StartProcess(psi);

            procInterface.WaitForExitProcess();

            try
            {
                erroroutput = ErrorStringBuilder.ToString();

                if (erroroutput.Length > 0)
                {
                    res = false;
                    ParseErrorString(erroroutput);
                }
            }
            catch (Exception ex)
            {
                Schematix.Core.Logger.Log.Error("Execute process error.", ex);
                System.Windows.MessageBox.Show(string.Format("Execute process error. Message: {0}", ex.Message), "Error ocrred", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                isBusy = false;
            }
            isBusy = false;

            return(res);
        }