private void beginRenaming(DeckModel model, Rectangle fieldBounds) { _renamedModel = model; fieldBounds.Offset(_viewDeck.Location); _textBoxName.Bounds = fieldBounds; _textBoxName.Text = model.Deck.Name; _textBoxName.SelectAll(); _textBoxName.Visible = true; _textBoxName.Focus(); }
private void saveCurrentDeck() { var copy = _model.Deck.Copy(); var copyModel = new DeckModel(copy, _ui) { Id = _models.Count }; _deckListModel.Insert(0, copy); _models.Insert(0, copyModel); _searchSubsystem.ModelChanged(); }
private void beginRenaming(DeckModel model, Rectangle fieldBounds) { _renamedModel = model; fieldBounds.Offset(_viewDeck.Location); _panelRename.Bounds = fieldBounds; _textboxRename.Text = model.Name; _textboxRename.SelectAll(); _textboxRename.SelectionAlignment = HorizontalAlignment.Center; _panelRename.Visible = true; _textboxRename.Focus(); }
private void initModels() { _model = new DeckModel(Deck.Create(), _ui) { Id = -1, IsCurrent = true }; var models = _deckListModel.GetModels(_ui); foreach (var model in models) { model.Id = _models.Count; _models.Add(model); } _searchSubsystem.ModelChanged(); }
public void Rename(DeckModel deck, string name) { lock (_syncModels) { _decksByName.Remove(deck.Name, deck); deck.Name = name; var duplicate = findDuplicate(deck.OriginalDeck); if (duplicate != null) { duplicate.Saved = deck.Saved; } else { _decksByName.Add(deck.Name, deck); } } }
public static IEnumerable <ButtonLayout> GetCustomButtons(IEnumerable <ButtonLayout> baseResult, FieldControl field, DeckModel deckModel) { if (!Str.Equals(field.FieldName, nameof(DeckModel.Saved))) { return(baseResult); } var list = baseResult.ToList(); if (deckModel.IsCurrent) { list[CustomButtonRemove].Size = Size.Empty; list[CustomButtonOpen].Size = Size.Empty; list[CustomButtonOpenTransformed].Size = Size.Empty; } else { list[CustomButtonAdd].Size = Size.Empty; } return(list); }
private void removeDeck(DeckModel deckModel) { _listModel.Remove(deckModel); _listModel.Save(); }
private void openDeck(DeckModel deckModel) => DeckOpened?.Invoke(this, deckModel.Deck);