Beispiel #1
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);
        }
 public void btn_switcher_Click(object sender, System.EventArgs e)
 {
     try
     {
         frm_main.SwitchPage((UserControl)Parent, (UserControl)ParentForm.Controls.Find(ToPageName, false)[0], TowardsLeft);
     }
     catch (Exception)
     {
         UserControl NewPage;
         switch (ToPageName)
         {
             case "uc_exit":
                 NewPage = new uc_exit();
                 break;
             case "uc_settings":
                 NewPage = new uc_settings();
                 break;
             case "uc_uninstall":
                 NewPage = new uc_uninstall();
                 break;
             default:
                 NewPage = new uc_timer();
                 break;
         }
         frm_main.SwitchPage((UserControl)this.Parent, NewPage, TowardsLeft);
     }
 }