コード例 #1
0
        /// <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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 public PageDiffViewModel(WikiSiteViewModel wikiSite)
 {
     if (wikiSite == null)
     {
         throw new ArgumentNullException(nameof(wikiSite));
     }
     SiteContext = wikiSite;
 }
コード例 #4
0
 public RecentChangeViewModel CreateRecentChange(RecentChangesEntry model, WikiSiteViewModel wikiSite)
 {
     if (model == null)
     {
         throw new ArgumentNullException(nameof(model));
     }
     return(new RecentChangeViewModel(this, wikiSite, model));
 }
コード例 #5
0
 public PageEditorViewModel CreatePageEditor(WikiSiteViewModel wikiSite)
 {
     if (wikiSite == null)
     {
         throw new ArgumentNullException(nameof(wikiSite));
     }
     return(new PageEditorViewModel(_SettingsService, _TextEditorFactory, wikiSite));
 }
コード例 #6
0
 public WikiSiteOverviewViewModel CreateWikiSiteOverview(WikiSiteViewModel wikiSite)
 {
     if (wikiSite == null)
     {
         throw new ArgumentNullException(nameof(wikiSite));
     }
     return(new WikiSiteOverviewViewModel(this, _SettingsService, wikiSite));
 }
コード例 #7
0
 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));
 }
コード例 #8
0
        /// <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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 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);
 }
コード例 #11
0
 public PageHistoryViewModel(SettingsService settingsService,
                             WikiSiteViewModel wikiSite)
 {
 }
コード例 #12
0
 /// <inheritdoc />
 public PageDiffViewModel CreatePageDiffViewModel(WikiSiteViewModel wikiSite)
 {
     return(new PageDiffViewModel(wikiSite));
 }
コード例 #13
0
 public static bool CloseByWikiSite(this DocumentViewModelCollection vms,
                                    WikiSiteViewModel wikiSite)
 {
     return(CloseByWikiSite(vms, wikiSite, null));
 }