コード例 #1
0
        private static void BwDoWork(object sender, DoWorkEventArgs e)
        {
            object[] threadParameter = e.Argument as object[];
            if (threadParameter == null)
            {
                return;
            }
            ITool        toolToExecute = threadParameter[0] as ITool;
            ToolProgress progForm      = threadParameter[1] as ToolProgress;

            if (progForm == null)
            {
                return;
            }
            if (toolToExecute == null)
            {
                return;
            }

            progForm.Progress(String.Empty, 0, "==================");
            progForm.Progress(String.Empty, 0, String.Format("Executing Tool: {0}", toolToExecute.Name));
            progForm.Progress(String.Empty, 0, "==================");
            toolToExecute.Execute(progForm);
            progForm.ExecutionComplete();
            progForm.Progress(String.Empty, 0, "==================");
            progForm.Progress(String.Empty, 0, String.Format("Done Executing Tool: {0}", toolToExecute.Name));
            progForm.Progress(String.Empty, 0, "==================");
        }
コード例 #2
0
        private static void BwDoWork(object sender, DoWorkEventArgs e)
        {
            object[] threadParameter = e.Argument as object[];
            if (threadParameter == null)
            {
                return;
            }
            ITool        toolToExecute = threadParameter[0] as ITool;
            ToolProgress progForm      = threadParameter[1] as ToolProgress;

            if (progForm == null)
            {
                return;
            }
            if (toolToExecute == null)
            {
                return;
            }
            Thread.CurrentThread.CurrentCulture   = progForm.ToolProgressCulture;
            Thread.CurrentThread.CurrentUICulture = progForm.ToolProgressCulture;

            progForm.Progress(string.Empty, 0, "==================");
            progForm.Progress(string.Empty, 0, string.Format(MessageStrings.ToolManager_ExecutingTool, toolToExecute.Name));
            progForm.Progress(string.Empty, 0, "==================");
            bool result = false;

            try
            {
                result = toolToExecute.Execute(progForm);
            }
            catch (Exception ex)
            {
                progForm.Progress(string.Empty, 100, "Error: " + ex);
            }

            e.Result = result;
            progForm.ExecutionComplete();
            progForm.Progress(string.Empty, 100, "==================");
            progForm.Progress(string.Empty, 100, string.Format(MessageStrings.ToolManager_DoneExecutingTool, toolToExecute.Name));
            progForm.Progress(string.Empty, 100, "==================");
        }
コード例 #3
0
        private static void BwDoWork(object sender, DoWorkEventArgs e)
        {
            object[] threadParameter = e.Argument as object[];
            if (threadParameter == null)
            {
                return;
            }
            IModelTool   toolToExecute = threadParameter[0] as IModelTool;
            ToolProgress progForm      = threadParameter[1] as ToolProgress;

            if (progForm == null)
            {
                return;
            }
            if (toolToExecute == null)
            {
                return;
            }
            progForm.Progress(String.Empty, 0, "==================");
            progForm.Progress(String.Empty, 0, String.Format("Executing Tool: {0}", toolToExecute.Name));
            progForm.Progress(String.Empty, 0, "==================");

            try
            {
                toolToExecute.Execute(progForm);
            }
            catch (Exception ex)
            {
                progForm.Progress(String.Empty, 100, "Failed to run. Errors:" + ex.Message);
            }
            finally
            {
                progForm.ExecutionComplete();
                progForm.Progress(String.Empty, 100, "==================");
                progForm.Progress(String.Empty, 100, String.Format("Done Executing Tool: {0}", toolToExecute.Name));
                progForm.Progress(String.Empty, 100, "==================");
            }
        }
コード例 #4
0
        private static void BwDoWork(object sender, DoWorkEventArgs e)
        {
            object[] threadParameter = e.Argument as object[];
            if (threadParameter == null)
            {
                return;
            }
            ITool        toolToExecute = threadParameter[0] as ITool;
            ToolProgress progForm      = threadParameter[1] as ToolProgress;

            if (progForm == null)
            {
                return;
            }
            if (toolToExecute == null)
            {
                return;
            }
            progForm.Progress(String.Empty, 0, "==================");
            progForm.Progress(String.Empty, 0, String.Format("Executing Tool: {0}", toolToExecute.Name));
            progForm.Progress(String.Empty, 0, "==================");
            bool result = false;

            try
            {
                result = toolToExecute.Execute(progForm);
            }
            catch (Exception ex)
            {
                progForm.Progress(String.Empty, 100, "Error: " + ex);
            }
            e.Result = result;
            progForm.ExecutionComplete();
            progForm.Progress(String.Empty, 100, "==================");
            progForm.Progress(String.Empty, 100, String.Format("Done Executing Tool: {0}", toolToExecute.Name));
            progForm.Progress(String.Empty, 100, "==================");
        }