/// <summary> /// Removes hotkey and binded command /// </summary> private void HandleKeyBindRemove() { // it was checked if anything is selected // and we know for sure only one item can be selected int globalHotkeyId = Int32.Parse(this.listView1.SelectedItems[0].SubItems[2].Text); GlobalHotkey ghToRemove = null; // we are looking for the gh to delete foreach (GlobalHotkey gh in this.ghList) { if (gh.Id.Equals(globalHotkeyId)) { ghToRemove = gh; } } // then we find it's index in a List, remove it and call Dispose() to unregister int i = 0; while (i < this.ghList.Count) { GlobalHotkey currentGh = this.ghList[i]; if (ghToRemove.Equals(currentGh)) { this.ghList.RemoveAt(i); ghToRemove.Dispose(); break; } i++; } this.listView1.SelectedItems[0].Remove(); }
private void window_Closed(object sender, EventArgs e) { clipboardItems.WriteToFile(); StoreFormParams(); Settings.SaveSettings(); showHotKey.Dispose(); showHotKey = null; notifyIcon.Dispose(); notifyIcon = null; }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); Hide(); _mouseHook?.Dispose(); _overviewHotkey?.Dispose(); _dropShadow?.Hide(); _wmr?.Dispose(); _quickInfoWindow?.Close(); Environment.Exit(0); }
void TagForm_FormClosing(object sender, FormClosingEventArgs e) { ghk_apply.Dispose(); ghk_select.Dispose(); ghk_select_common.Dispose(); ghk_untag.Dispose(); ghk_addtag.Dispose(); ghk_renametag.Dispose(); ghk_deletetag.Dispose(); ghk_addToSelection_toggle.Dispose(); ghk_ChildAuto_toggle.Dispose(); }
/* * Unregisters the hotkeys that have been registed by this group */ public void unregisterHotkeys() { if (!hasHotkey) { return; } try { hotkeyVolUp.Dispose(); hotkeyVolDown.Dispose(); hasHotkey = false; } catch (GlobalHotkeyException exc) { MessageBox.Show(exc.Message); } Console.WriteLine(groupName + " HotkeysUNRegistered"); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { //----------------------------------------АПДЕЙТЕР if (System.IO.File.Exists(Application.StartupPath + "/ClanChat.exe.bak")) { string app_name = Application.StartupPath + "\\" + Application.ProductName + ".exe"; string bat_name = app_name + ".bat"; string bat = "@echo off\n" + ":loop\n" + "del ClanChat.exe\n" + "if Exist ClanChat.exe GOTO loop\n" //+ "TIMEOUT 2\n" + "ren ClanChat.exe.bak ClanChat.exe\n" //+ "TIMEOUT 1\n" + "start ClanChat.exe\n" //+ "TIMEOUT 3\n" + "del ClanChat.exe.bat\n"; StreamWriter file = new StreamWriter(bat_name); file.Write(bat); file.Close(); Process bat_call = new Process(); bat_call.StartInfo.FileName = bat_name; bat_call.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; bat_call.StartInfo.UseShellExecute = true; bat_call.Start(); } //----------------------------------------АПДЕЙТЕР timer1.Enabled = false; //Выгружаем первый таймер timer2.Enabled = false; //Выгружаем второй таймер //----------------------------------------ТАЙМЕР ПРОВЕРКИ ОНЛАЙНА label4.Text = "Онлайн: " + webpage.DownloadString(UrlDev + "/index.php?action=take"); timer3.Enabled = false; //----------------------------------------ТАЙМЕР ПРОВЕРКИ ОНЛАЙНА ghk.Dispose(); //Выгружаем hotkey хук }
void Form1Closing(object sender, CancelEventArgs e) { ghk.Dispose(); }