예제 #1
0
        private FlowData ProcessFlow(IFlow flow)
        {
            var options   = new ProxyGenerationOptions(new FreezableProxyGenerationHook(flow));
            var flowProxy = _proxyGenerator.CreateClassProxyWithTarget(flow.GetType(), flow, options, new IInterceptor[] { this }) as IFlow;

            _flow = flow;

            try
            {
                // clear previous statuses
                _counter                = 0;
                _flowData.IsStopped     = false;
                _flowData.LastException = null;

                // run flow
                flowProxy.Execute();
                _flowData.IsFinished = true;
            }
            catch (FlowStopException e)
            {
                _flowData.IsStopped = true;
            }
            catch (Exception e)
            {
                _flowData.LastException = e;
            }

            return(_flowData);
        }
예제 #2
0
        // 通常は此処に戻る。
        internal void ProcessEnd(string resValue)
        {
            // 作業終了
            mainLog.Report(ConstantValues.EndAnalysis);

            var message = string.Empty;
            var logfile = WfComponent.Utils.FileUtils.GetUniqDateLogFile(ConstantValues.EndAnalysisLog);

            WfComponent.Utils.FileUtils.WriteFileFromString(logfile, LogMessage, ref message);
            if (!string.IsNullOrEmpty(message))
            {
                mainLog.Report("error report , file write error. " + message);
            }


            // 出力ディレクトリ先にも。
            if (Directory.Exists(userOutDir))
            {
                var outlog = Path.Combine(userOutDir,
                                          Path.GetFileName(logfile));
                WfComponent.Utils.FileUtils.WriteFileFromString(outlog, LogMessage, ref message);
            }
            if (!string.IsNullOrEmpty(message))
            {
                mainLog.Report("error report , file write error. " + message);
            }

            // 実行ボタンを戻す
            AnalysisButton = buttonAnalysis;

            // Results 再取得
            SetSampleResuts();
            this.SampleTabs.Clear(); // 一旦全てクリア

            // 終了ダイアログ。
            MessageBox.Show("Processing finished" + Environment.NewLine + resValue,
                            flow.GetType().ToString(),
                            MessageBoxButton.OK,
                            MessageBoxImage.Information);

            // ダイアログ出す前に削除されていたらException
            if (Directory.Exists(userOutDir))
            {
                System.Diagnostics.Process.Start(
                    new System.Diagnostics.ProcessStartInfo(userOutDir)
                {
                    UseShellExecute = true
                });
            }
        }