[UsedImplicitly] // by ninject public GuiLoader( Loader loader, CardRepository repo, NewsService newsService, DownloaderSubsystem downloaderSubsystem, DeckListModel deckListModel, DeckSearcher deckSearcher, DeckIndexUpdateSubsystem deckIndexUpdateSubsystem) { _loader = loader; _repo = repo; _loader.AddAction(newsService.FetchNews); _loader.AddAction(downloaderSubsystem.CalculateProgress); _loader.AddTask(async() => { deckListModel.Load(); if (deckSearcher.IsIndexSaved) { deckSearcher.LoadIndexes(); } else { while (!_repo.IsPriceLoadingComplete) { await TaskEx.Delay(100); } deckSearcher.LoadIndexes(); } }); }
[UsedImplicitly] // by ninject public GuiLoader( Loader loader, CardRepository repo, PriceRepository priceRepo, NewsService newsService, DownloaderSubsystem downloaderSubsystem, DeckListModel deckListModel, DeckSearcher deckSearcher, DeckIndexUpdateSubsystem deckIndexUpdateSubsystem) { _loader = loader; _repo = repo; _priceRepo = priceRepo; _loader.AddTask(newsService.FetchNews); _loader.AddTask(token => downloaderSubsystem.CalculateProgress()); _loader.AddTask(async token => { deckListModel.Load(); if (deckSearcher.IsIndexSaved) { deckSearcher.LoadIndexes(); await _priceRepo.IsLoadingPriceComplete.Wait(token); } else { await _priceRepo.IsLoadingPriceComplete.Wait(token); deckSearcher.LoadIndexes(); } deckIndexUpdateSubsystem.SubscribeToEvents(); deckListModel.FillCardNames(); deckListModel.SubscribeToEvents(); }); }
public DeckSearcher( DeckListModel deckListModel, DeckSpellchecker spellchecker, DeckDocumentAdapter adapter) : base(spellchecker, adapter) { _deckListModel = deckListModel; IndexDirectoryParent = AppDir.Data.Join("index", "deck", "search"); }
[UsedImplicitly] // in GuiLoader public DeckIndexUpdateSubsystem( DeckSearcher searcher, PriceRepository priceRepo, DeckListModel listModel, IApplication app) { _searcher = searcher; _priceRepo = priceRepo; _listModel = listModel; _app = app; }
public GuiLoader( Loader loader, NewsService newsService, DownloaderSubsystem downloaderSubsystem, DeckListModel deckListModel) { _loader = loader; _deckListModel = deckListModel; _loader.Add(newsService.FetchNews); _loader.Add(downloaderSubsystem.CalculateProgress); }
[UsedImplicitly] // by ninject public GuiLoader( Loader loader, CardRepository repo, CardRepository42 repo42, CardRepositoryLegacy repoLegacy, NewsService newsService, DownloaderSubsystem downloaderSubsystem, DeckListModel deckListModel, DeckListLegacyConverter deckListConverter, HistoryLegacyConverter historyConverter, DeckSearcher deckSearcher) { _loader = loader; _repo = repo; _repo42 = repo42; _repoLegacy = repoLegacy; _deckListConverter = deckListConverter; _historyConverter = historyConverter; _loader.AddAction(newsService.FetchNews); _loader.AddAction(downloaderSubsystem.CalculateProgress); _loader.AddTask(async() => { if (deckListConverter.IsLegacyConversionRequired) { while (!deckListConverter.IsConversionCompleted) { await TaskEx.Delay(100); } } deckListModel.Load(); if (deckSearcher.IsIndexSaved) { deckSearcher.LoadIndexes(); } else { while (!_repo.IsPriceLoadingComplete) { await TaskEx.Delay(100); } deckSearcher.LoadIndexes(); } }); }
public ActionResult UploadDeck(HttpPostedFileBase photo) { var model = new DeckListModel(); try { string directory = Path.GetTempPath(); if (photo != null && photo.ContentLength > 0) { var fileName = Path.Combine(directory, Path.GetFileName(photo.FileName)); try { photo.SaveAs(fileName); var reader = new DecReader(); var result = reader.ReadFile(fileName); // TODO: Wrap result and add to model model.Cards = result; } finally { var info = new FileInfo(fileName); if (info.Exists) { info.Delete(); } } } } catch (Exception error) { } // return RedirectToAction("DeckList"); return(View(model)); }
public FormMain( UndoConfig undoConfig, CardRepository cardRepo, ImageRepository imageRepo, ImageCacheConfig imageCacheConfig, ImageLoader imageLoader, CollectionEditorModel collectionEditor, CardSearcher cardSearcher, CardDocumentAdapter cardAdapter, DeckDocumentAdapter deckAdapter, KeywordSearcher keywordSearcher, ForgeSetRepository forgeSetRepo, DeckListModel deckListModel, DeckSearcher deckSearcher, IconRecognizer iconRecognizer, FormManager formManager) : this() { DoubleBuffered = true; KeyPreview = true; _viewCards = new MtgLayoutView(_layoutViewCards); _viewDeck = new MtgLayoutView(_layoutViewDeck); _cardSearcher = cardSearcher; _keywordSearcher = keywordSearcher; _quickFilterControls = QuickFilterSetup.GetQuickFilterControls(this); _cardRepo = cardRepo; _imageLoader = imageLoader; _collectionEditor = collectionEditor; _serialization = new DeckSerializationSubsystem(_cardRepo, forgeSetRepo); beginRestoreSettings(); _fields = new Fields(); QuickFilterSetup.SetQuickFilterProperties(this); QuickFilterImages.SetImages(this); _quickFilterFacade = new QuickFilterFacade( KeywordDefinitions.Patterns, KeywordDefinitions.Values.ToKeywordDisplayTexts(), KeywordDefinitions.PropertyNames, KeywordDefinitions.PropertyNamesDisplay, keywordSearcher); _buttons = new ButtonSubsystem(); _cardSearch = new CardSearchSubsystem( this, _searchEditor, _panelIconSearch, _listBoxSuggest, cardSearcher, cardAdapter, _viewCards, _viewDeck); _panelSearchExamples.Setup(_cardSearch, _buttons, _buttonSearchExamplesDropDown); _sort = new SortSubsystem(_viewCards, _cardRepo, _fields, _cardSearch); endRestoreSettings(); _tooltipViewCards = new LayoutViewTooltip(this, _viewCards, _cardSearch); _tooltipViewDeck = new LayoutViewTooltip(this, _viewDeck, _cardSearch); var formZoomCard = new FormZoom(_cardRepo, imageRepo, _imageLoader); _scroll = new ScrollSubsystem(_viewDeck, _viewCards); _imagePreloading = new ImagePreloadingSubsystem( _viewCards, _viewDeck, _scroll, imageCacheConfig); _deckEditor = new DeckEditorModel(); _dragging = new DraggingSubsystem( _viewDeck, _viewCards, _deckEditor, this, _imageLoader, formManager); _deckEditorUi = new DeckEditorUi( _viewCards, _viewDeck, _deckEditor, _collectionEditor, _dragging, Cursor, formZoomCard); _viewDeck.SetDataSource(_deckEditor.DataSource); _viewCards.SetDataSource(_searchResultCards); _legality = new LegalitySubsystem( _menuLegalityFormat, _buttonLegalityAllowLegal, _buttonLegalityAllowRestricted, _buttonLegalityAllowBanned); _drawing = new DrawingSubsystem( _viewCards, _viewDeck, _dragging, _cardSearch, cardAdapter, _deckEditor, _quickFilterFacade, _legality, _imageLoader, iconRecognizer); _printing = new PrintingSubsystem(imageRepo, _cardRepo); DeckZone = Zone.Main; scale(); setRightPanelsWidth(); _keywordsIndexUpToDate = _keywordSearcher.IsUpToDate; _luceneSearchIndexUpToDate = _cardSearcher.IsUpToDate; _spellcheckerIndexUpToDate = _cardSearcher.Spellchecker.IsUpToDate; _searchTextSelection = new RichTextBoxSelectionSubsystem(_searchEditor); _history = new HistorySubsystem(undoConfig); _evaluators = new Evaluators { { 2, _legality.IsAllowedInFormat }, { 3, evalFilterByCollection }, { 4, evalFilterByDeck }, { 0, _quickFilterFacade.Evaluate }, { 1, evalFilterBySearchText } }; _deckListControl.Init( deckListModel, iconRecognizer, deckSearcher, deckAdapter, this); _copyPaste = new CopyPasteSubsystem( _cardRepo, _serialization, _collectionEditor, _deckEditor, _formRoot, this, _layoutViewDeck, _tabHeadersDeck, _layoutViewCards, _deckListControl.DeckListView); setupCheckButtonImages(); updateExcludeManaAbility(); updateExcludeManaCost(); updateShowProhibited(); updateShowSampleHandButtons(); updateDeckVisibility(); subscribeToEvents(); }
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; }