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.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 #3
0
        void ast_AssignmentCheckDoubleStart(object sender, CheckDoubleStartEventArgs e)
        {
            Log.Write(LogLevel.Normal, "START: doppio avvio inizio compito");

            var msg = "Il compito è già cominciato\nSei sicuro di voler ricominciare?" +
                      "\n(Quanto già fatto sarà eliminato!)" +
                      "\nClicca Annulla per annullare operazione";
            var cmd = MessageDialog.Show(msg, MessageInfoType.Warning, true);
            if (cmd == DialogResult.Cancel)
                e.Abort = true;
        }