public void ThenIShouldSeeTheFollowingToolbarOptions(Table table) { ToolbarButtonInfo[] toolbarButtons = _actor.AsksFor(ToolbarButtons.WhichAreVisible()); table.Rows.ForEach(row => { bool buttonIsVisible = toolbarButtons.Any(b => b.AltText == row["Option"]); buttonIsVisible.Should().BeTrue($"button for '{row["Option"]}' should be visible"); }); }
public EditFormProperties() { LoadingElapseTime = new ElapseTime(); _ToolbarButtons = new ToolbarButtons(); _EditMode = EditModeEnum.List; _VisibleToolbar = true; _VisibleStatusbar = true; _IsLoadingRefresh = false; IsLoaded = false; }
// On Init add popup div and ajaxfileupload control to support Add image protected override void OnInit(EventArgs e) { base.OnInit(e); if (!DesignMode) { // Check if EnableSanitization is enabled and sanitizer provider is not configured. if (EnableSanitization && Sanitizer == null) { throw new Exception("The Sanitizer is not configured in the web.config file. Either install the AjaxControlToolkit.HtmlEditor.Sanitizer NuGet package or set the EnableSanitization property to False (insecure)."); } EnsureButtons(); var popupdiv = new HtmlGenericControl("div"); popupdiv.Attributes.Add("Id", this.ClientID + "_popupDiv"); popupdiv.Attributes.Add("style", "opacity: 0;"); popupdiv.Attributes.Add("class", "ajax__html_editor_extender_popupDiv"); ajaxFileUpload = new AjaxFileUpload(); ajaxFileUpload.ID = this.ID + "_ajaxFileUpload"; ajaxFileUpload.MaximumNumberOfFiles = 10; ajaxFileUpload.AllowedFileTypes = "jpg,jpeg,gif,png"; ajaxFileUpload.Enabled = true; ajaxFileUpload.OnClientUploadComplete = "ajaxClientUploadComplete"; if (ImageUploadComplete != null) { ajaxFileUpload.UploadComplete += ImageUploadComplete; } if (HasImageButton()) { var button = (InsertImage)ToolbarButtons.FirstOrDefault(b => b.CommandName == InsertImageCommandName); if (!String.IsNullOrWhiteSpace(button.AjaxFileUploadHandlerPath)) { ajaxFileUpload.UploadHandlerPath = button.AjaxFileUploadHandlerPath; } } popupdiv.Controls.Add(ajaxFileUpload); var btnCancel = new HtmlGenericControl("div"); btnCancel.Attributes.Add("Id", this.ClientID + "_btnCancel"); btnCancel.Attributes.Add("style", "float: right; position:relative; padding-left: 20px; top:10px; width: 55px; border-color:black;border-style: solid; border-width: 1px;cursor:pointer;"); btnCancel.Attributes.Add("float", "right"); btnCancel.Attributes.Add("unselectable", "on"); btnCancel.InnerText = "Cancel"; popupdiv.Controls.Add(btnCancel); this.Controls.Add(popupdiv); } }
private void ConfigureToolbarItems() { var standardButtonSize = 31; if (ToolbarButtons != null) { var buttonList = ToolbarButtons.Where((button) => button.Command == null || !(button as ICommandButton).Hidden).ToList(); var leftCount = buttonList.Where((button) => button.Location == BarButtonLocation.Left).Count(); var rightCount = buttonList.Where((button) => button.Location == BarButtonLocation.Right).Count(); if (rightCount > leftCount) { var buttonWidth = buttonList.Last((button) => button.Location == BarButtonLocation.Right).Width; _LeftFixedSpace.Width = buttonWidth == 0 ? standardButtonSize : buttonWidth; buttonList.Add(_LeftFixedSpace); } if (leftCount > rightCount) { var buttonWidth = buttonList.First((button) => button.Location == BarButtonLocation.Left).Width; _RightFixedSpace.Width = buttonWidth == 0 ? standardButtonSize : buttonWidth; buttonList.Add(_RightFixedSpace); } CommandBarButtonItem[] buttons = buttonList.ToArray(); SetToolbarItems(buttons, false); var nav = ParentViewController as UINavigationController; if (nav != null) { nav.NavigationBar.Opaque = false; var themeable = RootView as IThemeable; if (themeable != null && themeable.Theme != null) { nav.Toolbar.TintColor = themeable.Theme.BarTintColor; } } } }
/// <summary> /// Creates the UIViewController that will be pushed by this RootElement /// </summary> protected virtual UIViewController MakeViewController() { if (createOnSelected != null) { return(createOnSelected(this)); } var dvc = new DialogViewController(this, true) { Autorotate = true }; if (ToolbarButtons != null) { dvc.SetToolbarItems(ToolbarButtons.ToArray(), true); } // dvc.EditButtonItem = EditButton; return(dvc); }
// 处理工具栏按钮被单击的事件 private void toolBar_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e) { #region 工具栏单击事件 ToolbarButtons item = (ToolbarButtons)e.Button.Tag; // handle the button click, call the associated menu event if possible switch (item) { case ToolbarButtons.NewAlbum: if (showModel == ShowModel.Photo) { this.Visible = false; panelDgv.Visible = true; panelPhoto.Visible = false; showModel = ShowModel.List; wsYjLoad(); this.Visible = true; } break; case ToolbarButtons.Website: DownLoad(_curPhotoShowIndex); break; case ToolbarButtons.Print: PhotoPrint(); break; case ToolbarButtons.NextPhoto: ShowPhotoIndex(_curPhotoShowIndex + 1); break; case ToolbarButtons.PreviousPhoto: ShowPhotoIndex(_curPhotoShowIndex - 1); break; } #endregion }
private void Initialize() { if (!this.DesignMode) { if (GlobalVar.Settings.GetValue("FORM_SKIN").IsNullOrEmpty() == false) { this.LookAndFeel.UseDefaultLookAndFeel = barAndDockingController.LookAndFeel.UseDefaultLookAndFeel = false; this.LookAndFeel.SetSkinStyle(GlobalVar.Settings.GetValue("FORM_SKIN").ToStringNullToEmpty()); barAndDockingController.LookAndFeel.SetSkinStyle(GlobalVar.Settings.GetValue("FORM_SKIN").ToStringNullToEmpty()); } else { this.LookAndFeel.UseDefaultLookAndFeel = barAndDockingController.LookAndFeel.UseDefaultLookAndFeel = true; } barTools.OptionsBar.AllowQuickCustomization = false; ToolbarButtons = new ToolbarButtons(); LoadingElapseTime = new ElapseTime(); IsLoaded = false; if (Name.EndsWith("EditForm")) { EditMode = EditModeEnum.New; } else { EditMode = EditModeEnum.List; } } else { this.LookAndFeel.UseDefaultLookAndFeel = barAndDockingController.LookAndFeel.UseDefaultLookAndFeel = true; } }
bool HasImageButton() { return(ToolbarButtons.Any(b => b.CommandName == InsertImageCommandName)); }
public void SetToolbarButtons(ToolbarButtons toolbarButtons) { _ToolbarButtons = toolbarButtons; ChangeToolbarButtons(); }