Exemplo n.º 1
0
        public DrawingSubsystem(
            LayoutViewControl viewCards,
            LayoutViewControl viewDeck,
            CardSearchSubsystem cardSearchSubsystem,
            CardDocumentAdapter adapter,
            DeckEditorModel deckEditorModel,
            CountInputSubsystem countInputSubsystem,
            QuickFilterFacade quickFilterFacade,
            LegalitySubsystem legalitySubsystem,
            IconRecognizer iconRecognizer)
        {
            _viewCards           = viewCards;
            _viewDeck            = viewDeck;
            _deckEditorModel     = deckEditorModel;
            _countInputSubsystem = countInputSubsystem;
            _quickFilterFacade   = quickFilterFacade;
            _legalitySubsystem   = legalitySubsystem;

            _viewCards.RowDataLoaded += setHighlightMatches;
            _viewCards.IconRecognizer = iconRecognizer;

            _highlightSubsystem = new SearchResultHighlighter(
                cardSearchSubsystem,
                adapter,
                new KeywordHighlighter());
        }
Exemplo n.º 2
0
 public LayoutViewTooltip(
     object owner,
     LayoutViewControl view,
     CardSearchSubsystem cardSearchSubsystem,
     CountInputSubsystem countInput)
 {
     Owner = owner;
     _view = view;
     _cardSearchSubsystem = cardSearchSubsystem;
     _countInput          = countInput;
 }
Exemplo n.º 3
0
        public DeckEditorSubsystem(
            LayoutViewControl viewCards,
            LayoutViewControl viewDeck,
            DeckEditorModel deckEditorModel,
            CollectionEditorModel collectionModel,
            DraggingSubsystem draggingSubsystem,
            CountInputSubsystem countInputSubsystem,
            Cursor cursor,
            FormZoom formZoom,
            FormMain parent)
        {
            _viewCards           = viewCards;
            _viewDeck            = viewDeck;
            _cursor              = cursor;
            _deckEditorModel     = deckEditorModel;
            _collectionModel     = collectionModel;
            _draggingSubsystem   = draggingSubsystem;
            _countInputSubsystem = countInputSubsystem;

            _formZoom            = formZoom;
            _parent              = parent;
            _ctsLifetime         = new CancellationTokenSource();
            _textSelectionCursor = Cursors.IBeam;
        }
