当前位置: 首页>>代码示例>>C#>>正文


C# UrlString.Add方法代码示例

本文整理汇总了C#中UrlString.Add方法的典型用法代码示例。如果您正苦于以下问题:C# UrlString.Add方法的具体用法?C# UrlString.Add怎么用?C# UrlString.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UrlString的用法示例。


在下文中一共展示了UrlString.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 /// <summary>
 /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
 /// </summary>
 /// <param name="context">Context of Call</param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         var itemId = context.Parameters[0];
         if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId))
         {
             SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')");
         }
         else
         {
             var urlString = new UrlString("/sitecore/shell/sitecore/content/Applications/Content%20Editor.aspx");
             urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId);
             TrackOpenTab(context);
             context.Items[0].Uri.AddToUrlString(urlString);
             UIUtil.AddContentDatabaseParameter(urlString);
             urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
             urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}");
             var language = context.Parameters["la"].IsNull() ? Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName : context.Parameters["la"];
             urlString.Add("la", language);
             AddLatestVersionToUrlString(urlString, itemId, language);
             SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(itemId).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = itemId, Closeable = true, Activate = Util.Constants.SettingsItem.Fields[Util.Constants.OpenSearchResult].Value == "New Tab Not Selected" ? false : true }.ToString());
         }
     }
 }
开发者ID:katebutenko,项目名称:Sitecore-Item-Buckets,代码行数:30,代码来源:AddTab.cs

示例2: Execute

        /// <summary>
        /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
        /// </summary>
        /// <param name="context">Context of Call</param>
        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            if (context.Items.Length == 1)
            {
                var itemId = context.Parameters[0];
                //if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId))
                //{
                //    SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')");
                //}
                //else
                //{

                      var urlString = new UrlString("/sitecore%20modules/Shell/Sitecore/ItemBuckets/ShowResult.aspx");
                      urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId);

                      context.Items[0].Uri.AddToUrlString(urlString);
                      UIUtil.AddContentDatabaseParameter(urlString);
                      urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
                      urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}");
                      var language = context.Parameters["la"].IsNull() ? Sitecore.Context.Language.CultureInfo.TwoLetterISOLanguageName : context.Parameters["la"];
                      urlString.Add("la", language);

            //SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = "Another Search", Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = Id, Closeable = true, Activate = true }.ToString());

                    SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchblanktab", Header = "Search " + DateTime.Now.ToLongTimeString(), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = new Random().Next(0, 99999999).ToString(), Closeable = true, Activate = true }.ToString());
               // }
            }
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:33,代码来源:AddBlankSearch.cs

示例3: Execute

 /// <summary>
 /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
 /// </summary>
 /// <param name="context">Context of Call</param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         string s = context.Parameters[0];
         if (s.IsGuid())
         {
             if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(s))
             {
                 SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + s + "')");
             }
             else
             {
                 UrlString urlString = new UrlString(Util.Constants.ContentEditorRawUrlAddress);
                 urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, s);
                 TrackOpenTab(context);
                 context.Items[0].Uri.AddToUrlString(urlString);
                 UIUtil.AddContentDatabaseParameter(urlString);
                 urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
                 urlString.Add("il", "0");
                 urlString.Add(Util.Constants.RibbonQueryStringKeyName, "{D3A2D76F-02E6-49DE-BE90-D23C9771DC8D}");
                 string str3 = context.Parameters["la"] ?? Context.Language.CultureInfo.TwoLetterISOLanguageName;
                 urlString.Add("la", str3);
                 AddLatestVersionToUrlString(urlString, s, str3);
                 SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(s).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = s, Closeable = true, Activate = Util.Constants.SettingsItem[Util.Constants.OpenSearchResult] != "New Tab Not Selected" }.ToString());
             }
         }
     }
 }
开发者ID:katebutenko,项目名称:Sitecore-Item-Buckets-6.6-NET4,代码行数:34,代码来源:AddTab.cs

示例4: LoadContentEditor

        protected void LoadContentEditor(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            var parameters = new UrlString();
            parameters.Add("id", args.Parameters["id"]);
            parameters.Add("fo", args.Parameters["id"]);
            Windows.RunApplication("Content Editor", parameters.ToString());
        }
开发者ID:ostat,项目名称:Console,代码行数:9,代码来源:PowerShellConsole.cs

