private async Task <bool> InitFieldFlyoutIfNeeded() { if (isDeckSelectsModified) { if (deckSelectFlyout.SelectedDecks.Count == 0) { await UIHelper.ShowMessageDialog("Please choose the decks you want to search first."); return(false); } List <JsonObject> models = new List <JsonObject>(); foreach (var deck in deckSelectFlyout.SelectedDecks) { var model = collection.Models.TryGetModel(deck.Id); if (model != null) { models.Add(model); } } if (models.Count == 0) { await UIHelper.ShowMessageDialog("The selected decks do not have any cards."); return(false); } noteFieldsViewModel = new MultiNoteFieldsSelectViewModel(models); noteFieldsViewFlyout = new FieldMultiSelect(noteFieldsViewModel); noteFieldsViewFlyout.FlyoutClosed += NoteFieldsViewFlyoutClosed; isDeckSelectsModified = false; } return(true); }
public FieldMultiSelect(MultiNoteFieldsSelectViewModel viewModel) { this.InitializeComponent(); fieldListView.DataContext = viewModel.Fields; }