Exemplo n.º 4
0
        public FormMain(
            CardRepository cardRepo,
            PriceRepository priceRepo,
            ImageRepository imageRepo,
            ImageLoader imageLoader,
            UiConfigRepository uiConfigRepository,
            CollectionEditorModel collectionEditor,
            CardSearcher cardSearcher,
            CardDocumentAdapter cardAdapter,
            DeckDocumentAdapter deckAdapter,
            KeywordSearcher keywordSearcher,
            DeckListModel deckListModel,
            DeckSearcher deckSearcher,
            IconRecognizer iconRecognizer,
            DeckSerializationSubsystem serialization,
            MtgArenaIntegration mtgArenaIntegration,
            App app)
            : this()
        {
            DoubleBuffered = true;

            _app                 = app;
            _cardSearcher        = cardSearcher;
            _keywordSearcher     = keywordSearcher;
            _quickFilterControls = QuickFilterSetup.GetQuickFilterControls(this);

            _cardRepo            = cardRepo;
            _priceRepo           = priceRepo;
            _imageLoader         = imageLoader;
            _uiConfigRepository  = uiConfigRepository;
            _collectionEditor    = collectionEditor;
            _serialization       = serialization;
            _mtgArenaIntegration = mtgArenaIntegration;

            beginRestoreSettings();

            _fields = new CardFields();

            QuickFilterSetup.SetQuickFilterProperties(this);
            QuickFilterImages.SetImages(this);

            _quickFilterFacade = new QuickFilterFacade(
                KeywordDefinitions.Patterns,
                KeywordDefinitions.Values.ToKeywordDisplayTexts(),
                KeywordDefinitions.PropertyNames,
                KeywordDefinitions.PropertyNamesDisplay,
                keywordSearcher);

            _searchSubsystem = new CardSearchSubsystem(
                this,
                _searchBar,
                uiConfigRepository,
                cardSearcher,
                cardAdapter,
                _viewCards,
                _viewDeck);

            _cardSort = new CardSortSubsystem(_viewCards, _cardRepo, _fields, _searchSubsystem);

            endRestoreSettings();

            _countInputSubsystem = new CountInputSubsystem();
            _tooltipViewCards    = new LayoutViewTooltip(this, _viewCards, _searchSubsystem, _countInputSubsystem);
            _tooltipViewDeck     = new LayoutViewTooltip(this, _viewDeck, _searchSubsystem, _countInputSubsystem);

            _formZoom = new FormZoom(_cardRepo, imageRepo, _imageLoader);

            _imagePreloading = new ImagePreloadingSubsystem(
                _viewCards,
                _viewDeck,
                uiConfigRepository);

            _deckEditor = new DeckEditorModel();

            _dragging = new DraggingSubsystem(
                _viewDeck,
                _viewCards,
                _deckEditor,
                this,
                _imageLoader,
                _app);

            _deckEditorSubsystem = new DeckEditorSubsystem(
                _viewCards,
                _viewDeck,
                _deckEditor,
                _collectionEditor,
                _dragging,
                _countInputSubsystem,
                Cursor,
                _formZoom,
                this);

            _viewDeck.DataSource  = _deckEditor.DataSource;
            _viewCards.DataSource = _searchResultCards;

            _legality = new LegalitySubsystem(
                _dropdownLegality,
                _buttonLegalityAllowLegal,
                _buttonLegalityAllowRestricted,
                _buttonLegalityAllowBanned,
                _buttonLegalityAllowFuture);

            _drawing = new DrawingSubsystem(
                _viewCards,
                _viewDeck,
                _searchSubsystem,
                cardAdapter,
                _deckEditor,
                _countInputSubsystem,
                _quickFilterFacade,
                _legality,
                iconRecognizer);


            _printing = new PrintingSubsystem(imageRepo, _cardRepo);

            _deckZones = new DeckZoneSubsystem(
                _tabHeadersDeck,
                _dragging,
                _viewDeck)
            {
                DeckZone = Zone.Main
            };

            scale();
            setRightPanelsWidth();

            _keywordsIndexUpToDate     = _keywordSearcher.IsUpToDate;
            _luceneSearchIndexUpToDate = _cardSearcher.IsUpToDate;
            _spellcheckerIndexUpToDate = _cardSearcher.Spellchecker.IsUpToDate;

            _history = new HistorySubsystem(uiConfigRepository);

            _evaluators = new Evaluators
            {
                { 2, _legality.MatchesLegalityFilter },
                { 3, evalFilterByCollection },
                { 4, evalFilterByDeck },
                { 0, _quickFilterFacade.Evaluate },
                { 1, evalFilterBySearchText }
            };

            _deckSearcher = deckSearcher;
            _deckListControl.Init(
                deckListModel,
                iconRecognizer,
                _deckSearcher,
                deckAdapter,
                collectionEditor,
                uiConfigRepository,
                this,
                _app);

            _copyPaste = new CopyPasteSubsystem(
                _cardRepo,
                _serialization,
                _collectionEditor,
                _deckEditor,
                this,
                _deckListControl,
                _viewDeck,
                _tabHeadersDeck,
                _viewCards,
                _deckListControl.DeckListView);

            updateExcludeManaAbility();
            updateExcludeManaCost();
            updateShowProhibited();
            updateShowSampleHandButtons();
            updateDeckVisibility();

            subscribeToEvents();

            if (components == null)
            {
                components = new Container();
            }

            components.Add(_deckEditorSubsystem);
            components.Add(_countInputSubsystem);
            components.Add(_formZoom);
            components.Add(_copyPaste);

            _popupSearchExamples.MenuControl   = _menuSearchExamples;
            _popupSearchExamples.MenuAlignment = HorizontalAlignment.Right;
        }