private void FormMain_FormClosed(object sender, FormClosedEventArgs e)
        {
            _tScreenshot.Stop();

            JcUtility.UnregisterHotKey(this.Handle, 101);
            JcUtility.UnregisterHotKey(this.Handle, 102);
        }
 private void tsbUninstall_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to uninstall this program?", "Uninstall Confirm", MessageBoxButtons.OKCancel) == DialogResult.OK)
     {
         Process.Start(Path.Combine(JcUtility.GetAppDir(), "uninst.exe"));
         Close();
     }
 }
 private void _tScreenshot_Tick(object sender, EventArgs e)
 {
     try
     {
         JcUtility.Screenshot();
     }
     catch (Exception ex)
     {
         JcUtility.Log("_tScreenshot_Tick Exeption:");
         JcUtility.LogException(ex);
     }
 }
        private void FormMain_Load(object sender, EventArgs e)
        {
            IntPtr hMutex;

            hMutex = JcUtility.CreateMutex(null, false, "JcScreenCapture");
            if (JcUtility.GetLastError() == JcUtility.ERROR_ALREADY_EXISTS)
            {
                Environment.Exit(0);
            }

            if (_config.AutoHide)
            {
                this.BeginInvoke(new MethodInvoker(delegate() {
                    this.Hide();
                    this.Opacity = 1;
                }));
            }
            else
            {
                this.Opacity = 1;
            }

            JcUtility.RegisterHotKey(this.Handle, 101, JcUtility.KeyModifiers.Ctrl | JcUtility.KeyModifiers.Shift, Keys.J);
            JcUtility.RegisterHotKey(this.Handle, 102, JcUtility.KeyModifiers.Ctrl | JcUtility.KeyModifiers.Alt, Keys.J);

            try
            {
                JcUtility.Screenshot();
            }
            catch (Exception ex)
            {
                JcUtility.Log("Screenshot Exeption:");
                JcUtility.LogException(ex);
            }

            _tScreenshot.Start();

            cbAutoRun.Checked          = _config.AutoRun;
            cbAutoHide.Checked         = _config.AutoHide;
            cbAutoRun.CheckedChanged  += new EventHandler(cbAutoRun_CheckedChanged);
            cbAutoHide.CheckedChanged += new EventHandler(cbAutoHide_CheckedChanged);

            JcUtility.ClearLogs();
            JcUtility.ClearScreenshots();
        }
 private void cbAutoRun_CheckedChanged(object sender, EventArgs e)
 {
     JcUtility.SetAutoRun(cbAutoRun.Checked);
     _config.AutoRun = cbAutoRun.Checked;
 }
 private void tsbShowScreenshot_Click(object sender, EventArgs e)
 {
     JcUtility.OpenExplorer(JcUtility.GetScreenshotDir());
 }