示例5: ProcessRecord

        protected override void ProcessRecord()
        {
            LogErrors(() =>
            {
                string response = null;
                if (!string.IsNullOrEmpty(Url))
                {
                    response = JobContext.ShowModalDialog(Url, WidthString, HeightString);
                }
                else if (!string.IsNullOrEmpty(Control))
                {
                    UrlString url = new UrlString(UIUtil.GetUri("control:" + Control));
                    url["te"] = Title ?? "Sitecore";

                    if (Parameters != null)
                    {
                        foreach (string key in Parameters.Keys)
                        {
                            url.Add(key, WebUtil.SafeEncode(Parameters[key].ToString()));
                        }
                    }

                    var message = new ShowModalDialogPsMessage(url.ToString(), WidthString, HeightString, HandleParameters);
                    PutMessage(message);
                    response = (string)GetSheerResult(message);

                }
                WriteObject(response);
            });
        }
开发者ID:ostat,项目名称:Console,代码行数:30,代码来源:ShowModalDialogCommand.cs

示例6: Execute

        public override void Execute(CommandContext context)
        {
            var urlString = new UrlString(UIUtil.GetUri("control:PowerShellExternalView"));
            var keys = context.Parameters.AllKeys;

            using (var session = ScriptSessionManager.GetSession(string.Empty, ApplicationNames.Default, false))
            {
                session.ExecuteScriptPart("");
                foreach (var key in keys)
                {
                    var param =
                        context.Parameters[key]
                            .Replace("{spe}", GetType().Assembly.GetName().Version.ToString())
                            .Replace("{ps}", ScriptSession.PsVersion.Major + "." + ScriptSession.PsVersion.Minor)
                            .Replace("{sc}",
                                SitecoreVersion.Current.Major + "." +
                                SitecoreVersion.Current.Minor);
                    urlString.Add(key, param);
                }

            }

            var width = keys.Contains("spe_w", StringComparer.OrdinalIgnoreCase)
                ? context.Parameters["spe_w"]
                : keys.Contains("width", StringComparer.OrdinalIgnoreCase) ? context.Parameters["width"] : "800";

            var height = keys.Contains("spe_h", StringComparer.OrdinalIgnoreCase)
                ? context.Parameters["spe_h"]
                : keys.Contains("height", StringComparer.OrdinalIgnoreCase) ? context.Parameters["height"] : "800";

            SheerResponse.ShowModalDialog(urlString.ToString(), width, height);
        }
开发者ID:GuitarRich,项目名称:Console,代码行数:32,代码来源:ShowExternalPage.cs

示例7: ShowUI

 /// <summary>
 ///     Shows a confirmation dialog.
 /// </summary>
 protected override void ShowUI()
 {
     var resultSig = Guid.NewGuid().ToString();
     HttpContext.Current.Session[resultSig] = Html;
     var urlString = new UrlString(UIUtil.GetUri("control:PowerShellResultViewerText"));
     urlString.Add("sid", resultSig);
     SheerResponse.ShowModalDialog(urlString.ToString(), Width, Height);
 }
开发者ID:sobek85,项目名称:Console,代码行数:11,代码来源:ShowResultsMessage.cs

示例8: Run

        /// <summary>
        /// Runs the pipeline.
        /// </summary>
        /// <param name="args">The arguments.</param>
        protected void Run(ClientPipelineArgs args)
        {
            string id = args.Parameters["id"];
            string language = args.Parameters["language"];
            string version = args.Parameters["version"];

            Item item = Context.ContentDatabase.Items[id, Language.Parse(language), Sitecore.Data.Version.Parse(version)];
            Error.AssertItemFound(item);

            if (!SheerResponse.CheckModified())
            {
                return;
            }

            if (args.IsPostBack)
            {
                if (args.Result != "undefined")
                {
                    Sitecore.Web.UI.Sheer.SheerResponse.Download(args.Result);
                }
            }

            else
            {
                UrlString urlString = new UrlString(UIUtil.GetUri("control:QuickPackage"));

                urlString.Add("id", item.ID.ToString());
                urlString.Add("la", item.Language.ToString());
                urlString.Add("vs", item.Version.ToString());

                ModalDialogOptions options = new ModalDialogOptions(urlString.ToString())
                {
                    MinWidth = "550px",
                    Height = "250px",
                    MinHeight = "250px",
                    Response = true
                };

                SheerResponse.ShowModalDialog(options);
                args.WaitForPostBack();
            }
        }
开发者ID:ReoKzK,项目名称:Sitecore.SharedSource.QuickPackage,代码行数:46,代码来源:QuickPackage.cs

