示例#1
0
        void ac_AssignmentCompleteAnticipateStart(object sender, CompleteAnticipateStartEventArgs e)
        {
            Log.Write(LogLevel.Normal, "COMPLETE: consegna anticipata");

            var msg = "Hai già finito?\nSe consegni adesso non potrai modificare il compito!" +
                      "\nClicca Annulla per annullare operazione";
            var cmd = MessageDialog.Show(msg, MessageInfoType.Warning, true);
            if (cmd == DialogResult.Cancel)
                e.Abort = true;
        }
示例#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();
            }
        }
示例#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();
            }
        }