private void PART_EditName_Click(object sender, RoutedEventArgs e) { int index = int.Parse(((Button)sender).Tag.ToString()); List <GameFeature> features = _PlayniteApi.Database.Features.ToList(); LibraryManagementItemEditor ViewExtension = new LibraryManagementItemEditor( features, ItemType.Feature, null, (((List <ItemFeature>)PART_ListItemFeatures.ItemsSource)[index]).NameAssociated, string.Empty, null ); ViewExtension.OnlySimple(); Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(_PlayniteApi, resources.GetString("LOCLmNameAssociated"), ViewExtension); windowExtension.ShowDialog(); if (ViewExtension.NewItem != null && ViewExtension.NewItem is LmEquivalences) { List <ItemFeature> itemFeatures = ((List <ItemFeature>)PART_ListItemFeatures.ItemsSource); itemFeatures[index].NameAssociated = ((LmEquivalences)ViewExtension.NewItem).Name; PART_ListItemFeatures.ItemsSource = null; PART_ListItemFeatures.ItemsSource = itemFeatures; } }
private void AddElement <TItemList>(ListView CtrlListView, ItemType itemType, object ListData, bool IsExclusion) { LibraryManagementItemEditor ViewExtension = new LibraryManagementItemEditor(ListData, itemType); if (IsExclusion) { ViewExtension.OnlySimple(); } string TitleWindows = string.Empty; switch (itemType) { case ItemType.Genre: TitleWindows = resources.GetString("LOCLmGenreAdd"); break; case ItemType.Tag: TitleWindows = resources.GetString("LOCLmTagAdd"); break; case ItemType.Feature: TitleWindows = resources.GetString("LOCLmFeatureAdd"); break; case ItemType.Company: TitleWindows = resources.GetString("LOCLmCompanyAdd"); break; } Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(_PlayniteApi, TitleWindows, ViewExtension); windowExtension.ShowDialog(); if (ViewExtension.NewItem != null && ViewExtension.NewItem is LmEquivalences) { List <TItemList> temp = (List <TItemList>)CtrlListView.ItemsSource; if (temp == null) { temp = new List <TItemList>(); } if (IsExclusion) { temp.Add(((dynamic)ViewExtension.NewItem).Name); } else { temp.Add((TItemList)ViewExtension.NewItem); } CtrlListView.ItemsSource = null; CtrlListView.ItemsSource = temp; } }
private void ManageElement <TItemList>(ListView CtrlListView, int Index, List <string> ListAlreadyAdded, ItemType itemType, object ListData, LmEquivalences Data, bool IsExclusion) { LibraryManagementItemEditor ViewExtension = null; if (IsExclusion) { ViewExtension = new LibraryManagementItemEditor( ListData, itemType, null, Data.Name, string.Empty, null ); ViewExtension.OnlySimple(); } else { ViewExtension = new LibraryManagementItemEditor( ListData, itemType, Data.Id, Data.Name, Data.IconUnicode, ListAlreadyAdded ); } string TitleWindows = string.Empty; switch (itemType) { case ItemType.Genre: TitleWindows = resources.GetString("LOCLmGenreEdit"); break; case ItemType.Tag: TitleWindows = resources.GetString("LOCLmTagEdit"); break; case ItemType.Feature: TitleWindows = resources.GetString("LOCLmFeatureEdit"); break; case ItemType.Company: TitleWindows = resources.GetString("LOCLmCompanyEdit"); break; } Window windowExtension = PlayniteUiHelper.CreateExtensionWindow(_PlayniteApi, TitleWindows, ViewExtension); windowExtension.ShowDialog(); if (ViewExtension.NewItem != null && ViewExtension.NewItem is LmEquivalences) { List <TItemList> temp = (List <TItemList>)CtrlListView.ItemsSource; if (IsExclusion) { temp[Index] = ((dynamic)ViewExtension.NewItem).Name; } else { temp[Index] = (TItemList)ViewExtension.NewItem; } CtrlListView.ItemsSource = null; CtrlListView.ItemsSource = temp; } }