private static void BuildAnnotations(WidgetBase widget) { widget.Annotations.AutoScale = true; var annGroup = new AnnotationGroupElement { X = 175, Y = 105 }; var textAnnotation = new TextAnnotation { X = 0, Y = 0, Label = "Current status" }; textAnnotation.Color = "666666"; textAnnotation.FontAttr.FontSize = "11"; textAnnotation.Align = FusionTextAlign.Center; annGroup.Add(textAnnotation); widget.Annotations.Add(annGroup); annGroup = new AnnotationGroupElement() { Id = "GrpRED", X = 175, Y = 125, Visible = false }; var circle = new CircleAnnotation { X = 0, Y = 0, Radius = 10, FillPattern = FillMethod.Radial, Color = "FFBFBF,FF0000" }; circle.Border.Show = false; annGroup.Add(circle); widget.Annotations.Add(annGroup); annGroup = new AnnotationGroupElement() { Id = "GrpYELLOW", X = 175, Y = 125, Visible = false }; circle = new CircleAnnotation { X = 0, Y = 0, Radius = 10, FillPattern = FillMethod.Radial, Color = "FFFF00,BBBB00" }; circle.Border.Show = false; annGroup.Add(circle); widget.Annotations.Add(annGroup); annGroup = new AnnotationGroupElement() { Id = "GrpGREEN", X = 175, Y = 125, Visible = false }; circle = new CircleAnnotation { X = 0, Y = 0, Radius = 10, FillPattern = FillMethod.Radial, Color = "00FF00,339933" }; circle.Border.Show = false; annGroup.Add(circle); widget.Annotations.Add(annGroup); }
// CopyTo protected override void CopyTo( WidgetBase o ) { base.CopyTo( o ); WidgetMenuSwitch oo = (WidgetMenuSwitch)o; oo.DeactivateNodes = DeactivateNodes; }
public ActionResult Edit(WidgetBase widget, string ReturnUrl) { if (!ModelState.IsValid) { return View(widget); } widget.CreateServiceInstance().UpdateWidget(widget); if (!ReturnUrl.IsNullOrEmpty()) { return Redirect(ReturnUrl); } if (!widget.PageID.IsNullOrEmpty()) { return RedirectToAction("Design", "Page", new { module = "Common", ID = widget.PageID }); } else { return RedirectToAction("LayoutWidget", "Layout", new { module = "Common" }); } }
public void Visit(StatementUnit node) { ITerminalWrapper evaluatedResult = ReferenceTables.GetValueOrNull(node.Expression); node.Value = evaluatedResult; WidgetBase unitWrapper = _widgetFactory.GetWidget(node); unitWrapper.Visibility = _parentExpressionDidNotEvaluate ? Visibility.Collapsed : Visibility.Visible; int index = _elementsToDisplay.ToList().FindIndex(elem => elem.Unit.Identifier == unitWrapper.Unit.Identifier); if (index < 0) { _elementsToDisplay.Add(unitWrapper); } else { _elementsToDisplay[index].Visibility = unitWrapper.Visibility; } }
public override WidgetPart Display(WidgetBase widget, HttpContextBase httpContext) { var carouselWidget = widget as CarouselWidget; if (carouselWidget.CarouselID.HasValue) { var varouselItems = _carouselItemService.Get("CarouselID", OperatorType.Equal, carouselWidget.CarouselID); if (carouselWidget.CarouselItems == null) { carouselWidget.CarouselItems = varouselItems; } else { ((List <CarouselItemEntity>)carouselWidget.CarouselItems).AddRange(varouselItems); } } carouselWidget.CarouselItems = carouselWidget.CarouselItems.Where(m => m.Status == (int)Constant.RecordStatus.Active); return(base.Display(widget, httpContext)); }
private static void BuildStyles(WidgetBase widget) { widget.Styles.Definition.Add(new NSoft.NFramework.FusionCharts.FontStyle("myValueFont") { Font = "맑은 고딕", Size = 10, Color = Color.Red, BgColor = "#F1F1F1".FromHtml(), BorderColor = "#999999".FromHtml() }); widget.Styles.Application.Add(new ApplyElement { ToObject = "Value", Styles = "myValueFont" }); widget.Styles.Application.Add(new ApplyElement { ToObject = "Label", Styles = "myValueFont" }); }
public ActionResult Create(WidgetBase widget, string ReturnUrl) { if (!ModelState.IsValid) { return(View(widget)); } widget.CreateServiceInstance().AddWidget(widget); if (widget.ActionType == ActionType.Continue) { return(RedirectToAction("Edit", new { widget.ID, ReturnUrl })); } if (!ReturnUrl.IsNullOrEmpty()) { return(Redirect(ReturnUrl)); } if (!widget.PageID.IsNullOrEmpty()) { return(RedirectToAction("Design", "Page", new { module = "admin", ID = widget.PageID })); } return(RedirectToAction("LayoutWidget", "Layout", new { module = "admin" })); }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"></see> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); XmlNodeList zone = XML_DOCUMENT.SelectNodes("//widget"); foreach (XmlNode widget in zone) { string fileName = Utils.RelativeWebRoot + "widgets/" + widget.InnerText + "/widget.ascx"; try { WidgetBase control = (WidgetBase)Page.LoadControl(fileName); control.WidgetID = new Guid(widget.Attributes["id"].InnerText); control.ID = control.WidgetID.ToString().Replace("-", string.Empty); control.Title = widget.Attributes["title"].InnerText; control.Zone = _ZoneName; if (control.IsEditable) { control.ShowTitle = bool.Parse(widget.Attributes["showTitle"].InnerText); } else { control.ShowTitle = control.DisplayHeader; } control.LoadWidget(); this.Controls.Add(control); } catch (Exception ex) { Literal lit = new Literal(); lit.Text = "<p style=\"color:red\">Widget " + widget.InnerText + " not found.<p>"; lit.Text += ex.Message; lit.Text += "<a class=\"delete\" href=\"javascript:void(0)\" onclick=\"BlogEngine.widgetAdmin.removeWidget('" + widget.Attributes["id"].InnerText + "');return false\" title=\"" + Resources.labels.delete + " widget\">X</a>"; this.Controls.Add(lit); } } }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { int articleId = actionContext.RouteData.GetPost(); var viewModel = new ArticleDetailViewModel(); if (articleId != 0) { viewModel.Current = _articleService.Get(articleId); if (viewModel.Current != null) { viewModel.Current.Counter = (viewModel.Current.Counter ?? 0) + 1; _articleService.Update(viewModel.Current); viewModel.Prev = _articleService.GetPrev(viewModel.Current); viewModel.Next = _articleService.GetNext(viewModel.Current); } } if (viewModel.Current == null) { foreach (var item in _articleService.Get().AsQueryable().OrderByDescending(m => m.ID).Take(1)) { viewModel.Current = item; } } if (viewModel.Current == null) { viewModel.Current = new ArticleEntity { Title = "文章明细组件使用说明", ImageUrl = "~/Plugins/ZKEACMS.Article/Content/Image/Example.png", ArticleContent = "<p>如上图所示,该组件需要一个<code>文章列表组件</code>组合使用,您需要在其它页面添加一个文章列表组件并链接过来,然后点击文章列表中的文章,该组件就可正常显示文章的内容</p>", CreatebyName = "ZKEASOFT" }; } var layout = actionContext.HttpContext.GetLayout(); layout.Page.MetaKeyWorlds = viewModel.Current.MetaKeyWords; layout.Page.MetaDescription = viewModel.Current.MetaDescription; layout.Page.Title = viewModel.Current.Title; return(widget.ToWidgetViewModelPart(viewModel)); }
/// <summary> /// Saves the new widget to the XML file. /// </summary> /// <param name="widget"> /// The widget to add. /// </param> /// <param name="zone"> /// The zone a widget is being added to. /// </param> private void SaveNewWidget(WidgetBase widget, string zone) { var doc = this.GetXmlDocument(zone); XmlNode node = doc.CreateElement("widget"); node.InnerText = widget.Name; var id = doc.CreateAttribute("id"); id.InnerText = widget.WidgetId.ToString(); if (node.Attributes != null) { node.Attributes.Append(id); } var title = doc.CreateAttribute("title"); title.InnerText = widget.Title; if (node.Attributes != null) { node.Attributes.Append(title); } var show = doc.CreateAttribute("showTitle"); show.InnerText = "True"; if (node.Attributes != null) { node.Attributes.Append(show); } var widgets = doc.SelectSingleNode("widgets"); if (widgets != null) { widgets.AppendChild(node); } this.SaveXmlDocument(doc, zone); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { int articleId = actionContext.RouteData.GetPost(); var viewModel = new ArticleDetailViewModel(); if (articleId != 0) { viewModel.Current = _articleService.Get(articleId); if (viewModel.Current != null) { _articleService.IncreaseCount(viewModel.Current); viewModel.Prev = _articleService.GetPrev(viewModel.Current); viewModel.Next = _articleService.GetNext(viewModel.Current); } } if (viewModel.Current == null && ApplicationContext.IsAuthenticated) { foreach (var item in _articleService.Get().AsQueryable().OrderByDescending(m => m.ID).Take(1)) { viewModel.Current = item; } } if (viewModel.Current == null) { actionContext.NotFoundResult(); } else { var layout = actionContext.HttpContext.GetLayout(); if (layout != null && layout.Page != null) { layout.Page.MetaKeyWorlds = viewModel.Current.MetaKeyWords; layout.Page.MetaDescription = viewModel.Current.MetaDescription; layout.Page.Title = viewModel.Current.Title; } } return(widget.ToWidgetViewModelPart(viewModel)); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { int productId = actionContext.RouteData.GetPost(); ProductEntity product = null; if (productId != 0) { product = actionContext.RouteData.GetProduct(productId) ?? _productService.Get(productId); if (product != null && product.Url.IsNotNullAndWhiteSpace() && actionContext.RouteData.GetProductUrl().IsNullOrWhiteSpace()) { actionContext.RedirectTo($"{actionContext.RouteData.GetPath()}/{product.Url}.html", true); } } if (product == null && ApplicationContext.IsAuthenticated) { product = _productService.Get().OrderByDescending(m => m.ID).FirstOrDefault(); if (product != null) { product = _productService.Get(product.ID); } } if (product == null) { actionContext.NotFoundResult(); } if (product != null) { var layout = actionContext.HttpContext.GetLayout(); if (layout != null && layout.Page != null) { var page = layout.Page; page.MetaDescription = product.SEODescription; page.MetaKeyWorlds = product.SEOKeyWord; page.Title = product.SEOTitle ?? product.Title; } } return(widget.ToWidgetViewModelPart(product ?? new ProductEntity())); }
public override WidgetPart Display(WidgetBase widget, HttpContextBase httpContext) { long productId = 0; long.TryParse(httpContext.Request.QueryString["id"], out productId); var service = ServiceLocator.Current.GetInstance <IProductService>(); var product = service.Get(productId) ?? new ProductEntity { Title = "产品明细组件使用说明", ImageUrl = "~/Modules/Product/Content/Image/Example.png", ProductContent = "<p>如上图所示,该组件需要一个<code>产品列表组件</code>组合使用,您需要在其它页面添加一个产品列表组件并链接过来,然后点击产品列表中的产品,该组件就可正常显示产品的内容</p>", CreatebyName = "ZKEASOFT" }; var page = httpContext.GetLayout().Page; page.MetaDescription = product.SEODescription; page.MetaKeyWorlds = product.SEOKeyWord; page.Title = product.SEOTitle ?? product.Title; return(widget.ToWidgetPart(product)); }
public void Visit(QuestionUnit node) { WidgetBase unitWrapper = _widgetFactory.GetWidget(node, ReferenceTables.GetValue(node.Identifier)); unitWrapper.Visibility = _parentExpressionDidNotEvaluate ? Visibility.Collapsed : Visibility.Visible; int index = _elementsToDisplay.ToList().FindIndex(elem => elem.Unit.Identifier == unitWrapper.Unit.Identifier); if (index < 0) { INotifyPropertyChanged nodeValue = node.Value as INotifyPropertyChanged; if (nodeValue != null) { nodeValue.PropertyChanged += (sender, args) => _rebuildMethod(); } _elementsToDisplay.Add(unitWrapper); } else { _elementsToDisplay[index].Visibility = unitWrapper.Visibility; } }
public override void AddWidget(WidgetBase widget) { base.AddWidget(widget); var item = widget as CarouselWidget; if (item.CarouselItems != null && item.CarouselItems.Any()) { item.CarouselItems.Each(m => { if (m.ActionType != ActionType.Delete) { _carouselItemService.Add(new CarouselItemEntity { CarouselID = m.CarouselID, CarouselWidgetID = item.ID, TargetLink = m.TargetLink, ImageUrl = m.ImageUrl, Status = m.Status }); } }); } }
public override WidgetPart Display(WidgetBase widget, ControllerContext controllerContext) { var navs = ServiceLocator.Current.GetInstance <INavigationService>().Get(new DataFilter().OrderBy("DisplayOrder", OrderType.Ascending)).Where(m => m.Status == (int)RecordStatus.Active); string path = "~" + controllerContext.HttpContext.Request.Path.ToLower(); NavigationEntity current = null; int length = 0; foreach (var navigationEntity in navs) { if (navigationEntity.Url.IsNotNullAndWhiteSpace() && path.StartsWith(navigationEntity.Url.ToLower()) && length < navigationEntity.Url.Length) { current = navigationEntity; length = navigationEntity.Url.Length; } } if (current != null) { current.IsCurrent = true; } return(widget.ToWidgetPart(new NavigationWidgetViewModel(navs, widget as NavigationWidget))); }
public ActionResult Create(WidgetBase widget, string ReturnUrl) { if (!ModelState.IsValid) { return View(widget); } widget.CreateServiceInstance().AddWidget(widget); if (widget.ActionType == ActionType.Continue) { return RedirectToAction("Edit", new { widget.ID, ReturnUrl }); } else if (!ReturnUrl.IsNullOrEmpty()) { return Redirect(ReturnUrl); } else if (!widget.PageID.IsNullOrEmpty()) { return RedirectToAction("Design", "Page", new { module = "Common", ID = widget.PageID }); } else { return RedirectToAction("LayoutWidget", "Layout", new { module = "Common" }); } }
public override WidgetPart Display(WidgetBase widget, HttpContextBase httpContext) { var currentWidget = widget as ArticleListWidget; var articleTypeService = ServiceLocator.Current.GetInstance <IArticleTypeService>(); var categoryEntity = articleTypeService.Get(currentWidget.ArticleTypeID); int pageIndex = 0; int ac = 0; int.TryParse(httpContext.Request.QueryString["ac"], out ac); int.TryParse(httpContext.Request.QueryString["p"], out pageIndex); var filter = new DataFilter(); filter.Where("IsPublish", OperatorType.Equal, true); filter.OrderBy("CreateDate", OrderType.Descending); var articleService = ServiceLocator.Current.GetInstance <IArticleService>(); var page = new Pagination { PageIndex = pageIndex, PageSize = currentWidget.PageSize ?? 20 }; if (ac != 0) { filter.Where("ArticleTypeID", OperatorType.Equal, ac); } else { filter.Where("ArticleTypeID", OperatorType.Equal, currentWidget.ArticleTypeID); } return(widget.ToWidgetPart(new ArticleListWidgetViewModel { Articles = currentWidget.IsPageable ? articleService.Get(filter, page) : articleService.Get(filter), Widget = currentWidget, Pagin = page, CategoryTitle = categoryEntity == null ? "" : categoryEntity.Title, IsPageable = currentWidget.IsPageable })); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { var navs = _navigationService.GetAll() .Where(m => m.Status == (int)RecordStatus.Active).OrderBy(m => m.DisplayOrder); string path = "~" + actionContext.RouteData.GetPath(); NavigationEntity current = null; int length = 0; foreach (var navigationEntity in navs) { if (navigationEntity.Url.IsNotNullAndWhiteSpace() && path.StartsWith(navigationEntity.Url.ToLower()) && length < navigationEntity.Url.Length) { current = navigationEntity; length = navigationEntity.Url.Length; } } if (current != null) { current.IsCurrent = true; } return(widget.ToWidgetViewModelPart(new NavigationWidgetViewModel(navs, widget as NavigationWidget))); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { int productId = actionContext.RouteData.GetPost(); ProductEntity product = null; if (productId != 0) { product = _productService.Get(productId); } if (product == null) { foreach (var item in _productService.Get().AsQueryable().OrderByDescending(m => m.ID).Take(1)) { product = item; } } if (product == null) { product = new ProductEntity { Title = "产品明细组件使用说明", ImageUrl = "~/Plugins/ZKEACMS.Product/Content/Image/Example.png", ProductContent = "<p>如上图所示,该组件需要一个<code>产品列表组件</code>组合使用,您需要在其它页面添加一个产品列表组件并链接过来,然后点击产品列表中的产品,该组件就可正常显示产品的内容</p>", CreatebyName = "ZKEASOFT" }; } var page = actionContext.HttpContext.GetLayout().Page; page.MetaDescription = product.SEODescription; page.MetaKeyWorlds = product.SEOKeyWord; page.Title = product.SEOTitle ?? product.Title; return(widget.ToWidgetViewModelPart(product)); }
public override WidgetPart Display(WidgetBase widget, HttpContextBase httpContext) { var cWidget = widget as CarouselWidget; return(cWidget.ToWidgetPart(new CarouselService().Get(cWidget.CarouselID))); }
private static void BuildStyles(WidgetBase widget) { widget.Styles.Definition.Add(new NSoft.NFramework.FusionCharts.FontStyle("myValueFont") { BgColor = "#F1F1F1".FromHtml(), BorderColor = "#999999".FromHtml() }); widget.Styles.Application.Add(new ApplyElement { ToObject = "Value", Styles = "myValueFont" }); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { var currentWidget = widget as ArticleListWidget; var categoryEntity = _articleTypeService.Get(currentWidget.ArticleTypeID); int pageIndex = actionContext.RouteData.GetPage(); int cate = actionContext.RouteData.GetCategory(); var pagin = new Pagination { PageIndex = pageIndex, PageSize = currentWidget.PageSize ?? 20, OrderByDescending = "PublishDate" }; IEnumerable <ArticleEntity> articles; Expression <Func <ArticleEntity, bool> > filter = null; if (cate != 0) { filter = m => m.IsPublish && m.ArticleTypeID == cate; } else { var ids = _articleTypeService.Get(m => m.ID == currentWidget.ArticleTypeID || m.ParentID == currentWidget.ArticleTypeID).Select(m => m.ID).ToList(); if (ids.Any()) { filter = m => m.IsPublish && ids.Contains(m.ArticleTypeID ?? 0); } else { filter = m => m.IsPublish && m.ArticleTypeID == currentWidget.ArticleTypeID; } } if (currentWidget.IsPageable) { articles = _articleService.Get(filter, pagin); } else { articles = _articleService.Get().Where(filter).OrderByDescending(m => m.PublishDate).ToList(); } var currentArticleType = _articleTypeService.Get(cate == 0 ? currentWidget.ArticleTypeID : cate); if (currentArticleType != null) { var layout = actionContext.HttpContext.GetLayout(); if (layout != null && layout.Page != null) { var page = layout.Page; //page.Title = (page.Title ?? "") + " - " + currentArticleType.Title; page.Title = page.Title.IsNullOrWhiteSpace() ? currentArticleType.Title : $"{page.Title} - {currentArticleType.Title}"; } } return(widget.ToWidgetViewModelPart(new ArticleListWidgetViewModel { Articles = articles, Widget = currentWidget, Pagin = pagin, CategoryTitle = categoryEntity == null ? "" : categoryEntity.Title, IsPageable = currentWidget.IsPageable })); }
/// <summary> /// Defines the items in the ComboBox /// </summary> /// <param name="addAction">The add action.</param> /// <example> /// <code lang="CS"> /// <%= Html.Telerik().ComboBox() /// .Name("ComboBox") /// .AddItem(items => /// { /// items.Text("First Item"); /// }) /// %> /// </code> /// </example> public PanelBuilder AddItem(WidgetBase widget) { Component.Items.Add(widget); return(this); }
private static void BuildAlerts(WidgetBase widget) { // MP3 로 경고음을 줄 수 있다. widget.Alerts.Add(new AlertElement { MinValue = 0, MaxValue = 75, Action = AlertActionKind.PlaySound, Param = "alerts/Waterloo.mp3" }); widget.Alerts.Add(new AlertElement { MinValue = 0, MaxValue = 75, Action = AlertActionKind.ShowAnnotation, Param = "GrpRED" }); widget.Alerts.Add(new AlertElement { MinValue = 75, MaxValue = 90, Action = AlertActionKind.ShowAnnotation, Param = "GrpYELLOW" }); widget.Alerts.Add(new AlertElement { MinValue = 90, MaxValue = 100, Action = AlertActionKind.ShowAnnotation, Param = "GrpGREEN" }); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { return(widget.ToWidgetViewModelPart(new MessageEntity())); }
private void SetPreView(WidgetBase sett) { var type = sett.CtrlType; var viewType = this.ViewTypeStr; try { WidgetCtrlBase ctrl = null; var guiID = Guid.NewGuid().ToString(); if (type == "chart") ctrl = this.LoadControl("../UserControls/wcChart.ascx") as wcChart; else if (type == "gauge") { var gaugeType = Helpers.ToEnum<GaugeType>(viewType); switch (gaugeType) { case GaugeType.CircleFull: ctrl = this.LoadControl("../UserControls/wcFullCGauge.ascx") as wcFullCGauge; break; case GaugeType.CircleThreeFour: ctrl = this.LoadControl("../UserControls/wcThreeFourCGauge.ascx") as wcThreeFourCGauge; break; case GaugeType.CircleHalf: ctrl = this.LoadControl("../UserControls/wcHalfCGauge.ascx") as wcHalfCGauge; break; case GaugeType.CircleQuaterLeft: case GaugeType.CircleQuaterRight: ctrl = this.LoadControl("../UserControls/wcQuaterCGauge.ascx") as wcQuaterCGauge; break; case GaugeType.LinearHorizontal: case GaugeType.LinearVertical: ctrl = this.LoadControl("../UserControls/wcLGauge.ascx") as wcLGauge; break; } } else if (type == "grid") ctrl = this.LoadControl("../UserControls/wcGrid.ascx") as wcGrid; ctrl.Sett = sett; ctrl.ID = string.Format("preview_{1}_{0}", guiID, type); this.ctrlPreView.Controls.Clear(); this.ctrlPreView.Controls.Add(ctrl); } catch { } }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { return(widget.ToWidgetViewModelPart(_formService.Get((widget as FormWidget).FormID))); }
public override WidgetViewModelPart Display(WidgetBase widget, ActionContext actionContext) { return(widget.ToWidgetViewModelPart(_commentsService.Get(m => m.PagePath == actionContext.HttpContext.Request.Path.Value && m.Status == (int)RecordStatus.Active))); }
public PartialViewResult AppendWidget(WidgetBase widget) { var widgetPart = _widgetService.ApplyTemplate(widget, HttpContext); return(PartialView("DesignWidget", new DesignWidgetViewModel(widgetPart, widget.PageID))); }
public JsonResult SaveWidgetZone(WidgetBase widget) { new WidgetService().Update(widget, new Data.DataFilter(new List<string> { "ZoneID", "Position" }).Where<WidgetBase>(n => n.ID, OperatorType.Equal, widget.ID)); return Json(true); }
public override WidgetBase GetWidget(WidgetBase widget) { Models.SectionWidget sectionWidget = base.GetWidget(widget) as Models.SectionWidget; return(InitSectionWidget(sectionWidget)); }
public WidgetBaseTests() { _target = new WidgetBase(); }
/// <summary> /// Create and return a new <see cref="IterationTrackParameterView"/> /// </summary> /// <param name="widgetViewModel">The <see cref="WidgetBase"/> where a View has to be create for.</param> /// <returns>A new <see cref="IterationTrackParameterView"/></returns> private IterationTrackParameterView GetIterationTrackWidget(WidgetBase widgetViewModel) { return(new IterationTrackParameterView { DataContext = widgetViewModel }); }
/// <summary> /// Saves the new widget to the XML file. /// </summary> /// <param name="widget">The widget to add.</param> /// <param name="zone">The zone a widget is being added to.</param> private void SaveNewWidget(WidgetBase widget, string zone) { XmlDocument doc = GetXmlDocument(zone); XmlNode node = doc.CreateElement("widget"); node.InnerText = widget.Name; XmlAttribute id = doc.CreateAttribute("id"); id.InnerText = widget.WidgetID.ToString(); node.Attributes.Append(id); XmlAttribute title = doc.CreateAttribute("title"); title.InnerText = widget.Title; node.Attributes.Append(title); XmlAttribute show = doc.CreateAttribute("showTitle"); show.InnerText = "True"; node.Attributes.Append(show); doc.SelectSingleNode("widgets").AppendChild(node); SaveXmlDocument(doc, zone); }
public IActionResult Paste(WidgetBase widget) { widget.ID = _cookie.GetValue <string>(Const.CopyWidgetCookie); return(AppendWidget(widget)); }
public override WidgetPart Display(WidgetBase widget, ControllerContext controllerContext) { return(widget.ToWidgetPart(new MessageEntity())); }
public override void AddWidget(WidgetBase widget) { base.AddWidget(widget); DismissRelatedPageUrls(); }
public WidgetViewModelPart(WidgetBase widget, object viewModel) { Widget = widget; ViewModel = viewModel; }