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 ReceiveKeyHook(Keys key) { if (key == Keys.Subtract && !ImageDraw.IsRunning) { ImageDraw.onDrawEnd += ImageDrawEnd; ImageDraw.StartDrawing(imageData, int.Parse(VJumpBox.Text), int.Parse(ThreadSleepBox.Text)); } if (key == Keys.Multiply && !this.Visible && ImageDraw.IsRunning) { ImageDraw.IsPaused = !ImageDraw.IsPaused; } if (key == Keys.Divide && !this.Visible) { this.Show(); ImageDraw.StopDrawing(); ImageDraw.onDrawEnd -= ImageDrawEnd; KeyHook.onKeyHooked -= ReceiveKeyHook; KeyHook.RemoveHookFromCurrentProcess(); } }
private void SelectedPresets_SelectedIndexChanged(object sender, EventArgs e) { int selectedIndex = SelectedPresets.SelectedIndex; if (selectedIndex < 0) { return; } if (selectedIndex == 0) { SelectedPresets.SelectedIndex = -1; KeyHook.onKeyHooked -= ReceiveKeyHook; KeyHook.RemoveHookFromCurrentProcess(); var stp = new SetupForm() { WindowState = FormWindowState.Maximized }; stp.FormClosed += frmC; stp.ShowDialog(); return; } selectedIndex--; if (Properties.Settings.Default.UserPresets == null) { return; } string data = Properties.Settings.Default.UserPresets[selectedIndex]; string[] args = data.Split(';'); SetSettingsAsPreset(args[1].Split(','), "CanvasStart"); SetSettingsAsPreset(args[2].Split(','), "PenLocation"); SetSettingsAsPreset(args[3].Split(','), "ColorLocation"); SetSettingsAsPreset(args[4].Split(','), "ColorR"); SetSettingsAsPreset(args[5].Split(','), "ColorG"); SetSettingsAsPreset(args[6].Split(','), "ColorB"); }