private void button1_Click(object sender, EventArgs e) { if (NameBox.Text.Length == 0) { MessageBox.Show("Please enter a string to search in the title of the window."); } else { WindowHider.HideWindows(NameBox.Text); } }
public static void HideWindows(string namepart) { Window[] windows = WindowHider.GetAllWindows(); foreach (Window w in windows) { if (w.Title.Contains(namepart)) { HideWindow(w); } } }