protected void ReloadPageContent() { // Switch content model, if necessary. var newContentModel = WikiPage.ContentModel ?? MediaWikiUtility.InferContentModelFromTitle( WikiLink.Parse(WikiPage.Site, WikiPage.Title)); if (EditorContentModel != newContentModel) { var ls = _SettingsService.GetSettingsByWikiContentModel(newContentModel); if (string.IsNullOrEmpty(ls.LanguageName)) { TextEditor = null; } else { TextEditor = _TextEditorFactory.CreateTextEditor(ls.LanguageName, true); TextEditor.WikiSite = SiteContext; TextEditor.DocumentOutline = DocumentOutline; } EditorContentModel = newContentModel; } if (TextEditor != null) { TextEditor.TextBox.Text = WikiPage.Content; TextEditor.InvalidateDocumentOutline(true); } }
/// <summary> /// Given a site or page URL of a MediaWiki site, try to look for the Api Endpoint URL of it. /// </summary> /// <param name="client">WikiClient instance.</param> /// <param name="urlExpression">The URL of MediaWiki site. It can be with or without protocol prefix.</param> /// <exception cref="ArgumentNullException"><paramref name="client"/> or <paramref name="urlExpression"/> is <c>null</c>.</exception> /// <exception cref="TimeoutException">A time-out has been reached during test requests.</exception> /// <returns>The URL of Api Endpoint. OR <c>null</c> if such search has failed.</returns> public static Task <string> SearchApiEndpointAsync(WikiClient client, string urlExpression) { return(MediaWikiUtility.SearchApiEndpointAsync(client, urlExpression)); }