Example #1
0
        private void btn_savaSchedule_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.BreakTime = int.Parse(cb_restTime.Text.ToString());
            Properties.Settings.Default.Interval = int.Parse(cb_interval.Text);
            Properties.Settings.Default.Save();

            TaskManager Resettask = new TaskManager();
            if (Properties.Settings.Default.AutoStart)
                Resettask.AutoRun();
            else
                Resettask.ScheduleRun();
        }
        private void cb_autoStart_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if ((int)System.DateTime.Now
                .Subtract(Properties.Settings.Default.FirstRunTime)
                .TotalDays < 21)
                cb_autoStart.Checked = true;
            else
            {
                if (Properties.Settings.Default.AutoStart)
                    Properties.Settings.Default.AutoStart = false;
                else
                    Properties.Settings.Default.AutoStart = true;

                Properties.Settings.Default.Save();
                TaskManager tm_AutoStart = new TaskManager();
                tm_AutoStart.AutoRun();
            }
        }
Example #3
0
 public CommandLineTask()
 {
     string[] Arguments = Environment.GetCommandLineArgs();
     if (Arguments.Length > 1)
     {
         switch (Arguments[1])
         {
             case "-TaskManager":
                 {
                     TaskManager TM = new TaskManager();
                     if (Arguments.Length > 1)
                     {
                         switch (Arguments[2])
                         {
                             case "-DeleteScheduleTask":
                                 TM.DeleteScheduleTask();
                                 System.Windows.Forms.Application.Exit();
                                 break;
                             case "-DeleteLogonTask":
                                 TM.DeleteLogonTask();
                                 System.Windows.Forms.Application.Exit();
                                 break;
                             case "-AutoStart":
                                 {
                                     if (Properties.Settings.Default.AutoStart)
                                         TM.AutoRun();
                                     else
                                         TM.DeleteLogonTask();
                                     System.Windows.Forms.Application.Exit();
                                 }
                                 break;
                         }
                     }
                 }
                 break;
             case "-Uninstall":
                 uc_uninstall.Uninstall();
                 break;
         }
     }
 }
Example #4
0
        private void frm_main_Load(object sender, EventArgs e)
        {
            #region Debug Mode
            if (Environment.GetCommandLineArgs()[0].IndexOf(".vshost.")>0)
            {
                uc_timer.ShouldPauseTopMost = true;
                TopMost = false;
            }
            #endregion

            CommandLineTask CLTask = new CommandLineTask();
            TaskManager StartupTask = new TaskManager();
            if (Properties.Settings.Default.FisrtRun)
            {
                if (StartupTask.AutoRun())
                {
                    firstRun = true;
                    Properties.Settings.Default.FisrtRun = false;
                    Properties.Settings.Default.FirstRunTime = DateTime.Now;
                    Properties.Settings.Default.Save();
                    uc_settings firstSet = new uc_settings();
                    firstSet.Location = new Point(0, 0);
                    firstSet.Size = Size;
                    Controls.Add(firstSet);
                }
            }
            else
            {
                StartupTask.ScheduleRun();
                uc_timer mainTimer = new uc_timer();
                mainTimer.Location = new Point(0, 0);
                mainTimer.Size = Size;
                Controls.Add(mainTimer);
            }

            if (Properties.Settings.Default.EnergySaving == 1)
                SystemOperation.TurnOffScreen();
            else if (Properties.Settings.Default.EnergySaving == 2)
                SystemOperation.CallSuspend(null);
        }