Esempio n. 1
0
        private string GetFilePath([NotNull] RenderingItem renderingItem, [NotNull] LayoutDesignerContext context)
        {
            Debug.ArgumentNotNull(context, nameof(context));
            Debug.ArgumentNotNull(renderingItem, nameof(renderingItem));

            var filePath = renderingItem.FilePath;

            if (string.IsNullOrEmpty(filePath))
            {
                return(string.Empty);
            }

            if (filePath.StartsWith(@"/"))
            {
                filePath = filePath.Mid(1);
            }

            try
            {
                filePath = Path.Combine(context.LayoutDesigner.DatabaseUri.Site.WebRootPath, filePath);
            }
            catch (ArgumentException ex)
            {
                AppHost.MessageBox(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            return(GetPath(renderingItem, filePath));
        }
Esempio n. 2
0
        private void SelectItemToPreview(LayoutDesignerContext context)
        {
            var dialog = new SelectItemDialog();

            dialog.Initialize("Preview", context.LayoutDesigner.DatabaseUri, "/sitecore/content/Home");
            if (AppHost.Shell.ShowDialog(dialog) != true)
            {
                return;
            }

            Browse(dialog.SelectedItemUri);
        }