/// <summary> /// adds the currently selected process to the favorites (by window title text) /// </summary> private void byTheWindowTitleTextregexToolStripMenuItem_Click(object sender, EventArgs e) { if (this.lstProcesses.SelectedItem == null) return; ProcessDetails pd = ((ProcessDetails)this.lstProcesses.SelectedItem); if (!pd.Manageable) return; //TODO move to controller if (controller.Favorites.CanAdd(pd.WindowTitle)) { string res = Tools.Input_Text("Add to favorites by RegEx string", "Regex string (see the Help menu for reference)", pd.WindowTitle); if (res.Trim().Length > 0) { Favorites.Favorite fav = new Favorites.Favorite(); fav.Kind = Favorites.Favorite.FavoriteKinds.ByRegexString; fav.SearchText = res; controller.Favorites.Add(fav); } } }
/// <summary> /// adds the currently selected process to the favorites (by window title text) /// </summary> private void byTheWindowTitleTextregexToolStripMenuItem_Click(object sender, EventArgs e) { if (this.lstProcesses.SelectedItem == null) return; ProcessDetails pd = ((ProcessDetails)this.lstProcesses.SelectedItem); if (!pd.Manageable) return; //TODO move to controller if (controller.Favorites.CanAdd(pd.WindowTitle)) { InputText it = new InputText(); it.Text = "Add to favorites by regex string"; it.Input = pd.WindowTitle; it.Instructions = "Regex string (reference is in the Help menu)"; it.ShowDialog(); if (it.DialogResult != DialogResult.OK) return; Favorites.Favorite fav = new Favorites.Favorite(); fav.Kind = Favorites.Favorite.FavoriteKinds.ByRegexString; fav.SearchText = it.Input; controller.Favorites.Add(fav); } }
/// <summary> /// adds the currently selected process to the favorites (by process binary name) /// </summary> private void byTheProcessBinaryNameToolStripMenuItem_Click(object sender, EventArgs e) { if (this.lstProcesses.SelectedItem == null) return; ProcessDetails pd = ((ProcessDetails)this.lstProcesses.SelectedItem); if (!pd.Manageable) return; //TODO move to controller if (controller.Favorites.CanAdd(pd.BinaryName)) { Favorites.Favorite fav = new Favorites.Favorite(); fav.Kind = Favorites.Favorite.FavoriteKinds.ByBinaryName; fav.SearchText = pd.BinaryName; controller.Favorites.Add(fav); } }
/// <summary> /// adds the currently selected process to the favorites (by window title text) /// </summary> private void byTheWindowTitleTextToolStripMenuItem_Click(object sender, EventArgs e) { if (this.lstProcesses.SelectedItem == null) return; ProcessDetails pd = ((ProcessDetails)this.lstProcesses.SelectedItem); if (!pd.Manageable) return; if (Favorites.CanAdd(pd.WindowTitle)) { Favorites.Favorite fav = new Favorites.Favorite(); fav.Kind = Favorites.Favorite.FavoriteKinds.ByTitleText; fav.SearchText = pd.WindowTitle; Favorites.AddFavorite(fav); this.lstFavorites.DataSource = null; this.lstFavorites.DataSource = Favorites.List; } }