public ToolBarSplitButton(DropDownCommand command) { if (command == null) { throw new ArgumentNullException("command"); } if (command.Commands.Count == 0) { throw new ArgumentException("There must be at least one command in DropDownCommand.", "command"); } this.command = command; this.CssClass += " SplitButton"; this.contextMenu = new ContextMenu(this.command.Commands); this.contextMenu.CssClass = "hidden"; if (!string.IsNullOrEmpty(this.command.Name)) { this.ID = command.Name; this.contextMenu.ID = command.Name + "_DropDown"; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); DropDownCommand dropDownCommand = base.DropDownCommand; dropDownCommand.AllowAddSubCommandIcon = true; dropDownCommand.Name = "Help"; dropDownCommand.DefaultCommandName = "ContextualHelp"; dropDownCommand.Text = string.Empty; dropDownCommand.ImageAltText = Strings.Help; dropDownCommand.ImageId = CommandSprite.SpriteId.HelpCommand; string arg = HttpUtility.JavaScriptStringEncode(HelpUtil.BuildEhcHref(EACHelpId.Default.ToString())); Command command = new Command(); command.Name = "ContextualHelp"; command.Text = Strings.Help; command.OnClientClick = string.Format("PopupWindowManager.showContextualHelp('{0}', {1});", arg, this.InAdminUI ? "false" : "true"); dropDownCommand.Commands.Add(command); Command command2 = new Command(); command2.Name = "FVA"; command2.Text = Strings.FVAToggleText; command2.ClientCommandHandler = "FVAHelpEnabledToggleCommandHandler"; dropDownCommand.Commands.Add(command2); Command command3 = new Command(); command3.Name = "PerformanceConsole"; command3.Visible = (this.IsInCrossPremise || StringComparer.OrdinalIgnoreCase.Equals("true", WebConfigurationManager.AppSettings["ShowPerformanceConsole"])); command3.Text = Strings.PerformanceConsole; command3.ClientCommandHandler = "ShowPerfConsoleCommandHandler"; dropDownCommand.Commands.Add(command3); Command command4 = new Command(); command4.Name = "CmdletLogging"; command4.Text = Strings.CmdLogButtonText; if (this.IsInCrossPremise) { command4.ClientCommandHandler = "HybridCmdletLoggingCommandHandler"; } else { command4.Visible = EacFlightUtility.GetSnapshotForCurrentUser().Eac.CmdletLogging.Enabled; command4.OnClientClick = "CmdletLoggingNavHelper.OpenCmdletLoggingWindow('CmdletLogging');"; } dropDownCommand.Commands.Add(command4); if (Util.IsDataCenter) { Command command5 = new Command(); command5.Name = "Community"; command5.Text = Strings.Community; command5.OnClientClick = string.Format("PopupWindowManager.showHelpClient('{0}');", HttpUtility.HtmlEncode(HelpUtil.BuildCommunitySiteHref())); dropDownCommand.Commands.Add(command5); } string text = HelpUtil.BuildPrivacyStatmentHref(); if (!string.IsNullOrEmpty(text)) { Command command6 = new Command(); command6.Name = "Privacy"; command6.Text = Strings.Privacy; command6.OnClientClick = string.Format("PopupWindowManager.showHelpClient('{0}');", HttpUtility.HtmlEncode(text)); dropDownCommand.Commands.Add(command6); } Command command7 = new Command(); command7.Name = "Copyright"; command7.Text = Strings.CopyRight; command7.OnClientClick = string.Format("PopupWindowManager.showHelpClient('{0}');", "http://go.microsoft.com/fwlink/p/?LinkId=256676"); dropDownCommand.Commands.Add(command7); }