public void RefreshAddons() { InstalledAddonsGrid.Items.Clear(); foreach (var addon in Settings.Instance.InstalledAddons) { var item = new InstalledAddonDataGridItem(addon); InstalledAddonsGrid.Items.Add(item); } }
private void MenuRemoveSelected_Click(object sender, RoutedEventArgs e) { var selectedItems = new InstalledAddonDataGridItem[Grid.SelectedItems.Count]; Grid.SelectedItems.CopyTo(selectedItems, 0); foreach (InstalledAddonDataGridItem item in selectedItems) { Settings.Instance.InstalledAddons.UninstallAddon(item.Addon); } }
private void DeleteAddonsButton_Click(object sender, RoutedEventArgs e) { var selectedItems = new InstalledAddonDataGridItem[Grid.SelectedItems.Count]; Grid.SelectedItems.CopyTo(selectedItems, 0); foreach (var item in selectedItems) { var addon = item.Addon; Settings.Instance.InstalledAddons.UninstallAddon(addon); Items.Remove(item); } }
public void AddLastAddon() { Dispatcher.Invoke(() => { var addon = Settings.Instance.InstalledAddons.LastOrDefault(); if (addon == null) { return; } var item = new InstalledAddonDataGridItem(addon); InstalledAddonsGrid.Items.Add(item); }); }