示例9: SetLocation

 /// <summary>
 /// Refresh the content tree with the new item opened
 /// </summary>
 /// <param name="item">Item that is being added</param>
 /// <remarks>You will need to override this if you are running without HttpContext e.g. Unit Tests</remarks>
 protected virtual void SetLocation(Item item)
 {
     if (HttpContext.Current.IsNotNull() && Context.ClientPage.IsNotNull()) //clientpage is never null?
     {
         var urlString = new UrlString(Constants.ContentEditorRawUrlAddress);
         urlString.Add(Constants.OpenItemEditorQueryStringKeyName, item.ID.ToString());
         item.Uri.AddToUrlString(urlString);
         UIUtil.AddContentDatabaseParameter(urlString);
         SheerResponse.SetLocation(urlString.ToString());
     }
 }
开发者ID:csteeg,项目名称:Sitecore-Item-Buckets,代码行数:16,代码来源:AddFromTemplateCommand.cs

示例10: SetLocation

 /// <summary>
 /// Refresh the content tree with the new item opened.
 /// </summary>
 /// <param name="item">Item that is being added.</param>
 /// <remarks>You will need to override this if you are running without HttpContext e.g. Unit Tests.</remarks>
 protected virtual void SetLocation(Item item)
 {
   if ((Context.GetSiteName() == "shell") && Context.ClientPage.IsNotNull() && !Client.Site.Notifications.Disabled)
   {
     var urlString = new UrlString(Constants.ContentEditorRawUrlAddress);
     urlString.Add(Constants.OpenItemEditorQueryStringKeyName, item.ID.ToString());
     item.Uri.AddToUrlString(urlString);
     UIUtil.AddContentDatabaseParameter(urlString);
     SheerResponse.SetLocation(urlString.ToString());
   }
 }
开发者ID:katebutenko,项目名称:Sitecore-Item-Buckets-6.6-NET4,代码行数:16,代码来源:AddFromTemplateCommand.cs

示例11: Execute

 /// <summary>
 /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
 /// </summary>
 /// <param name="context">Context of Call</param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         var itemId = context.Parameters[0];
         if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(itemId))
         {
             SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + itemId + "')");
         }
         else
         {
             var urlString = new UrlString(Util.Constants.ContentEditorRawUrlAddress);
             urlString.Add(Util.Constants.OpenItemEditorQueryStringKeyName, itemId);
             context.Items[0].Uri.AddToUrlString(urlString);
             UIUtil.AddContentDatabaseParameter(urlString);
             urlString.Add(Util.Constants.ModeQueryStringKeyName, "preview");
             AddLatestVersionToUrlString(urlString, itemId);
             SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(itemId).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = itemId, Closeable = true, Activate = false }.ToString());
         }
     }
 }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:26,代码来源:AddSilentTab.cs

示例12: Execute

 /// <summary>
 /// Add a new Content Editor Tab to Content Editor so that users can search for hidden content
 /// </summary>
 /// <returns>Void</returns>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.Items.Length == 1)
     {
         if (WebUtil.GetFormValue("scEditorTabs").Contains("contenteditor:launchtab") && WebUtil.GetFormValue("scEditorTabs").Contains(context.Parameters[0]))
         {
             SheerResponse.Eval("scContent.onEditorTabClick(null, null, '" + context.Parameters[0] + "')");
         }
         else
         {
             var urlString = new UrlString("/sitecore/shell/sitecore/content/Applications/Content%20Editor.aspx");
             urlString.Add("fo", context.Parameters[0]);
             context.Items[0].Uri.AddToUrlString(urlString);
             UIUtil.AddContentDatabaseParameter(urlString);
             //Open the new tab without the content tree showing
             urlString.Add("mo", "preview");
             AddLatestVersionToUrlString(context, urlString);
             SheerResponse.Eval(new ShowEditorTab { Command = "contenteditor:launchtab", Header = Translate.Text(Context.ContentDatabase.GetItem(context.Parameters[0]).Name), Icon = Images.GetThemedImageSource("Applications/16x16/text_view.png"), Url = urlString.ToString(), Id = context.Parameters[0], Closeable = true, Activate = false}.ToString());
             SheerResponse.Eval("scContent.onEditorTabClick('scEditorTabHeaderActive', 'scEditorTabHeaderActive', '" + "{59F53BBB-D1F5-4E38-8EBA-0D73109BB59B}" + "')");
         }
     }
 }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:27,代码来源:AddSlientTab.cs

