Exemple #1
0
        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();
        }
Exemple #2
0
        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();
        }
Exemple #3
0
        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();
        }
Exemple #4
0
        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();
        }
Exemple #5
0
        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);
                }
            }
        }
Exemple #6
0
        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);
        }
Exemple #7
0
 private void removeDeck(DeckModel deckModel)
 {
     _listModel.Remove(deckModel);
     _listModel.Save();
 }
Exemple #8
0
 private void openDeck(DeckModel deckModel) =>
 DeckOpened?.Invoke(this, deckModel.Deck);