protected new void Run(ClientPipelineArgs args)
        {
            Item obj1 = Database.GetItem(ItemUri.Parse(args.Parameters["uri"]));

            if (obj1 == null)
            {
                SheerResponse.Alert("Item not found.");
            }
            else
            {
                string str = obj1.ID.ToString();
                if (args.IsPostBack)
                {
                    if (args.Result != "yes")
                    {
                        return;
                    }
                    Item obj2 = Context.ContentDatabase.GetItem(LinkManager.GetPreviewSiteContext(obj1).StartPath);
                    if (obj2 == null)
                    {
                        SheerResponse.Alert("Start item not found.");
                        return;
                    }
                    str = obj2.ID.ToString();
                }
                else if (!HasPresentationPipeline.Run(obj1))
                {
                    SheerResponse.Confirm("The current item cannot be previewed because it has no layout for the current device.\n\nDo you want to preview the start Web page instead?");
                    args.WaitForPostBack();
                    return;
                }
                SheerResponse.CheckModified(false);
                SiteContext previewSiteContext = LinkManager.GetPreviewSiteContext(obj1);
                if (previewSiteContext == null)
                {
                    SheerResponse.Alert(Translate.Text("Site \"{0}\" not found", Settings.Preview.DefaultSite));
                }
                else
                {
                    WebUtil.SetCookieValue(previewSiteContext.GetCookieKey("sc_date"), string.Empty);
                    PreviewManager.StoreShellUser(Settings.Preview.AsAnonymous);
                    UrlString urlString = new UrlString("/");
                    urlString["sc_itemid"]  = str;
                    urlString["sc_mode"]    = "preview";
                    urlString["sc_compare"] = "true";
                    urlString["sc_lang"]    = obj1.Language.ToString();
                    urlString["sc_site"]    = previewSiteContext.Name;
                    DeviceSimulationUtil.DeactivateSimulators();
                    if (UIUtil.IsChrome())
                    {
                        SheerResponse.Eval("setTimeout(function () { window.open('" + urlString + "', '_blank');}, 0);");
                    }
                    else
                    {
                        SheerResponse.Eval("window.open('" + urlString + "', '_blank');");
                    }
                }
            }
        }
        protected new void Run(ClientPipelineArgs args)
        {
            var contentItem = Database.GetItem(ItemUri.Parse(args.Parameters["uri"]));

            if (contentItem == null)
            {
                SheerResponse.Alert("Item not found.");
            }
            else
            {
                var itemId = contentItem.ID.ToString();
                if (args.IsPostBack)
                {
                    if (args.Result != "yes")
                    {
                        return;
                    }
                    var startItem = Context.ContentDatabase.GetItem(Context.Site.StartPath);
                    if (startItem == null)
                    {
                        SheerResponse.Alert("Start item not found.");
                        return;
                    }
                    if (!HasPresentationPipeline.Run(startItem))
                    {
                        SheerResponse.Alert("The start item cannot be previewed because it has no layout for the current device.\n\nPreview cannot be started.");
                        return;
                    }
                    itemId = startItem.ID.ToString();
                }
                else if (!HasPresentationPipeline.Run(contentItem))
                {
                    SheerResponse.Confirm("The current item cannot be previewed because it has no layout for the current device.\n\nDo you want to preview the start Web page instead?");
                    args.WaitForPostBack();
                    return;
                }
                SheerResponse.CheckModified(false);

                //Dynamically Speaking, we want the site of the item as it relates to a home Item.
                //If not found, fallback to default functionalty.
                var site = DynamicSiteManager.GetSiteContextByContentItem(contentItem) ??
                           Factory.GetSite(Settings.Preview.DefaultSite);
                Assert.IsNotNull(site, "Site \"{0}\" not found", Settings.Preview.DefaultSite);
                WebUtil.SetCookieValue(site.GetCookieKey("sc_date"), string.Empty);
                PreviewManager.StoreShellUser(Settings.Preview.AsAnonymous);
                var webSiteUrl = SiteContext.GetWebSiteUrl();
                webSiteUrl["sc_itemid"] = itemId;
                webSiteUrl["sc_mode"]   = "preview";
                webSiteUrl["sc_lang"]   = contentItem.Language.ToString();
                DeviceSimulationUtil.DeacitvateSimulators();
                SheerResponse.Eval("window.open('" + webSiteUrl + "', '_blank')");
            }
        }
        protected void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull((object)args, "args");
            parentItemID = args.Parameters["itemid"];
            Item itemNotNull = Sitecore.Client.GetItemNotNull(args.Parameters["itemid"], Language.Parse(args.Parameters["language"]));

            if (args.IsPostBack)
            {
                if (!args.HasResult)
                {
                    return;
                }
                string[] strArray    = args.Result.Split(new[] { "||" }, StringSplitOptions.None);
                string   id          = strArray[0];
                string   name        = Uri.UnescapeDataString(strArray[1]);
                string   displayName = Uri.UnescapeDataString(strArray[2]);
                string   metaTitle   = Uri.UnescapeDataString(strArray[3]);
                if (ShortID.IsShortID(id))
                {
                    id = ShortID.Parse(id).ToID().ToString();
                }
                BranchItem branch = Sitecore.Client.ContentDatabase.Branches[id, itemNotNull.Language];
                Assert.IsNotNull((object)branch, typeof(BranchItem));
                this.ExecuteCommand(itemNotNull, branch, name);
                Sitecore.Client.Site.Notifications.Disabled = true;
                Item obj = Context.Workflow.AddItem(name, branch, itemNotNull);
                Sitecore.Client.Site.Notifications.Disabled = false;
                if (obj == null)
                {
                    return;
                }
                this.PolicyBasedUnlock(obj);
                if (!HasPresentationPipeline.Run(obj) || !MainUtil.GetBool(args.Parameters["navigate"], true))
                {
                    WebEditCommand.Reload();
                }
                else
                {
                    UrlOptions  defaultOptions = UrlOptions.DefaultOptions;
                    SiteContext site           = SiteContext.GetSite(string.IsNullOrEmpty(args.Parameters["sc_pagesite"]) ? Sitecore.Web.WebEditUtil.SiteName : args.Parameters["sc_pagesite"]);
                    if (site == null)
                    {
                        return;
                    }
                    string url = string.Empty;
                    using (new SiteContextSwitcher(site))
                    {
                        using (new LanguageSwitcher(obj.Language))
                            url = LinkManager.GetItemUrl(obj, defaultOptions);
                    }
                    WebEditCommand.Reload(new UrlString(url));
                    SheerResponse.Alert("New page item created.");
                }
                HealthIS.Apps.Util.SetDisplayNameAndMetaTitle(obj, displayName, metaTitle);
            }
            else if (!itemNotNull.Access.CanCreate())
            {
                SheerResponse.Alert("You do not have permission to create an item here.");
            }
            else
            {
                UrlString urlString = ResourceUri.Parse("control:CustomAddMasterWebEdit").ToUrlString();
                itemNotNull.Uri.AddToUrlString(urlString);
                SheerResponse.ShowModalDialog(urlString.ToString(), "1200px", "700px", string.Empty, true);
                args.WaitForPostBack();
            }
        }