public void AddRendering() { var renderingContainer = LayoutDesignerView.GetRenderingContainer(); if (renderingContainer == null) { return; } var dialog = new SelectRenderingsDialog { DatabaseUri = DatabaseUri, RenderingContainer = renderingContainer, SpeakCoreVersionId = SpeakCoreVersionId }; if (!dialog.ShowDialog()) { return; } Action <IEnumerable <RenderingItem> > getSelectedRenderings = delegate(IEnumerable <RenderingItem> selectedRenderings) { foreach (var rendering in selectedRenderings.Reverse()) { LayoutDesignerView.AddRendering(rendering); } }; dialog.GetSelectedRenderings(getSelectedRenderings); }
private void SetAllowed([NotNull] PlaceholderItem item, IEnumerable <ItemId> selectedItems) { var dialog = new SelectRenderingsDialog(); dialog.Initialize("Set Allowed Placeholders", item.DatabaseUri, selectedItems); if (AppHost.Shell.ShowDialog(dialog) != true) { return; } var itemUri = new ItemUri(item.DatabaseUri, new ItemId(new Guid(item.MetaDataItemId))); ItemModifier.Edit(itemUri, "{E391B526-D0C5-439D-803E-17512EAE6222}", string.Join("|", dialog.SelectedRenderings)); }
public override void Execute([CanBeNull] object parameter) { var context = parameter as LayoutDesignerContext; if (context == null) { return; } var renderingItem = context.SelectedItems.FirstOrDefault() as RenderingItem; if (renderingItem == null) { return; } var dialog = new SelectRenderingsDialog { DatabaseUri = renderingItem.ItemUri.DatabaseUri, RenderingContainer = renderingItem.RenderingContainer, AllowMultipleRenderings = false, SpeakCoreVersionId = context.LayoutDesigner.SpeakCoreVersionId }; if (!dialog.ShowDialog()) { return; } Action <IEnumerable <RenderingItem> > getSelectedRenderings = delegate(IEnumerable <RenderingItem> selectedRenderings) { if (selectedRenderings.Count() != 1) { return; } Action completed = () => context.LayoutDesigner.LayoutDesignerView.UpdateTracking(); renderingItem.ChangeRendering(selectedRenderings.First(), completed); context.LayoutDesigner.Modified = true; }; dialog.GetSelectedRenderings(getSelectedRenderings); }