Exemplo n.º 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();
            }
        }
Exemplo n.º 2
0
 static void am_AssignmentRequestProjectName(object sender, ProjectNameRequestEventArgs e)
 {
     e.SelectedProjectName = e.ProjectNames[0];
     e.NameAs = "Rossi";
     return;
     Console.Write("Nome: ");
     string name = Console.ReadLine();
     if (name == "")
     {
         e.Abort = true;
         return;
     }
     e.NameAs = name;
 }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
 void am_AssignmentRequestProjectName(object sender, ProjectNameRequestEventArgs e)
 {
     Log.Write(LogLevel.Normal, "START: richiesto nome progetto");
     if (Global.IsDevelopAccount)
     {
         e.SelectedProjectName = e.ProjectNames[0];
         e.NameAs = "Rossi";
         return;
     }
     var d = SetAssignmentDialog.Create(e);
     var cmd = d.ShowDialog();
     if (cmd == DialogResult.OK)
     {
         e.SelectedProjectName = d.SelectedProjectName;
         e.NameAs = d.ProjectNameAs;
     }
     else
     {
         e.Abort = true;
     }
     d.Dispose();
 }
Exemplo n.º 5
0
 public static SetAssignmentDialog Create(ProjectNameRequestEventArgs e)
 {
     var d = new SetAssignmentDialog();
     d.ProjectNames = e.ProjectNames;
     return d;
 }