示例13: Execute

        /// <summary>
        /// 	Overriding the Execute method that Sitecore calls.
        /// </summary>
        /// <param name = "context"></param>
        public override void Execute(CommandContext context)
        {
            //check to see if there is an item selected)
            if (context.Items.Length != 1) return;

            //only use on authoring environment
            Item currentItem = context.Items[0];
            if (currentItem == null || currentItem.Database.Name.ToLower() != "master") return;

            //get settings item
            ItemComparerSettingsItem settingsItem = ItemComparerSettingsItem.GetSettingsItem();
            if (settingsItem == null || settingsItem.DatabasetoCompareAgainst.TargetItem == null) return;

            PublishingTargetItem publishingTargetItem = settingsItem.DatabasetoCompareAgainst.TargetItem;
            if (publishingTargetItem.TargetDatabaseItem == null) return;

            Database targetDatabase = publishingTargetItem.TargetDatabaseItem;

            //Build the url for the control
            string language = currentItem.Language.ToString();
            string version = currentItem.Version.ToString();

            // Add parameters to the UrlString
            UrlString parameters = new UrlString();
            parameters.Add("id", currentItem.ID.ToString());
            parameters.Add("fo", currentItem.ID.ToString());
            parameters.Add("la", language);
            parameters.Add("vs", version);
            parameters.Add("sc_content", targetDatabase.Name);

            // Run function that initializes the Content Editor; pass in necessary parameters
            Item contentEditor = Database.GetDatabase("core").GetItem("{7EADA46B-11E2-4EC1-8C44-BE75784FF105}");
            if (contentEditor == null) return;

            Sitecore.Shell.Framework.Windows.RunApplication(contentEditor, "/~/icon/People/16x16/cubes_blue.png",
                                                            "Item Comparer (" + targetDatabase.Name + ")", parameters.ToString());
        }
开发者ID:Velir,项目名称:Sitecore-PublishedItemComparer,代码行数:41,代码来源:TargetDatabaseCommand.cs

示例14: Run

        protected void Run(ClientPipelineArgs args)
        {
            string var = args.Parameters["rid"];
            Util.AssertNotNull(var);
            if (!args.IsPostBack)
            {
                using (new SecurityDisabler())
                {
                    UrlString urlString = new UrlString("/sitecore/shell/~/xaml/RecipientListManagement.RecipientsLists.Lists.Creation.AddSitecoreRoles.SelectRoles.aspx");
                    new UrlHandle().Add(urlString);
                    foreach (string str in args.Parameters.AllKeys)
                    {
                        urlString.Add(str, args.Parameters[str]);
                    }
                    SheerResponse.ShowModalDialog(urlString.ToString(), "600", "650", string.Empty, true);
                    args.WaitForPostBack();
                    return;
                }
            }
            if (args.HasResult)
            {
                ListString roles = new ListString((args.Result == "-") ? string.Empty : args.Result);

                TargetAudience recipientList = Factory.GetTargetAudience(var);
                if ((recipientList != null) && (recipientList.InnerItem != null))
                {
                    IEnumerable<string> enumerable = null;
                    if (recipientList.ExtraOptInList != null)
                    {
                        enumerable = (recipientList.OptInList == null) ? roles : (from role in roles
                                                                                                      where recipientList.OptInList.Roles.All<Role>(x => x.Name != role) && recipientList.ExtraOptInList.Roles.All<Role>(x => x.Name != role)
                                                                                                      select role).ToList<string>() as IEnumerable<string>;
                    }
                    else
                    {
                        enumerable = (recipientList.OptInList == null) ? roles : (from role in roles
                                                                                                      where recipientList.OptInList.Roles.All<Role>(x => x.Name != role)
                                                                                                      select role).ToList<string>() as IEnumerable<string>;
                    }
                    foreach (string str in enumerable)
                    {
                        recipientList.Source.AddRoleToExtraOptIn(str);
                    }
                    NotificationManager.Instance.Notify("MessageFromCommand", new MessageEventArgs("Recipients were imported to the selected list."));
                    NotificationManager.Instance.Notify("RecipientsChanged");
                    NotificationManager.Instance.Notify("RefreshRecipientLists");
                }
            }
        }
开发者ID:katebutenko,项目名称:RecipientListManagement,代码行数:49,代码来源:AddSitecoreRolesToSelectedListCommand.cs

示例15: Execute

        public override void Execute(CommandContext context)
        {
            var itemId = context.Items[0].ID.ToString();
            var itemDb = context.Items[0].Database.Name;
            var item = Factory.GetDatabase(itemDb).GetItem(new ID(itemId));

            var urlString = new UrlString();
            urlString.Append("id", item.ID.ToString());
            urlString.Append("db", itemDb);
            if (!string.IsNullOrEmpty(context.Parameters["frameName"]))
            {
                urlString.Add("pfn", context.Parameters["frameName"]);
            }
            Windows.RunApplication("PowerShell/PowerShellIse", urlString.ToString());
        }
开发者ID:GuitarRich,项目名称:Console,代码行数:15,代码来源:EditPowerShellScript.cs


注:本文中的UrlString.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。