public CoreApp(IChapterHeading chapterHeading, IVerseView verseView, ISimpleStorage simpleStorage, IHistoryControls historyControls, int initialJump) { _chapterHeading = chapterHeading; _verseView = verseView; _historyControls = historyControls; // Load history. _history = new History(simpleStorage); // Keep track of changes to the verse view. verseView.OnScroll += UpdateCurrentLocation; verseView.OnSwipeLeft += MoveNextChapter; verseView.OnSwipeRight += MovePreviousChapter; // Wire up history to the history controls. historyControls.BackClick += MoveBack; historyControls.ForwardClick += MoveForward; _history.CanMoveChanged += EnableDisableHistoryButtons; // If the app has to jump to a verse, then insert it into the history. if (initialJump != Bible.InvalidAbsoluteVerseNumber) { _history.AddJump(_history.CurrentAbsoluteVerseNumber, initialJump); } // Pick up where we left off. verseView.Jump(Location.Create(_history.CurrentAbsoluteVerseNumber)); EnableDisableHistoryButtons(); }
public GameContext(IClientWrapper client, ISimpleStorage <Map> mapStorage, ISimpleStorage <DamageStatistics> damageStorage) { _client = client; _mapStorage = mapStorage; _damageStorage = damageStorage; Initialize(); }
public GameContext(IClientWrapper client, ISimpleStorage<Map> mapStorage, ISimpleStorage<DamageStatistics> damageStorage) { _client = client; _mapStorage = mapStorage; _damageStorage = damageStorage; Initialize(); }
public StubbedApp(IChapterHeading chapterHeading = null, IVerseView verseView = null, ISimpleStorage simpleStorage = null, IHistoryControls historyControls = null, int initialJump = Bible.InvalidAbsoluteVerseNumber) { ChapterHeading = chapterHeading ?? new StubChapterHeading(); VerseView = verseView ?? new StubVerseView(); SimpleStorage = simpleStorage ?? new StubSimpleStorage(); HistoryControls = historyControls ?? new StubHistoryControls(); InitialJump = initialJump; App = new CoreApp(ChapterHeading, VerseView, SimpleStorage, HistoryControls, InitialJump); }
public BadTranslator(TextReader reader, ISimpleStorage storage, int maxThreadCount = 0) : base(reader, storage) { if (maxThreadCount == 0) { _factory = new TaskFactory(); } else { //если maxThreadCount!=0, то создаем планировщик для управления кол-ом одновременно создаваемых потоков LimitedConcurrencyLevelTaskScheduler lcts = new LimitedConcurrencyLevelTaskScheduler(maxThreadCount); _factory = new TaskFactory(lcts); } string line = null; while ((line = _reader.ReadLine()) != null) { _storage.Add(line.Split('\t')[0], line.Split('\t')[1]); } }
/// <summary> /// Initializes the history, loading any saved history from <paramref name="simpleStorage"/>. /// </summary> /// <param name="simpleStorage">The underlying storage.</param> public History(ISimpleStorage simpleStorage) { _simpleStorage = simpleStorage; var currentIndexString = _simpleStorage.Load("history-currentIndex"); if (currentIndexString == null) { _currentIndex = 0; _history = new List <int> { Bible.John_1_1 }; } else { _currentIndex = int.Parse(currentIndexString, CultureInfo.InvariantCulture); _history = new List <int>(_simpleStorage.Load("history-history").Split(',').Select(x => int.Parse(x, CultureInfo.InvariantCulture))); } }
public SimpleTranslator(TextReader reader, ISimpleStorage storage) { _reader = reader; _storage = storage; }