public ActionResult DeleteArticles(string strId) { if (!strId.Equals("")) { strId = strId.Trim('|'); string[] arrId = strId.Split('|'); foreach (var adId in arrId) { var obj = new HelpArticle(); int aId = 0; Int32.TryParse(adId, out aId); obj = _helpArticleService.GetHelpArticleById(Convert.ToInt32(aId)); if (obj != null) { _helpArticleService.RemoveHelpArticle(obj); } else { return(Content("error: Không thể xóa bài viết này!")); } } return(Content("Xóa bài viết thành công!")); } else { return(Content("error: Bạn phải chọn ít nhất một bài viết để xóa!")); } }
public void LoadUri(Uri uri, HelpArticle sourceArticle = null) { try { var webClient = new WebClient(); markdownDocument.BaseUri = uri; this.sourceArticle = sourceArticle; try { // put in controls from the feed that show relevant printer information WebCache.RetrieveText(uri.ToString(), (markDown) => { UiThread.RunOnIdle(() => { this.Markdown = markDown; }); }); } catch { } } catch { // On error, revert to empty content this.Markdown = ""; } }
public IEnumerable <HelpArticle> GetHelpArticleList(out List <HelpArticleFrontMatter> cached) { cached = HttpContext.Current.Cache["ClassCollection:LcMarkdown.HelpArticleList"] as List <HelpArticleFrontMatter>; if (cached == null) { var request = new RestRequest("/repos/" + pagesOwnerRepo + "/contents/help/articles/", Method.GET); request.RequestFormat = DataFormat.Json; var response = restClient.Execute <List <HelpPage> >(request); List <HelpArticleFrontMatter> frontMatterArticles = new List <HelpArticleFrontMatter>(); foreach (var page in response.Data) { HelpArticleFrontMatter frontMatter; HelpArticle article = GetHelpArticle(page.Path, out frontMatter); frontMatterArticles.Add(frontMatter); } cached = frontMatterArticles; HttpContext.Current.Cache["ClassCollection:LcMarkdown.HelpArticleList"] = cached; } List <HelpArticle> helpArticles = (from a in cached select new HelpArticle() { id = a.Id, title = a.Title, body = a.Content, section_id = a.SectionId } ) .ToList(); return(helpArticles); }
public HelpArticleHeader(HelpArticle helpArticle, ThemeConfig theme, bool boldFont = false, int pointSize = -1, string editToolTipText = null) : base(theme.TabbarPadding) { this.Padding = theme.ToolbarPadding; this.HAnchor = HAnchor.Stretch; this.VAnchor = VAnchor.Fit; var titleText = new TextWidget(helpArticle.Name, textColor: theme.TextColor, pointSize: pointSize > 0 ? pointSize : theme.DefaultFontSize, bold: boldFont) { VAnchor = VAnchor.Center, AutoExpandBoundsToText = true, EllipsisIfClipped = true, Margin = new BorderDouble(left: 3) }; this.AddChild(titleText); this.ActionArea.VAnchor = VAnchor.Stretch; this.ActionArea.MinimumSize = new Vector2(0, titleText.Height); var editButton = new IconButton(StaticData.Instance.LoadIcon("icon_edit.png", 16, 16).SetToColor(theme.TextColor), theme) { ToolTipText = editToolTipText ?? "Edit".Localize(), Name = helpArticle.Name + " Edit" }; editButton.Click += (s, e) => { this.EditClicked?.Invoke(this, null); }; this.SetRightAnchorItem(editButton); this.ActionArea.Margin = this.ActionArea.Margin.Clone(right: editButton.Width + 5); }
private static void ProcessHelpTree(HelpArticle context, Dictionary <string, HelpArticle> helpArticles) { helpArticles[context.Path] = context; foreach (var child in context.Children) { ProcessHelpTree(child, helpArticles); } }
public void LoadUri(Uri uri, HelpArticle sourceArticle = null) { var webClient = new WebClient(); markdownDocument.BaseUri = uri; this.sourceArticle = sourceArticle; this.Markdown = webClient.DownloadString(uri); }
public void LoadUri(Uri uri, HelpArticle sourceArticle = null) { try { var webClient = new WebClient(); markdownDocument.BaseUri = uri; this.sourceArticle = sourceArticle; this.Markdown = webClient.DownloadString(uri); } catch { // On error, revert to empty content this.Markdown = ""; } }