/// <inheritdoc /> public async Task OpenPageAsync(WikiSiteViewModel wikiSite, string pageTitle) { // TODO Maybe show the page in the application, in the future. var url = await wikiSite.GetPageUrlAsync(pageTitle); Utility.OpenUrl(url); }
public WikiSiteOverviewViewModel(IViewModelFactory viewModelFactory, SettingsService settingsService, WikiSiteViewModel wikiSite) { if (viewModelFactory == null) { throw new ArgumentNullException(nameof(viewModelFactory)); } if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } SiteContext = wikiSite; RecentChangesView = new ListCollectionView(RecentChangesList); RecentChangesView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(RecentChangeViewModel.TimeStamp), DateGroupingConverter.Default)); RecentChangesFilter.PropertyChanged += RecentChangesFilter_PropertyChanged; _ViewModelFactory = viewModelFactory; Title = ToolTip = wikiSite.DisplayName; BuildContentId(wikiSite.ApiEndpoint); RefreshSiteInfoAsync().Forget(); }
public PageDiffViewModel(WikiSiteViewModel wikiSite) { if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } SiteContext = wikiSite; }
public RecentChangeViewModel CreateRecentChange(RecentChangesEntry model, WikiSiteViewModel wikiSite) { if (model == null) { throw new ArgumentNullException(nameof(model)); } return(new RecentChangeViewModel(this, wikiSite, model)); }
public PageEditorViewModel CreatePageEditor(WikiSiteViewModel wikiSite) { if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } return(new PageEditorViewModel(_SettingsService, _TextEditorFactory, wikiSite)); }
public WikiSiteOverviewViewModel CreateWikiSiteOverview(WikiSiteViewModel wikiSite) { if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } return(new WikiSiteOverviewViewModel(this, _SettingsService, wikiSite)); }
public static bool CloseByWikiSite(this DocumentViewModelCollection vms, WikiSiteViewModel wikiSite, DocumentViewModel excepts) { if (vms == null) { throw new ArgumentNullException(nameof(vms)); } if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } return(vms.CloseAll(vm => vm.SiteContext == wikiSite && vm != excepts)); }
/// <inheritdoc /> public PageDiffViewModel OpenPageDiffViewModel(WikiSiteViewModel wikiSite, int revisionId1, int revisionId2) { if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } var viewer = _ChildViewModelService.Documents .OfType <PageDiffViewModel>().FirstOrDefault(vm => vm.SiteContext == wikiSite && vm.RevisionId1 == revisionId1 && vm.RevisionId2 == revisionId2); if (viewer == null) { viewer = CreatePageDiffViewModel(wikiSite); viewer.SetRevisionsAsync(revisionId1, revisionId2).Forget(); _ChildViewModelService.Documents.Add(viewer); } viewer.IsActive = true; return(viewer); }
public async Task <PageEditorViewModel> OpenPageEditorAsync(WikiSiteViewModel wikiSite, string pageTitle) { var site = await wikiSite.GetSiteAsync(); var normalizedTitle = WikiLink.NormalizeWikiLink(site, pageTitle); var editor = _ChildViewModelService.Documents .OfType <PageEditorViewModel>() .Where(vm => vm.SiteContext == wikiSite) .FirstOrDefault(vm => vm.WikiPage.Title == normalizedTitle); if (editor == null) { editor = CreatePageEditor(wikiSite); editor.SetWikiPageAsync(pageTitle).Forget(); _ChildViewModelService.Documents.Add(editor); } editor.IsActive = true; return(editor); }
public PageEditorViewModel(SettingsService settingsService, ITextEditorFactory textEditorFactory, WikiSiteViewModel wikiSite) { if (settingsService == null) { throw new ArgumentNullException(nameof(settingsService)); } if (wikiSite == null) { throw new ArgumentNullException(nameof(wikiSite)); } _SettingsService = settingsService; _TextEditorFactory = textEditorFactory; SiteContext = wikiSite; autoRefetchTimer = new DispatcherTimer(); relativeDatesUpdateTimer = new DispatcherTimer(); autoRefetchTimer.Tick += AutoRefetchTimer_Tick; relativeDatesUpdateTimer.Interval = TimeSpan.FromSeconds(10); relativeDatesUpdateTimer.Tick += (_, e) => UpdateRelativeDates(); LoadSettings(); settingsService.SettingsChangedEvent.Subscribe(LoadSettings); }
public PageHistoryViewModel(SettingsService settingsService, WikiSiteViewModel wikiSite) { }
/// <inheritdoc /> public PageDiffViewModel CreatePageDiffViewModel(WikiSiteViewModel wikiSite) { return(new PageDiffViewModel(wikiSite)); }
public static bool CloseByWikiSite(this DocumentViewModelCollection vms, WikiSiteViewModel wikiSite) { return(CloseByWikiSite(vms, wikiSite, null)); }