Beispiel #1
0
        public void Execute()
        {
            try
            {
                #if DEBUG  //evita warning su consegna anticipata
                Global.Time = new FakeTimeProvider(Global.RecentSpanTimeForStart + 5);
                #endif
                var projectNames = fileManager.GetProjectNames();
                if (projectNames.Length == 0)
                {
                    AssignmentStartError.Fire(this, AssignmentErrorEventArgs.New(AssignmentErrorType.ProjectTargetNoFound));
                    return;
                }

                if (IsDoubleStart())
                {
                    var e = new CheckDoubleStartEventArgs();
                    AssignmentCheckDoubleStart.Fire(this, e);
                    if (e.Abort)
                    {
                        return;
                    }
                }

                var ea = new ProjectNameRequestEventArgs()
                {
                    ProjectNames = projectNames, SelectedProjectName = projectNames[0]
                };
                AssignmentRequestProjectName.Fire(this, ea);
                if (ea.Abort)
                {
                    AssignmentStartAborted.Fire(this);
                    return;
                }

                ProcessManager.CloseOpenWindows(AssignmentManager.SkipProcessToClose, forceClose: true);
                Log.Write(LogLevel.Verbose, "START: chiuse finestre");

                _Execute(ea.SelectedProjectName, ea.NameAs);

                AssignmentStartCompleted.Fire(this);
            }
            catch (Exception e)
            {
                AssignmentStartError.Fire(this, AssignmentErrorEventArgs.New(AssignmentErrorType.UnknowError, e));
            }
            finally
            {
                Global.Time = new DefaultTimeProvider();
                Log.Close();
            }
        }
Beispiel #2
0
        public void Execute()
        {
            try
            {
                #if DEBUG  //evita warning su consegna anticipata
                Global.Time = new FakeTimeProvider(Global.RecentSpanTimeForComplete + 5);
                #endif

                if (!fileManager.TargetExists(config.ProjectFullName))
                {
                    AssignmentCompleteError.Fire(this, AssignmentErrorEventArgs.New(AssignmentErrorType.ProjectTargetNoFound));
                    return;
                }

                if (IsAnticipateComplete())
                {
                    var e = new CompleteAnticipateStartEventArgs();
                    AssignmentCompleteAnticipateStart.Fire(this, e);
                    if (e.Abort)
                    {
                        return;
                    }
                }

                if (ProcessManager.IsExecuting(config.ProjectTarget.Target))
                {
                    var e = new CompleteRequestCloseTargetEventArgs()
                    {
                        TargetInfo = config.ProjectTarget
                    };
                    AssignmentRequestCloseTarget.Fire(this, e);
                    if (e.Abort)
                    {
                        return;
                    }
                }
                else
                {
                    var e = new CompleteStartEventArgs {
                        ProjectName = config.ProjectName
                    };
                    AssignmentCompleteStart.Fire(this, e);
                    if (e.Abort)
                    {
                        AssignmentCompleteAborted.Fire(this);
                        return;
                    }
                }

                CloseOpenWindows();

                _Execute();
                AssignmentCompleteCompleted.Fire(this);
            }
            catch (Exception e)
            {
                AssignmentCompleteError.Fire(this, AssignmentErrorEventArgs.New(AssignmentErrorType.UnknowError, e));
            }
            finally
            {
                Global.Time = new DefaultTimeProvider();
            }
        }