コード例 #1
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();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: terribad/Assignment
        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();
            }
        }