private async void Delete_Click(object sender, RoutedEventArgs e) { string name = FilterListBox.SelectedItem as string; if (name == null) { return; // No selection. } if (await this.ShowQuestionAsync("Are you sure you want to delete this item filter?") == MessageBoxResult.No) { return; } try { FilterManager.Delete(name); FilterNames.Remove(name); } catch (Exception ex) { // Check whether deletion of filter definition failed, or only game filter file. if (!FilterManager.Exists(name)) { FilterNames.Remove(name); } await this.ShowErrorAsync("An error occurred while attempting to delete item filter.", ex.Message); } }