/// <summary> /// Instantiates the class /// </summary> /// <param name="cc">Client context for the web holding the source page</param> public QuickLinksTransformator(ClientContext cc, IList <ILogObserver> logObservers = null) : base() { if (logObservers != null) { foreach (var observer in logObservers) { base.RegisterObserver(observer); } } this.clientContext = cc; this.properties = new QuickLinksWebPartProperties(); cc.Web.EnsureProperties(p => p.Id, p => p.Url); cc.Site.EnsureProperties(p => p.Id, p => p.RootWeb); cc.Site.RootWeb.EnsureProperty(p => p.Url); }
/// <summary> /// Instantiates the class /// </summary> /// <param name="cc">Client context for the web holding the source page</param> public QuickLinksTransformator(ClientContext cc) { this.clientContext = cc; this.properties = new QuickLinksWebPartProperties(); cc.Web.EnsureProperties(p => p.Id, p => p.Url); cc.Site.EnsureProperties(p => p.Id, p => p.RootWeb); cc.Site.RootWeb.EnsureProperties(p => p.Url); // base properties setup this.properties.LayoutId = QuickLinksLayout.List.ToString(); this.properties.ShouldShowThumbnail = true; this.properties.IsMigrated = true; this.properties.HideWebPartWhenEmpty = true; this.properties.DataProviderId = "QuickLinks"; this.properties.WebId = cc.Web.Id.ToString(); this.properties.SiteId = cc.Site.Id.ToString(); this.properties.ButtonLayoutOptions = new ButtonLayoutOptions() { ShowDescription = false, ButtonTreatment = ButtonTreatment.Outline, IconPositionType = IconPositionType.IconToLeft, TextAlignmentVertical = ContentAlignment.Center, TextAlignmentHorizontal = ContentAlignment.Center, LinesOfText = LinesOfText.TwoLines, }; this.properties.ListLayoutOptions = new ListLayoutOptions() { ShowDescription = true, ShowIcon = true, }; this.properties.WaffleLayoutOptions = new WaffleLayoutOptions() { IconSize = IconSize.Medium, OnlyShowThumbnail = true, }; }