private void ImageDrawEnd(bool Success) { Invoke(new Action(() => { this.Show(); if (Success) { WindowTray.ShowBalloonTip(2000, "Draw ended", "Success !", ToolTipIcon.Info); } else { WindowTray.ShowBalloonTip(2000, "Draw ended", "Interrupted !", ToolTipIcon.Warning); } })); ImageDraw.onDrawEnd -= ImageDrawEnd; KeyHook.onKeyHooked -= ReceiveKeyHook; KeyHook.RemoveHookFromCurrentProcess(); }
private void StartButton_Click(object sender, EventArgs e) { this.Hide(); WindowTray.Visible = true; var rd = new ReadingForm(); rd.TargetImage = new Bitmap(TargetImageBox.Image, int.Parse(WidthBox.Text), int.Parse(HeightBox.Text)); rd.NoWhite = IgnoreWhiteBox.Checked; rd.JumpV = int.Parse(VJumpBox.Text); rd.JumpH = int.Parse(HJumpBox.Text); rd.ColorDiff = int.Parse(ColorDiffBox.Text); if (rd.ShowDialog() == DialogResult.OK) { imageData = rd.ImageData; WindowTray.ShowBalloonTip(5000, "Readed !", "SUBTRACT: Start\nMULTIPLY: Pause\nDIVIDE: Stop", ToolTipIcon.Info); KeyHook.AddHookToCurrentProcess(); KeyHook.onKeyHooked += ReceiveKeyHook; } else { this.Show(); } }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { WindowTray.Visible = false; WindowTray.Dispose(); }