예제 #1
0
        private void toolStripButton_job_add_Click(object sender, EventArgs e)
        {
            try
            {
                Application.Job newJob = new Application.Job();
                newJob.Enabled   = true;
                newJob.ZPosition = Application.Job.WindowZPosition.NoTopMost;
                newJob.NoSize    = false;
                newJob.NoMove    = false;
                newJob.NoZOrder  = true;

                Forms.editJob ejd = new Forms.editJob(Properties.Strings.editJob_title_new, newJob);

                if (ejd.ShowDialog(this) == DialogResult.OK)
                {
                    this.jobsFile.Add(ejd.GetJob());
                    this.refreshJobsDisplay();
                }
            }
            catch (Exception ex) { Forms.MessageBox.Error(ex.Message); }
        }
예제 #2
0
        static void Main(string[] args)
        {
#if (DEBUG)
            // testing the parseing of default values
            try { Application.Job testJob = new Application.Job(); }
            catch { throw new Exception("TEST - Job constructor - FAILED"); }
#endif

            Middleware.AppFiles.Directory.CreateInexistents();
            Middleware.AppFiles.File.CreateInexistents();

            Application.Settings        settings = Application.Settings.Get();
            Application.Settings.OpMode opMode   = Application.Settings.OpMode.gui;

            try
            {
                if (args.Length == 0)
                {
                    opMode = settings.General_DefaultOpMode;
                }
                else if (args.Length == 1)
                {
                    opMode = Middleware.Util.Misc.ParseEnum <Application.Settings.OpMode>(args[0], true);
                }
                else
                {
                    throw new Exception();
                }
            }
            catch
            {
                Forms.MessageBox.Error(Properties.Strings.cliArg_error_invalidArg);
                opMode = Application.Settings.OpMode.gui;
            }

            switch (opMode)
            {
            case Application.Settings.OpMode.run:

                try
                {
                    var tmpSettings = Application.Settings.Get();

                    Application.JobsFile tmpJF = new Application.JobsFile(tmpSettings.General_JobsFile);

                    Application.Job.Run(
                        tmpJF.Get(opMode, tmpSettings.General_OpModeRunErrorReporting),
                        opMode,
                        tmpSettings.General_OpModeRunErrorReporting);
                }
                catch (Exception ex)
                {
                    Forms.MessageBox.Error(Properties.Strings.gFatalError + "\n" + ex.Message);
                }

                break;

            case Application.Settings.OpMode.gui:
            default:
                Forms.MessageBox.SetTitles(Properties.Strings.gError, String.Empty, Properties.Strings.gWarning);
                System.Windows.Forms.Application.EnableVisualStyles();
                System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
                System.Windows.Forms.Application.Run(new mainForm());
                break;
            }
        }
예제 #3
0
 public JobListItem(Application.Job job)
 {
     this.ID          = job.ID;
     this.DisplayText = job.ToString();
 }