Ejemplo n.º 1
0
 void CommonHookMethod()
 {
     if (ConServ.IsMonOff == true)
     {
         keyboardHook.Stop();
         mouseHook.Stop();
         ConServ.WakingUp();
         LogTextBox.Text = ConServ.LogText;
     }
     if (IsHookAfter == true)
     {
         AfterTimer.Stop();
         HookIdleAfterTimeTick = 0;
         AfterTimer.Start();
     }
     if (IsHookAt == true)
     {
         AtTimer.Stop();
         HookIdleAtTimeTick = 0;
         AtTimer.Start();
     }
 }
Ejemplo n.º 2
0
        private void SettingsTile_Click(object sender, EventArgs e)
        {
            if (metroTabControl1.SelectedTab == EasyStyleTabPage) //탭페이지 처음 (Easy Style) 일때의 셋팅 조건
            {
            }

            if (metroTabControl1.SelectedTab == SchedulerTabPage) //스케쥴 탭페이지 셋팅
            {
                //After 체크되었을때
                if (AfterTimeCheckBox.Checked == true)
                {
                    if (AfterExcuteTypeStandardRadioButton.Checked == true) //Standard 라디오 선택시 후킹 시작
                    {
                        IsHookAfter = true;
                        mouseHook.Start();
                        keyboardHook.Start();
                    }
                    else if (AfterExcuteTypeForceRadioButton.Checked == true) //Force 라디오 선택시 후킹 시작 없음
                    {
                        IsHookAfter = false;
                    }
                    //선택한 절전 조건을 TypeOf 변수에 저장
                    if (AfterSaveTypeMonitorOffRadioButton.Checked)
                    {
                        SpinnerAfterSaveTypeLabel.Text = AfterSaveTypeMonitorOffRadioButton.Text;
                        AfterTypeOf = 1;
                    }
                    else if (AfterSaveTypeSuspendRadioButton.Checked)
                    {
                        SpinnerAfterSaveTypeLabel.Text = AfterSaveTypeSuspendRadioButton.Text;
                        AfterTypeOf = 2;
                    }
                    else if (AfterSaveTypeHibernateRadioButton.Checked)
                    {
                        SpinnerAfterSaveTypeLabel.Text = AfterSaveTypeHibernateRadioButton.Text;
                        AfterTypeOf = 3;
                    }
                    else if (AfterSaveTypeShutdownRadioButton.Checked)
                    {
                        SpinnerAfterSaveTypeLabel.Text = AfterSaveTypeShutdownRadioButton.Text;
                        AfterTypeOf = 4;
                    }
                    AfterTime = Convert.ToInt32(AfterTimeComboBox.SelectedItem); //얼마뒤에 종료할 것인지 시간을 저장
                    AfterSpinnerAct();
                    AfterTimer.Start();
                }
                else if (AfterTimeCheckBox.Checked == false) //After에 체크가 풀린 상태로 셋팅하면
                {
                    if (AtTimeCheckBox.Checked == false)     //At도 체크가 풀려있으면 후킹 해제
                    {
                        mouseHook.Stop();
                        keyboardHook.Stop();
                    }
                    IsHookAfter = false;
                    AfterSpinnerDeact();
                    AfterTimer.Stop();
                }

                //At시작 After와 반대입니다.
                if (AtTimeCheckBox.Checked == true)
                {
                    if (AtExcuteTypeStandardRadioButton.Checked == true) //if keyboard or mouse, nothing
                    {
                        IsHookAt = true;
                        mouseHook.Start();
                        keyboardHook.Start();
                    }
                    else if (AtExcuteTypeForceRadioButton.Checked == true) //force shut down
                    {
                        IsHookAt = false;
                    }

                    if (AtSaveTypeMonitorOffRadioButton.Checked)
                    {
                        SpinnerAtSaveTypeLabel.Text = AtSaveTypeMonitorOffRadioButton.Text;
                        AtTypeOf = 1;
                    }
                    else if (AtSaveTypeSuspendRadioButton.Checked)
                    {
                        SpinnerAtSaveTypeLabel.Text = AtSaveTypeSuspendRadioButton.Text;
                        AtTypeOf = 2;
                    }
                    else if (AtSaveTypeHibernateRadioButton.Checked)
                    {
                        SpinnerAtSaveTypeLabel.Text = AtSaveTypeHibernateRadioButton.Text;
                        AtTypeOf = 3;
                    }
                    else if (AtSaveTypeShutdownRadioButton.Checked)
                    {
                        SpinnerAtSaveTypeLabel.Text = AtSaveTypeShutdownRadioButton.Text;
                        AtTypeOf = 4;
                    }
                    AtTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(AtTimeHourComboBox.SelectedItem.ToString()), Convert.ToInt32(AtTimeMinuteComboBox.SelectedItem.ToString()), 0); //예약된 시간은 DateTime 객체를 이용하여 시간과 분을 설정
                    if ((AtTime - DateTime.Now) < TimeSpan.Zero)
                    {
                        AtTime.AddDays(1);
                    }

                    AtSpinnerAct();
                    AtTimer.Start();
                }
                else if (AtTimeCheckBox.Checked == false)
                {
                    if (AfterTimeCheckBox.Checked == false)
                    {
                        mouseHook.Stop();
                        keyboardHook.Stop();
                    }
                    IsHookAt = false;
                    AtSpinnerDeact();
                    AtTimer.Stop();
                }
            }
        }