public StorySyncWorker(IWdcStoryContainer storyContainer, IWdcReader wdcReader, IWdcClient wdcClient, IConfigProvider configProvider, IFileDumper fileDumper, IGuiContext guiContext ) { _storyContainer = storyContainer; _wdcReader = wdcReader; _wdcClient = wdcClient; _configProvider = configProvider; _fileDumper = fileDumper; _gui = guiContext; SetSettings(configProvider.GetSection <StorySyncWorkerSettings>()); // Init some stuff _storyStatusList = new Dictionary <string, StorySyncWorkerStoryStatus>(); _ctSource = new CancellationTokenSource(); _status = new StorySyncWorkerStatus(); // TODO add functionality to react to configuration changes. E.g. Cancel process, update settings, start again. // Subscribe to some events _storyContainer.OnUpdate += new EventHandler <WdcStoryContainerEventArgs>(OnStoryContainerChanged); _configProvider.OnSectionChanged += new EventHandler <ConfigSectionChangedEventArgs>(OnSettingsChanged); }
public AddStoryWdcForm(IWdcClient client, IWdcReader reader, IWdcStoryContainer storyContainer) { _wdcClient = client; _wdcReader = reader; _wdcStoryContainer = storyContainer; _ctSourceWdcClient = new CancellationTokenSource(); InitializeComponent(); // Set the form SetFormState(AddStoryFormState.ReadToGetStory); }
public async Task <WdcInteractiveChapter> GetInteractiveChaper(string interactiveID, string chapterPath, IWdcClient wdcClient, CancellationToken ct) { WdcResponse payload = await wdcClient.GetInteractiveChapter(interactiveID, chapterPath, ct); return(GetInteractiveChaper(interactiveID, chapterPath, payload)); }
// TODO Get chapter list from story outline public async Task <IEnumerable <Uri> > GetInteractiveChapterList(string interactiveID, IWdcClient wdcClient, CancellationToken ct) { var wdcPayload = await wdcClient.GetInteractiveOutline(interactiveID, ct); ct.ThrowIfCancellationRequested(); return(GetInteractiveChapterList(interactiveID, wdcClient.GetPathToRoot(), wdcPayload)); }
public async Task <WdcInteractiveStory> GetInteractiveStory(string interactiveID, IWdcClient wdcClient, CancellationToken ct) { var wdcPayload = await wdcClient.GetInteractiveHomepage(interactiveID, ct); return(GetInteractiveStory(interactiveID, wdcPayload)); }
public WdcReaderTests() { TestUtil.SetupLogging(); _client = new DummyWdcClient("Data"); _reader = new WdcReader(); }