Exemple #1
0
        void ac_AssignmentRequestCloseTarget(object sender, CompleteRequestCloseTargetEventArgs e)
        {
            Log.Write(LogLevel.Normal, "COMPLETE: consegna compito: richiesta chiusura applicazione");

            var msg = string.Format("[{0}] è ancora aperto.\nChiudilo prima di procedere!" +
                      "\nClicca Annulla per annullare operazione", e.TargetInfo.Description);
            var cmd = MessageDialog.Show(msg, MessageInfoType.Warning, true);
            if (cmd == DialogResult.Cancel)
                e.Abort = true;
        }
        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();
            }
        }
Exemple #3
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();
            }
        }