Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            //foreach (var p in ProcessManager.GetOpenWindows())
            //{
            //    var title = p.MainWindowTitle.Length > 20 ? p.MainWindowTitle.Substring(0, 20) : p.MainWindowTitle;
            //    Console.WriteLine("{0, -25} {1} ", p.ProcessName, title);
            //}

            ////ProcessManager.CloseExplorer();

            //return;
            if (ProcessManager.IsRunning())
                return;

            if (!Global.IsAssignmentAccount)
                return;

            VirtualPath.SetDefaultTemplates();

            Config config = new Config(@"Config.ini");
            if (config.AssignmentMode == AssignmentMode.Start)
            {
                var ast = new AssignmentStart(config);
                ast.AssignmentRequestProjectName += am_AssignmentRequestProjectName;
                ast.AssignmentStartError += am_AssignmentStartError;
                ast.AssignmentStartCompleted += am_AssignmentStartCompleted;
                ast.AssignmentStartAborted += am_AssignmentStartAborted;
                ast.Execute();
            }
            else
            {
                var ac = new AssignmentComplete(config);
                ac.AssignmentCompleteError += ac_AssignmentCompleteError;
                ac.AssignmentCompleteCompleted += ac_AssignmentCompleteCompleted;
                ac.Execute();
            }
        }
Ejemplo n.º 2
0
 public static AssignmentStart CreateStart(Config config = null)
 {
     if (config == null)
         config = new Config();
     return new AssignmentStart(config);
 }
Ejemplo n.º 3
0
 public FileTaskManager(Config config)
 {
     this.config = config;
 }
Ejemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            if (ProcessManager.IsRunning() || !Global.IsAssignmentAccount)
            {
                Close();
                return;
            }

            ParseCommandArguments();
            bool deletePre = Global.IsDevelopAccount ? true : false;
            Log.Open(new DefaultTextLog(logLevel, deletePre:deletePre));

            VirtualPath.SetDefaultTemplates();
            Config config = null;
            try
            {
                config = new Config(@"Config.ini");
                //config = new Config(@"ConfigComplete.ini");
            }
            catch(Exception ex)
            {
                MessageDialog.Show("Errore nella produre di inizio!\n[" + ex.Message + "]\nChiama il professore!", MessageInfoType.Error);
                Log.Write(LogLevel.Error, "Lettura file di configurazione:\n({0})", ex.Message);
                Close();
                return;
            }

            if (config.AssignmentMode == AssignmentMode.Start)
            {
                var ast = new AssignmentStart(config);
                ast.AssignmentCheckDoubleStart += ast_AssignmentCheckDoubleStart;
                ast.AssignmentRequestProjectName += am_AssignmentRequestProjectName;
                ast.AssignmentStartError += am_AssignmentStartError;
                ast.AssignmentStartCompleted += am_AssignmentStartCompleted;
                ast.AssignmentStartAborted += am_AssignmentStartAborted;
                ast.Execute();
            }
            else
            {
                var ac = new AssignmentComplete(config);
                ac.AssignmentCompleteStart += ac_AssignmentCompleteStart;
                ac.AssignmentCompleteAnticipateStart += ac_AssignmentCompleteAnticipateStart;
                ac.AssignmentRequestCloseTarget += ac_AssignmentRequestCloseTarget;
                ac.AssignmentCompleteAborted += ac_AssignmentCompleteAborted;
                ac.AssignmentCompleteError += ac_AssignmentCompleteError;
                ac.AssignmentCompleteCompleted += ac_AssignmentCompleteCompleted;
                ac.Execute();
            }
            Close();
        }
Ejemplo n.º 5
0
 public AssignmentStart(Config config)
 {
     this.fileManager = new FileTaskManager(config);
     this.config = config;
 }
Ejemplo n.º 6
0
 public AssignmentComplete(Config config)
 {
     this.fileManager = new FileTaskManager(config);
     this.config = config;
 }