예제 #1
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            if (simulateEnabled.Checked)
            {
                if (toolStripSimModeKeyPress.Checked)
                {
                    IntPtr currentWindowSaved = GetForegroundWindow();

                    //this.Focus();
                    KeyboardSend.KeyPress(Keys.F24);

                    SetForegroundWindow(currentWindowSaved);
                }
                else
                {
                    PowerMonitorControl.KeepSystemAwake();
                }

                if (timeoutEnabled.Checked)
                {
                    if (DateTime.Now.Subtract(startedTime).TotalMinutes > (double)minutesRemaining.Value)
                    {
                        disabled.Checked = true;
                    }
                }
            }
        }
예제 #2
0
        private void simulateEnabled_CheckedChanged(object sender, EventArgs e)
        {
            if (simulateEnabled.Checked)
            {
                startedTime       = DateTime.Now;
                pictureBox1.Image = animationImage;
                notifyIcon1.Icon  = new Icon(Path.Combine(Application.StartupPath, "mario_star_icon.ico"));

                if (toolStripSimModeVideo.Checked)
                {
                    PowerMonitorControl.KeepSystemAwake();
                }
            }
            else
            {
                //pictureBox1.Image.SelectActiveFrame(new FrameDimension(pictureBox1.Image.FrameDimensionsList[0]), 0);
                stillImage        = pictureBox1.Image.GetThumbnailImage(animationImage.Width, animationImage.Height, null, IntPtr.Zero);
                pictureBox1.Image = stillImage;
                notifyIcon1.Icon  = new Icon(Path.Combine(Application.StartupPath, "mushroom_icon.ico"));

                //if (!simulatorModeKeyboardPress)
                {
                    PowerMonitorControl.AllowSystemSleep();
                }
            }

            toolStripEnable.Checked  = simulateEnabled.Checked;
            toolStripDisable.Checked = !simulateEnabled.Checked;
        }