private void btnOption_Clicked(object sender, RoutedEventArgs e) { if (listIgnore.SelectedIndex >= 0 && listIgnore.SelectedIndex < db.recentlyIgnores.Count) { PauseIgnore ignore = db.recentlyIgnores[listIgnore.SelectedIndex]; IgnoreOption page = new IgnoreOption(ignore); bool? result = page.ShowDialog(); if (result == true) { CheckBox checkbox = (CheckBox)listIgnore.SelectedItem; checkbox.Content = ignore.title; } } }
private void btnAdd_Clicked(object sender, RoutedEventArgs e) { if (listRecently.SelectedIndex >= 0) { PauseIgnore ignore = db.recentlyIgnores[listRecently.SelectedIndex]; IgnoreOption page = new IgnoreOption(ignore); bool? result = page.ShowDialog(); if (result == true) { db.recentlyIgnores.RemoveAt(listRecently.SelectedIndex); listRecently.Items.RemoveAt(listRecently.SelectedIndex); ignore.enable = true; db.ignores.Add(ignore); CheckBox checkbox = new CheckBox() { Content = ignore.title, IsChecked = ignore.enable }; listIgnore.Items.Add(checkbox); } } }