示例#1
0
 void ac_AssignmentCompleteStart(object sender, CompleteStartEventArgs e)
 {
     Log.Write(LogLevel.Normal, "COMPLETE: inizio consegna compito");
     string msg = string.Format("Consegna del compito:\n{0}", e.ProjectName);
     var cmd = MessageDialog.Show(msg, MessageInfoType.Warning, true);
     if (cmd != DialogResult.OK)
         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();
            }
        }