public DragDropData(DeckEditorListContext listContext) { this.ListContext = listContext; }
void MoveListElement(DeckEditorListContext contextFrom, DeckEditorListContext contextTo, int index) { List<CardItem> cards = new List<CardItem>(); CardListView listViewFrom = null; switch(contextFrom) { case DeckEditorListContext.Main: listViewFrom = listMain; break; case DeckEditorListContext.Sideboard: listViewFrom = listSideboard; break; case DeckEditorListContext.Archive: listViewFrom = listArchive; break; } if(listViewFrom.VirtualMode) { for(int i = 0; i < listViewFrom.SelectedIndices.Count; i++) cards.Add(listViewFrom.DataSource[listViewFrom.SelectedIndices[i]]); } else { foreach(ListViewItem item in listViewFrom.SelectedItems) cards.Add(((CardListItemData)item.Tag).CardItem); } foreach(CardItem card in cards) controller.MoveCard(contextFrom, contextTo, card, index); }
public void SelectCard(DeckEditorListContext listContext, CardItem card) { CardListView list = null; switch(listContext) { case DeckEditorListContext.Sideboard: list = listSideboard; break; case DeckEditorListContext.Main: list = listMain; break; case DeckEditorListContext.Archive: list = listArchive; break; } list.SelectedIndices.Clear(); if(card != null) { ListViewItem item = null; if(list.VirtualMode) item = list.FindItemWithText(card.Name); else item = list.Items.Find(card.UniqueID, false).Single(); item.Selected = true; list.EnsureVisible(item.Index); } }
public string GetQuickSearchText(DeckEditorListContext listContext) { string text = string.Empty; switch(listContext) { case DeckEditorListContext.Sideboard: text = txtSideQuickSearch.Text; break; case DeckEditorListContext.Main: text = txtMainQuickSearch.Text; break; default: text = txtArchiveQuickSearch.Text; break; } return text; }
public void ClearList(DeckEditorListContext listContext) { switch(listContext) { case DeckEditorListContext.Main: listMain.Items.Clear(); break; case DeckEditorListContext.Sideboard: listSideboard.Items.Clear(); break; } }
ObservableCollection<CardItem> GetList(DeckEditorListContext listContext) { ObservableCollection<CardItem> list = null; switch(listContext) { case DeckEditorListContext.Sideboard: list = deckEditor.Deck.SideboardCards; break; case DeckEditorListContext.Main: list = deckEditor.Deck.MainCards; break; } return list; }