protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e) { if (_dragHandler != null) { _dragHandler = null; } var position = e.GetPosition(this); PopupButton popupButton = null; DependencyObject child = null; //child = VisualTreeHelper.HitTest(this, position)?.VisualHit; VisualTreeHelper.HitTest(this, null, (result) => { child = result.VisualHit; popupButton = child.FindParent <PopupButton>(); if (popupButton != null) { return(HitTestResultBehavior.Stop); } else { return(HitTestResultBehavior.Continue); } }, new PointHitTestParameters(position)); if (_popupButton != null) { if (popupButton == null || popupButton != _popupButton) { _popupButton.IsPopupOpen = false; _popupButton = null; } } }
/// <summary> /// Obtiene el objeto ToolBar creado /// desde los nodos del Tree, /// esto se realiza para poder mantener /// el orden con el cual se han ido acomodando /// los nodos del tree. /// </summary> /// <returns>ToolBar obtenido</returns> private Fwk.UI.Controls.Menu.ToolBar GenerateToolBarFromTree() { Fwk.UI.Controls.Menu.ToolBar newToolBar = new Fwk.UI.Controls.Menu.ToolBar(); foreach (TreeListNode node in ctlTreeViewMenuBar.Nodes) { Fwk.UI.Controls.Menu.ButtonBase newButton = (Fwk.UI.Controls.Menu.ButtonBase)node.GetValue("colObjeto"); if (newButton.GetType() == typeof(PopupButton)) { PopupButton popupButton = (PopupButton)newButton; popupButton.Buttons.Clear(); foreach (TreeListNode buttonNode in node.Nodes) { Fwk.UI.Controls.Menu.ButtonBase ButtonBase = (Fwk.UI.Controls.Menu.ButtonBase)buttonNode.GetValue("colObjeto"); popupButton.Buttons.Add(ButtonBase); } newToolBar.Add(popupButton); } // Para boton común if (newButton.GetType() == typeof(Fwk.UI.Controls.Menu.ButtonBase)) { newToolBar.Add(newButton); } } return(newToolBar); }
private void setTrimValue(PopupButton button) { if (HighLogic.LoadedSceneIsFlight) { float newTrim = 0f; string trimString = button.popupElement.inputText; if (float.TryParse(trimString, out newTrim)) { trim = Mathf.Clamp(newTrim / 100f, -1f, 1f); //switch (axis) //{ // case "Pitch": // FlightInputHandler.state.pitchTrim = Mathf.Clamp(newTrim / 100f, -1f, 1f); // break; // case "Yaw": // FlightInputHandler.state.yawTrim = Mathf.Clamp(newTrim / 100f, -1f, 1f); // break; // case "Roll": // FlightInputHandler.state.rollTrim = Mathf.Clamp(newTrim / 100f, -1f, 1f); // break; // case "Wheel": // FlightInputHandler.state.wheelSteerTrim = Mathf.Clamp(newTrim / 100f, -1f, 1f); // break; //} } } }
/// <summary> /// Overriding to setup state. /// </summary> public override void OnApplyTemplate() { base.OnApplyTemplate(); var window = Window.GetWindow(this); if (window != null) { window.CommandBindings.Add(new CommandBinding(QuickAccessToolBar.AddToQATCommand, AddToQATCommandExecuted, AddToQATCommandCanExecute)); window.CommandBindings.Add(new CommandBinding(QuickAccessToolBar.RemoveFromQATCommand, RemoveFromQATCommandExecuted, RemoveFromQATCommandCanExecute)); window.CommandBindings.Add(new CommandBinding(QuickAccessToolBar.CustomizeQATCommand, CustomizeQATCommandExecuted, CustomizeQATCommandCanExecute)); } _CustomizeButton = GetTemplateChild("CustomizeMenuButton") as PopupButton; if (_CustomizeButton != null) { var panel = _CustomizeButton.Parent as Panel; if (panel != null) { panel.Children.Remove(_CustomizeButton); Items.Add(new Separator()); Items.Add(_CustomizeButton); } _CustomizeButton.PopupClosed += delegate { IsOverflowOpen = false; }; } Dispatcher.BeginInvoke(new Action(LoadFromSerializationString), DispatcherPriority.ApplicationIdle); }
void Awake() { popupbutton_cs = Button.GetComponent <PopupButton>(); text1 = Text1.GetComponent <Text>(); text2 = Text2.GetComponent <Text>(); Ingame_sc = Canvas.GetComponent <Ingame>(); }
public PopupElement(string title, string input, PopupButton button) { titleText = title; useTitle = true; inputText = input; useInput = true; buttons.Add(button); }
void Awake() { Camera_AudioSource = Camera_gb.GetComponent <AudioSource>(); pb_sc = Buttons.GetComponent <PopupButton>(); ingame_sc = GetComponent <Ingame>(); // As = Camera.GetComponent<AudioSource>(); MapName_text = MapName_gb.GetComponent <Text>(); }
private void OnRowEditorOpened(object sender, PopupButtonOpenedEventArgs e) { if (_popupButton != null && _popupButton != e.PopupButton) { _popupButton.IsPopupOpen = false; _popupButton = null; } _popupButton = e.PopupButton; }
public BaseMapsView() { BasemapButton = new PopupButton("icons/icon_basemap.png"); AddButton(BasemapButton); StyleContent = new StylePopupContent(); LanguageButton = new PopupButton("icons/icon_language.png"); AddButton(LanguageButton); LanguageContent = new LanguagePopupContent(); }
public void SetButtons(List <PopupButtonInfo> _popupButtonInfos) { foreach (var info in _popupButtonInfos) { GameObject buttonObject = Instantiate(this.m_buttonPrefab); buttonObject.transform.SetParent(this.m_buttonsLayout.transform, false); PopupButton popupButton = buttonObject.GetComponent <PopupButton>(); popupButton.Init(info.text, info.callback, this.gameObject); } }
private void adjustTrimFromButton(PopupButton button) { if (button.buttonText == "+") { adjustTrim(buttonIncrements); } else if (button.buttonText == "-") { adjustTrim(-buttonIncrements); } }
/// <summary> /// Applies the graphics settings. /// </summary> public void OnApplySettingsButtonClicked() { PopupButton resPopup = GameObject.Find("ResolutionButton").GetComponent <PopupButton>(); int xRes; int yRes; ParseResolution(resPopup.list[PlayerPrefs.GetInt("resolution")].text, out xRes, out yRes); Screen.SetResolution(xRes, yRes, PlayerPrefs.GetInt("fullscreen") != 0); OnBackButtonClicked(); }
public void ButtonClick(PopupButton btn) { Action buf = Buttons[btn]; Buttons.Remove(btn); foreach (PopupButton pb in Buttons.Keys) Destroy(pb.gameObject); Buttons.Clear(); btn.GetComponent<Button>().transition = UnityEngine.UI.Selectable.Transition.None;/// btn.GetComponent<Button>().interactable = false;/// btn.GetComponent<Fader>().FadeAndDestroyObject(0.3f); ButtonsShowed = false; EventManager.OnActionChoose(buf); }
private void buttonSetVTOLSteering(PopupButton button) { string newSetup = button.buttonText; if (newSetup == "Single" || newSetup == "Double") { newSetup += " Pair"; } updateSteeringSetup(newSetup); foreach (PopupButton b in elementVTOLSteeringMode.buttons) { b.styleSelected = false; } button.styleSelected = true; }
private void AmountBudgetedTextbox_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { // Find the TextBox DependencyObject parent = e.OriginalSource as UIElement; while (parent != null && !(parent is TextBox)) { parent = VisualTreeHelper.GetParent(parent); } if (parent != null) { var textBox = (TextBox)parent; var position = e.GetPosition(textBox); PopupButton popupButton = null; DependencyObject child = null; //child = VisualTreeHelper.HitTest(this, position)?.VisualHit; VisualTreeHelper.HitTest(textBox, null, (result) => { child = result.VisualHit; popupButton = child.FindParent <PopupButton>(); if (popupButton != null) { return(HitTestResultBehavior.Stop); } else { return(HitTestResultBehavior.Continue); } }, new PointHitTestParameters(position)); if (popupButton == null) { if (!textBox.IsKeyboardFocusWithin) { // If the text box is not yet focussed, give it the focus and // stop further processing of this click event. textBox.Focus(); e.Handled = true; } } } }
/// <summary> /// /// </summary> /// <param name="objectToLoad"></param> public void LoadControl(PopupButton objectToLoad) { _Button = objectToLoad; _OriginalButton = objectToLoad; buttonsBindingSource.DataSource = _Button; buttonsBindingSource.ResetBindings(true); if (_Button.Image == null) { pctImage.Image = null; } else { pctImage.Image = new Bitmap(new MemoryStream(_Button.Image)); } }
protected override void OnPreviewMouseMove(MouseEventArgs e) { if (_dragHandler != null && e.LeftButton == MouseButtonState.Pressed && !_dragHandler.IsDragging) { var newPoint = e.GetPosition(this); var distance = Point.Subtract(newPoint, _dragHandler.DragStartPosition); if (distance.Length > 4.0) { if (_popupButton != null) { _popupButton.IsPopupOpen = false; _popupButton = null; } _dragHandler.StartDrag(); _dragHandler.DestroyDragAdorner(); _dragHandler = null; } } }
protected override void OnElementChanged(ElementChangedEventArgs <Xamarin.Forms.Button> e) { base.OnElementChanged(e); if (Control != null) { var button = e.NewElement; btn = e.NewElement as PopupButton; // Create a drawable for the button's normal state _normal = new Android.Graphics.Drawables.GradientDrawable(); if (button.BackgroundColor.R == -1.0 && button.BackgroundColor.G == -1.0 && button.BackgroundColor.B == -1.0) { _normal.SetColor(Android.Graphics.Color.ParseColor(Globals.WHITE)); } else if (button.BackgroundColor != Color.Black) { _normal.SetColor(button.BackgroundColor.ToAndroid()); } else { _normal.SetColor(Android.Graphics.Color.ParseColor(Globals.WHITE)); } _normal.SetStroke((int)button.BorderWidth, button.BorderColor.ToAndroid()); _normal.SetCornerRadius(10); // Create a drawable for the button's pressed state _pressed = new Android.Graphics.Drawables.GradientDrawable(); var highlight = Context.ObtainStyledAttributes(new int[] { Android.Resource.Attribute.ColorActivatedHighlight }).GetColor(0, Android.Graphics.Color.ParseColor(Globals.RED)); _pressed.SetColor(highlight); _pressed.SetStroke((int)button.BorderWidth, button.BorderColor.ToAndroid()); _pressed.SetCornerRadius(button.BorderRadius); // Add the drawables to a state list and assign the state list to the button var sld = new StateListDrawable(); sld.AddState(new int[] { Android.Resource.Attribute.StatePressed }, _pressed); sld.AddState(new int[] { }, _normal); Control.SetBackgroundDrawable(sld); } }
protected internal DockPaneCaptionFromBase(DockPane pane) : base(pane) { SuspendLayout(); Font = SystemInformation.MenuFont; m_buttonClose = new PopupButton(ImageCloseEnabled, ImageCloseDisabled); m_buttonClose.ActiveBackColorGradientBegin = Color.FromArgb(59, 128, 237); m_buttonClose.ActiveBackColorGradientEnd = Color.FromArgb(49, 106, 197); m_buttonClose.InactiveBackColorGradientBegin = Color.FromArgb(204, 199, 186); m_buttonClose.InactiveBackColorGradientEnd = Color.FromArgb(204, 199, 186); m_buttonAutoHide = new PopupButton(); m_buttonAutoHide.ActiveBackColorGradientBegin = Color.FromArgb(59, 128, 237); m_buttonAutoHide.ActiveBackColorGradientEnd = Color.FromArgb(49, 106, 197); m_buttonAutoHide.InactiveBackColorGradientBegin = Color.FromArgb(204, 199, 186); m_buttonAutoHide.InactiveBackColorGradientEnd = Color.FromArgb(204, 199, 186); m_buttonOptions = new PopupButton(ImageOptionsEnabled, ImageOptionsDisabled); m_buttonOptions.ActiveBackColorGradientBegin = Color.FromArgb(59, 128, 237); m_buttonOptions.ActiveBackColorGradientEnd = Color.FromArgb(49, 106, 197); m_buttonOptions.InactiveBackColorGradientBegin = Color.FromArgb(204, 199, 186); m_buttonOptions.InactiveBackColorGradientEnd = Color.FromArgb(204, 199, 186); m_buttonClose.ToolTipText = ToolTipClose; m_buttonClose.Anchor = AnchorStyles.Top || AnchorStyles.Right; m_buttonClose.Click += new System.EventHandler(Close_Click); m_buttonAutoHide.ToolTipText = ToolTipAutoHide; m_buttonAutoHide.Anchor = AnchorStyles.Top || AnchorStyles.Right; m_buttonAutoHide.Click += new System.EventHandler(AutoHide_Click); m_buttonOptions.ToolTipText = ToolTipOptions; m_buttonOptions.Anchor = AnchorStyles.Top || AnchorStyles.Right; m_buttonOptions.Click += new System.EventHandler(Options_Click); Controls.AddRange(new Control[] {m_buttonClose, m_buttonAutoHide, m_buttonOptions}); ResumeLayout(); }
private void adjustTrimFromButton(PopupButton button) { if (button.buttonText == "+") adjustTrim(buttonIncrements); else if (button.buttonText == "-") adjustTrim(-buttonIncrements); }
public override void LoadContent() { selectedLayer = "_layer1"; components = new List <UIElement>(); Texture2D navbarBG = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, GlobalParameters.screenWidth, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE); Container navbar = new Container(navbarBG, new Vector2(0, 0), new Vector2(GlobalParameters.screenWidth, 32)); // Create Navbar child components Texture2D menuButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 100, 32, pixel => new Color(35, 35, 35), Shapes.RECTANGLE); RedirectButton menuButton = new RedirectButton("Menu Scene", menuButtonTexture, new Vector2(0, 0), new Vector2(100, 32), "MENU", Color.White); Texture2D helpButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(100, 100, 200), Shapes.RECTANGLE); Overlay helpOverlay = new Overlay("Static\\SettingsScene/button_export", new Vector2(500, 500), new Vector2(32, 32)); PopupButton helpButton = new PopupButton(helpOverlay, "Static\\DrawingScene/help", new Vector2(menuButton.position.X + menuButton.dimensions.X, 0), new Vector2(32, 32)); //Texture2D settingsButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 255, 0), Shapes.RECTANGLE); Overlay settingsOverlay = new Overlay("Static\\SettingsScene/button_export", new Vector2(600, 500), new Vector2(32, 32)); PopupButton settingsButton = new PopupButton(settingsOverlay, "Static\\DrawingScene/gear", new Vector2(helpButton.position.X + helpButton.dimensions.X, 0), new Vector2(32, 32)); Texture2D colorButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(200, 0, 255), Shapes.CIRCLE); Overlay colorOverlay = new Overlay(colorButtonTexture, new Vector2(1100, 500), new Vector2(32, 32)); PopupButton colorButton = new PopupButton(colorOverlay, colorButtonTexture, new Vector2(GlobalParameters.screenWidth - colorButtonTexture.Width, 0), new Vector2(32, 32)); Texture2D layerButtonTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 0, 255), Shapes.RECTANGLE); Overlay layerOverlay = new Overlay(layerButtonTexture, new Vector2(732, 500), new Vector2(32, 32)); PopupButton layerButton = new PopupButton(layerOverlay, "Static\\DrawingScene/layers", new Vector2(colorButton.position.X - colorButton.dimensions.X, 0), new Vector2(32, 32)); List <RadioButton> buttons = new List <RadioButton>(); Texture2D eraserSelectedTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(255, 0, 0), Shapes.RECTANGLE); Texture2D eraserUnselectedTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 32, 32, pixel => new Color(0, 255, 0), Shapes.RECTANGLE); EraserButton eraser = new EraserButton("Static\\DrawingScene/eraser_selected", "Static\\DrawingScene/eraser", false, new Vector2(layerButton.position.X - layerButton.dimensions.X, 0), new Vector2(32, 32)); DrawButton draw = new DrawButton("Static\\DrawingScene/brush_selected", "Static\\DrawingScene/brush", true, new Vector2(eraser.position.X - eraser.dimensions.X, 0), new Vector2(32, 32)); buttons.Add(draw); buttons.Add(eraser); ButtonGroup toolButtons = new ButtonGroup(buttons); // TODO ADD Clickable Buttons // +1 Frame, Last Frame, -1 Frame, First Frame, Play Texture2D frameCounterTexture = DrawingService.CreateTexture(GlobalParameters.GlobalGraphics, 132, 32, pixel => new Color(0, 0, 0), Shapes.RECTANGLE); UIElement frameCounter = new FrameCounterComponent(frameCounterTexture, new Vector2(settingsButton.position.X + settingsButton.dimensions.X, 0), new Vector2(frameCounterTexture.Width, frameCounterTexture.Height)); navbar.uiElements.Add(menuButton); navbar.uiElements.Add(helpButton); navbar.uiElements.Add(settingsButton); navbar.uiElements.Add(colorButton); navbar.uiElements.Add(layerButton); navbar.uiElements.Add(frameCounter); navbar.buttonGroups.Add(toolButtons); // Add the navbar to this scene components.Add(navbar); // Load Frame frames = new List <Frame>(); frameSize = new Vector2(200, 200); framePosition = new Vector2(GlobalParameters.screenWidth / 2 - (int)frameSize.X / 2, GlobalParameters.screenHeight / 2 - (int)frameSize.Y / 2 + menuButton.dimensions.Y / 2); frames.Add(new Frame(framePosition, frameSize)); }
internal void SetFocusButton (PopupButton button) { if (button == focusButton) return; focusButton = button; OnUIAFocusedItemChanged (); }
public static MvcHtmlString GSKGridView(this HtmlHelper htmlHelper, GridModel model) { if (model == null) { return(new MvcHtmlString("")); } if (String.IsNullOrEmpty(model.SubmitUrl)) { //model.SubmitUrl = htmlHelper.ViewContext.RouteData.DataTokens["area"] + "/" + // htmlHelper.ViewContext.RouteData.GetRequiredString("controller") + "/" + // htmlHelper.ViewContext.RouteData.GetRequiredString("action"); model.SubmitUrl = "/" + htmlHelper.ViewContext.RouteData.DataTokens["area"] + "/" + htmlHelper.ViewContext.Controller.ControllerContext.RouteData.GetRequiredString("controller") + "/" + htmlHelper.ViewContext.Controller.ControllerContext.RouteData.GetRequiredString("action"); model.SubmitUrl = model.SubmitUrl.Replace("//", "/"); } StringBuilder sb = new StringBuilder(); sb.Append("<div id='" + model.Id + "' class='gskgrid' action='" + model.SubmitUrl + "' >"); string hiddenElements = ""; foreach (string key in htmlHelper.ViewContext.HttpContext.Request.QueryString.Keys) { if (key != "SearchFor" && key != "PageNo" && key != "PageSize") { hiddenElements += htmlHelper.Hidden(key, htmlHelper.ViewContext.HttpContext.Request.QueryString[key]); } } sb.Append(hiddenElements); // sb.Append(String.Format("<form id='frmList' name='frmList' method='post' action='{0}'>", model.SubmitUrl)); sb.Append(String.Format("<input type = 'hidden' value = '{0}' name = 'PageNo' id = 'PageNo' />", model.PageNo)); //Search Bar sb.Append("<div class='row'>"); sb.Append("<div class='col-md-6'>"); //Dropdown if (model.GridOptions.Pagination) { sb.Append(htmlHelper.Label("Paging: ")); sb.Append(htmlHelper.DropDownList("PageSize", new SelectList(model.PageSizes, model.PageSize), new { @class = "pagesize" })); } //Buttons Bar if (model.GridOptions.HeaderButtons != null) { foreach (HeaderButton hb in model.GridOptions.HeaderButtons) { if (hb.IsPopup) { //sb.Append(String.Format("<a href = '' class='hButton' style='margin-right:10px' url='{5}' onclick = \"updateRecord('{0}',this,'{1}','{2}','{3}'); return false; \" >{4}</a>", model.Id, 1, hb.Url, hb.PopupTitle,hb.Text, hb.Url)); sb.Append(String.Format("<a href = '' class='hButton {3}' style='margin-left:10px' popup='1' url='{0}' title='{1}' >{2}</a>", hb.Url, hb.PopupTitle, hb.Text, hb.CSSClass)); } else { sb.Append(String.Format("<a style='margin-left:10px' class='hButton {3}' popup='0' href = '{0}/{1}?p={2}'>{3}</a>", hb.Url, 1, model.PageNo, hb.Text, hb.CSSClass)); } } } /////////////sb.Append("<button type='button' id='hb' onclick='' style='margin-left:10px'>" + hb.Text +"</button></div>"); sb.Append("</div>"); //Search Box and Search Button if (model.GridOptions.Search) { sb.Append("<div class='col-md-6'><div class=\"pull-right\">"); sb.Append(htmlHelper.TextBox("SearchFor", "")); sb.Append(String.Format("<button type = 'button' value='{0}' id='btnSearch' class=\"glyphicon glyphicon-search\" style=\"line-height:inherit\" onclick=\"onSubmit(this,'{1}')\" />", "Search", model.Id)); sb.Append("</div></div>"); } sb.Append("</div>"); //Table header sb.Append("<div class='row'><div class='col-md-12'><div style =\"overflow-x:auto\"><table class='table table-hover'><thead><tr>"); if (model.Data.Headers != null) { if (model.GridOptions.ShowCheckBoxes) { sb.Append("<th><input type='checkbox' name='chkAll' id='chkAll' /></th>"); } foreach (var header in model.Data.Headers) { sb.Append("<th>" + header + "</th>"); } sb.Append("<th>Actions</th>"); } sb.Append("</tr></thead>"); //Table Data if (model.Data.Count > 0) { foreach (var r in model.Data) { sb.Append("<tr>"); if (model.GridOptions.ShowCheckBoxes) { sb.Append("<td><input type='checkbox' name='" + r.RowId + "' /></td>"); } //dynamic statusFieldValue = null; foreach (var f in r.Fields) { if (!String.IsNullOrEmpty(f.NavigationUrl)) { string text = f.Value; sb.Append(String.Format("<td><a href='{0}'>{1}</a></td>", f.NavigationUrl, f.Value)); } else { sb.Append("<td>" + f.Value + "</td>"); } //if (f.Name == model.StatusFieldname) //{ // statusFieldValue = f.Value; //} } //Row buttons if (model.GridOptions.RowButtos != null) { sb.Append("<td>"); foreach (RowButton rb in model.GridOptions.RowButtos) { string t = rb.Text; string url = rb.Url; bool isDisabled = (rb.DisableWhen != null && r.Fields.FirstOrDefault(rb.DisableWhen) != null); if (rb is PopupButton) { if (isDisabled) { sb.Append("<a href='' style='opacity:0.7; pointer-events: none;' onclick='return false;' >" + t + "</a> | "); } else { PopupButton pb = (PopupButton)rb; sb.Append(String.Format("<a href = '' onclick = \"updateRecord('{0}','{1}','{2}','{3}'); return false; \" >{4}</a> | ", model.Id, r.RowId, url, pb.PopupTitle, t)); } } else if (rb is ConfirmButton) { if (isDisabled) { sb.Append("<a href='' style='opacity:0.7; pointer-events: none;' onclick='return false;' >" + t + "</a> | "); } else { sb.Append(String.Format("<a href = '' onclick = \"doAction('{0}','{1}','{2}','{3}','{4}'); return false; \" >{5}</a> | ", model.Id, "id=" + r.RowId, url, "Confirm Dialog", ((ConfirmButton)rb).ConfirmMessage, t)); } } else if (rb is ToggleButton) { ToggleButton tb = (ToggleButton)rb; string confirmMesage = tb.ConfirmMessage; if (r.Fields[tb.ToggleField] == null) { throw new Exception(tb.ToggleField + " field not found"); } string value = r.Fields[tb.ToggleField].Value.ToString(); if (Convert.ToString(value) == Convert.ToString(tb.ToggleValue)) { t = tb.ToggleText; confirmMesage = tb.ToggleConfirmMessage; } if (isDisabled) { sb.Append("<a href='' style='opacity:0.7; pointer-events: none;' onclick='return false;' >" + t + "</a> | "); } else { sb.Append(String.Format("<a href = '' onclick = \"doAction('{0}','{1}','{2}','{3}','{4}'); return false; \" >{5}</a> | ", model.Id, "id=" + r.RowId + "&value=" + value, rb.Url, "Confirm Dailog", confirmMesage, t)); } } else { sb.Append(String.Format("<a href = '{0}/{1}?p={2}'>{3}</a> | ", rb.Url, r.RowId, model.PageNo, t)); } } sb.Remove(sb.Length - 2, 2); sb.Append("</td>"); } sb.Append("<tr>"); } } else { sb.Append(String.Format("<tr><td colspan={0}>No data found</td></tr>", model.Data.Headers.Count + 1)); } sb.Append("</table></div></div></div>"); //Paging if (model.GridOptions.Pagination) { sb.Append(htmlHelper.PagedList(model)); } sb.Append("</form>"); sb.Append(String.Format("<div id = 'modalEdit_{0}' class='mx-auto'><div id = 'modalBody' ></div><div id='ErrMsg'></div></div></div>", model.Id)); return(new MvcHtmlString(sb.ToString())); }
/// <summary> /// Initializes the MessageBox. /// </summary> /// <param name="text">The text.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button.</param> /// <param name="image">The image.</param> /// <param name="defaultResult">The default result.</param> protected void InitializeMessageBox(string text, string caption, PopupButton button, PopupImage image, PopupResult defaultResult) { Header = caption; Content = text; PopupButton = button; PopupImage = image; _defaultResult = defaultResult; }
void OnClickButton (object sender, EventArgs e) { if (lastPopupButton != null && lastPopupButton != sender as PopupButton) lastPopupButton.ButtonState = PopupButton.PopupButtonState.Normal; lastPopupButton = sender as PopupButton; if (sender == recentlyusedButton) { currentPath = MWFVFS.RecentlyUsedPrefix; } else if (sender == desktopButton) { currentPath = MWFVFS.DesktopPrefix; } else if (sender == personalButton) { currentPath = MWFVFS.PersonalPrefix; } else if (sender == mycomputerButton) { currentPath = MWFVFS.MyComputerPrefix; } else if (sender == networkButton) { currentPath = MWFVFS.MyNetworkPrefix; } EventHandler eh = (EventHandler)(Events [PDirectoryChangedEvent]); if (eh != null) eh (this, EventArgs.Empty); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); GL.ClearColor(Color.Cornsilk); GlNanoVG.nvgCreateGL(ref ctx, (int)NVGcreateFlags.NVG_ANTIALIAS | (int)NVGcreateFlags.NVG_STENCIL_STROKES | (int)NVGcreateFlags.NVG_DEBUG); Fonts.Load(ctx, "sans", "Roboto-Regular.ttf"); Fonts.Load(ctx, "sans-bold", "Roboto-Bold.ttf"); Fonts.Load(ctx, "icons", "entypo.ttf"); screen = new Widget() .WithLocalPosition(Vector2.Zero) .WithSize(new Vector2(this.Width, this.Height)); { Window window = screen.AddNewWidget <Window> (); window.WithTitle("Button demo") .WithLocalPosition(new Vector2(15f, 50f)) .WithSize(new Vector2(250f, 400f)) .WithLayout(new GroupLayout()); // -- Push buttons window.AddNewWidget <Label> () .WithCaption("Push buttons") .WithFont("sans-bold"); window.AddNewWidget <Button> () .WithCaption("Plain button") .WithClickCallback((btn) => Console.WriteLine("Click!")); window.AddNewWidget <Button> () .WithCaption("Styled") .WithIcon((int)MonoNanoGUI.Font.Entypo.ICON_ROCKET, Button.IconAnchorType.LeftCentered); // -- Toggle buttons window.AddNewWidget <Label> () .WithCaption("Toggle buttons") .WithFont("sans-bold"); window.AddNewWidget <Button> () .WithFlags(Button.Flags.ToggleButton) .WithCaption("Toggle me"); // -- Radio buttons window.AddNewWidget <Label> () .WithCaption("Radio buttons") .WithFont("sans-bold"); window.AddNewWidget <Button> () .WithCaption("Radio button 1") .WithFlags(Button.Flags.RadioButton); window.AddNewWidget <Button> () .WithCaption("Radio button 2") .WithFlags(Button.Flags.RadioButton); // -- Tool buttons palette window.AddNewWidget <Label> () .WithCaption("A tool palette") .WithFont("sans-bold"); Widget tools = window.AddNewWidget <Widget> () .WithLayout(new BoxLayout(Layout.Orientation.Horizontal, Layout.Alignment.Middle, 0, 6)); tools.AddChild(Button.MakeToolButton((int)MonoNanoGUI.Font.Entypo.ICON_CLOUD)); tools.AddChild(Button.MakeToolButton((int)MonoNanoGUI.Font.Entypo.ICON_FF)); tools.AddChild(Button.MakeToolButton((int)MonoNanoGUI.Font.Entypo.ICON_COMPASS)); tools.AddChild(Button.MakeToolButton((int)MonoNanoGUI.Font.Entypo.ICON_INSTALL)); // -- Popup buttons window.AddNewWidget <Label> () .WithCaption("Popup buttons") .WithFont("sans-bold"); PopupButton pButton = window.AddNewWidget <PopupButton> () .WithIcon((int)MonoNanoGUI.Font.Entypo.ICON_EXPORT) .WithCaption("Popup") as PopupButton; pButton.popup.WithLayout(new GroupLayout()); pButton.popup.AddNewWidget <Label> () .WithCaption("Arbitrary widgets can be placed here"); pButton.popup.AddNewWidget <CheckBox> () .WithCaption("A check box"); PopupButton rpButton = pButton.popup.AddNewWidget <PopupButton> () .WithIcon((int)MonoNanoGUI.Font.Entypo.ICON_FLASH) .WithCaption("Recursive popup") as PopupButton; rpButton.popup.WithLayout(new GroupLayout()); rpButton.popup.AddNewWidget <CheckBox> () .WithCaption("Another check box"); } screen.PerformLayout(ctx); PerfGraph.InitGraph((int)GraphrenderStyle.GRAPH_RENDER_FPS, "FPS"); Console.WriteLine("Load"); //Console.WriteLine ("Test Unicode to UTF8 = " + Fonts.UnicodeToUTF8 (0).Length); }
public PopupElement(PopupButton button) { buttons.Add(button); }
public PopupElement(string title, PopupButton button) { titleText = title; useTitle = true; buttons.Add(button); }
private void buttonSetVTOLSteering(PopupButton button) { string newSetup = button.buttonText; if (newSetup == "Single" || newSetup == "Double") newSetup += " Pair"; updateSteeringSetup(newSetup); foreach (PopupButton b in elementVTOLSteeringMode.buttons) { b.styleSelected = false; } button.styleSelected = true; }
/// <summary> /// Shows the MessageBox. /// </summary> /// <param name="messageText">The message text.</param> /// <param name="caption">The caption.</param> /// <param name="button">The button.</param> /// <param name="icon">The icon.</param> /// <param name="defaultResult">The default result.</param> /// <param name="messageBoxStyle">The style to be set.</param> /// <returns></returns> /// <exception cref="InvalidOperationException">Static methods for MessageBoxes are not available in XBAP. /// Use the instance ShowMessageBox methods instead.</exception> private static PopupResult ShowCore(string messageText, string caption, PopupButton button, PopupImage icon, PopupResult defaultResult, Style messageBoxStyle) { if (System.Windows.Interop.BrowserInteropHelper.IsBrowserHosted) throw new InvalidOperationException("Static methods for MessageBoxes are not available in XBAP. Use the instance ShowMessageBox methods instead."); var messageBox = new MetroPopup(); messageBox.InitializeMessageBox(messageText, caption, button, icon, defaultResult); // Setting the style to null will inhibit any implicit styles if (messageBoxStyle != null) messageBox.Style = messageBoxStyle; if (Application.Current.MainWindow.Content as Visual == null) return PopupResult.None; var layer = AdornerLayer.GetAdornerLayer(Application.Current.MainWindow.Content as Visual); var contentAd = new ControlAdorner(Application.Current.MainWindow.Content as UIElement) { Child = messageBox }; layer.Add(contentAd); // Disable Closing of window while dialog is shown Application.Current.MainWindow.Closing += MainWindow_Closing; messageBox.ShowDialog(); Application.Current.MainWindow.Closing -= MainWindow_Closing; layer.Remove(contentAd); return messageBox.PopupResult; }
///////////////////////////////////////////////////////////////////////////////////////////////////// // PUBLIC PROCEDURES ///////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Adds an adornment to the <see cref="AdornmentLayer"/>. /// </summary> /// <param name="reason">An <see cref="AdornmentChangeReason"/> indicating the add reason.</param> /// <param name="viewLine">The current <see cref="ITextViewLine"/> being examined.</param> /// <param name="tagRange">The <see cref="ITag"/> and the range it covers.</param> /// <param name="bounds">The text bounds in which to render an adornment.</param> protected override void AddAdornment(AdornmentChangeReason reason, ITextViewLine viewLine, TagSnapshotRange <IntraTextNoteTag> tagRange, TextBounds bounds) { // Create the adornment var image = new DynamicImage(); image.Width = 16; image.Height = 16; image.SnapsToDevicePixels = true; image.Source = new BitmapImage(new Uri("/Images/Icons/Notes16.png", UriKind.Relative)); image.Stretch = Stretch.Fill; // Create a popup button PopupButton button = new PopupButton(); button.Content = image; button.Cursor = Cursors.Arrow; button.DisplayMode = PopupButtonDisplayMode.Merged; button.Focusable = false; button.IsTabStop = false; button.IsTransparencyModeEnabled = true; button.Margin = new Thickness(0); button.Padding = new Thickness(-1); button.ToolTip = new HtmlContentProvider(String.Format("<span style=\"color: green;\">{0}</span><br/>Created at <b>{1}</b> by <span style=\"color: blue;\">{2}</span><br/>Status: <b>{3}</b>", tagRange.Tag.Message, tagRange.Tag.Created.ToShortTimeString(), tagRange.Tag.Author, tagRange.Tag.Status)).GetContent(); // Add a context menu ContextMenu contextMenu = new ContextMenu(); button.PopupMenu = contextMenu; MenuItem removeItem = new MenuItem(); removeItem.Header = "Remove Note"; removeItem.Tag = tagRange; removeItem.Click += new RoutedEventHandler(OnRemoveNote); contextMenu.Items.Add(removeItem); contextMenu.Items.Add(new Separator()); MenuItem pendingItem = new MenuItem(); pendingItem.Header = "Mark as Pending"; pendingItem.IsChecked = (tagRange.Tag.Status == ReviewStatus.Pending); pendingItem.Tag = tagRange; pendingItem.Click += new RoutedEventHandler(OnMarkNoteAsPending); contextMenu.Items.Add(pendingItem); MenuItem acceptedItem = new MenuItem(); acceptedItem.Header = "Mark as Accepted"; acceptedItem.IsChecked = (tagRange.Tag.Status == ReviewStatus.Accepted); acceptedItem.Tag = tagRange; acceptedItem.Click += new RoutedEventHandler(OnMarkNoteAsAccpeted); contextMenu.Items.Add(acceptedItem); MenuItem rejectedItem = new MenuItem(); rejectedItem.Header = "Mark as Rejected"; rejectedItem.IsChecked = (tagRange.Tag.Status == ReviewStatus.Rejected); rejectedItem.Tag = tagRange; rejectedItem.Click += new RoutedEventHandler(OnMarkNoteAsRejected); contextMenu.Items.Add(rejectedItem); // Get the location Point location = new Point(Math.Round(bounds.Left) + 1, Math.Round(bounds.Top + (bounds.Height - tagRange.Tag.Size.Height) / 2)); // Add the adornment to the layer this.AdornmentLayer.AddAdornment(reason, button, location, tagRange.Tag.Key, null); }
public static PopupResult Show(Window owner, string messageText, string caption = "", PopupButton button = PopupButton.OK, PopupImage icon = PopupImage.None, PopupResult defaultResult = PopupResult.None, Style messageBoxStyle = null) { return ShowCore(messageText, caption, button, icon, defaultResult, messageBoxStyle); }
protected internal DockPaneStripFromBase(DockPane pane) : base(pane) { SetStyle(ControlStyles.ResizeRedraw, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.SupportsTransparentBackColor, true); SuspendLayout(); Font = SystemInformation.MenuFont; BackColor = Color.FromArgb(228, 226, 213); m_components = new Container(); m_toolTip = new ToolTip(Components); m_buttonClose = new PopupButton(ImageCloseEnabled, ImageCloseDisabled); m_buttonClose.IsActivated = true; m_buttonClose.ActiveBackColorGradientBegin = Color.FromArgb(228, 226, 213); m_buttonClose.ActiveBackColorGradientEnd = Color.FromArgb(228, 226, 213); m_buttonClose.ToolTipText = ToolTipClose; m_buttonClose.Anchor = AnchorStyles.Top || AnchorStyles.Right; m_buttonOptions = new PopupButton(ImageOptionsEnabled, ImageOptionsDisabled); m_buttonOptions.IsActivated = true; m_buttonOptions.ActiveBackColorGradientBegin = Color.FromArgb(228, 226, 213); m_buttonOptions.ActiveBackColorGradientEnd = Color.FromArgb(228, 226, 213); m_buttonOptions.ToolTipText = ToolTipOptions; m_buttonOptions.Anchor = AnchorStyles.Top || AnchorStyles.Right; m_buttonClose.Click += new System.EventHandler(Close_Click); m_buttonOptions.Click += new System.EventHandler(Options_Click); Controls.AddRange(new Control[] {m_buttonClose, m_buttonOptions}); ResumeLayout(); }
IEnumerator Reconnect(PopupButton button, Single seconds) { yield return(new WaitForSeconds(seconds * Time.timeScale)); button.gameObject.GetComponent <UnityEngine.UI.Button>().onClick.Invoke(); }
public PopupButtonPanel () { SuspendLayout (); BackColor = Color.FromArgb (128, 128, 128); Size = new Size (85, 336); InternalBorderStyle = BorderStyle.Fixed3D; recentlyusedButton = new PopupButton (); desktopButton = new PopupButton (); personalButton = new PopupButton (); mycomputerButton = new PopupButton (); networkButton = new PopupButton (); recentlyusedButton.Size = new Size (81, 64); recentlyusedButton.Image = ThemeEngine.Current.Images (UIIcon.PlacesRecentDocuments, 32); recentlyusedButton.BackColor = BackColor; recentlyusedButton.ForeColor = Color.Black; recentlyusedButton.Location = new Point (2, 2); recentlyusedButton.Text = "Recently\nused"; recentlyusedButton.Click += new EventHandler (OnClickButton); desktopButton.Image = ThemeEngine.Current.Images (UIIcon.PlacesDesktop, 32); desktopButton.BackColor = BackColor; desktopButton.ForeColor = Color.Black; desktopButton.Size = new Size (81, 64); desktopButton.Location = new Point (2, 66); desktopButton.Text = "Desktop"; desktopButton.Click += new EventHandler (OnClickButton); personalButton.Image = ThemeEngine.Current.Images (UIIcon.PlacesPersonal, 32); personalButton.BackColor = BackColor; personalButton.ForeColor = Color.Black; personalButton.Size = new Size (81, 64); personalButton.Location = new Point (2, 130); personalButton.Text = "Personal"; personalButton.Click += new EventHandler (OnClickButton); mycomputerButton.Image = ThemeEngine.Current.Images (UIIcon.PlacesMyComputer, 32); mycomputerButton.BackColor = BackColor; mycomputerButton.ForeColor = Color.Black; mycomputerButton.Size = new Size (81, 64); mycomputerButton.Location = new Point (2, 194); mycomputerButton.Text = "My Computer"; mycomputerButton.Click += new EventHandler (OnClickButton); networkButton.Image = ThemeEngine.Current.Images (UIIcon.PlacesMyNetwork, 32); networkButton.BackColor = BackColor; networkButton.ForeColor = Color.Black; networkButton.Size = new Size (81, 64); networkButton.Location = new Point (2, 258); networkButton.Text = "My Network"; networkButton.Click += new EventHandler (OnClickButton); Controls.Add (recentlyusedButton); Controls.Add (desktopButton); Controls.Add (personalButton); Controls.Add (mycomputerButton); Controls.Add (networkButton); ResumeLayout (false); KeyDown += new KeyEventHandler (Key_Down); SetStyle (ControlStyles.StandardClick, false); }
private void MenuItemAbout_Click(object sender, RoutedEventArgs e) { AboutPopup.IsOpen = true; PopupButton.Focus(); }
internal void SetFocusButton (PopupButton button) { if (button == focusButton) return; focusButton = button; #if NET_2_0 OnUIAFocusedItemChanged (); #endif }
/// <summary> /// Initializes an instance of the <c>FolderNavBar</c> class. /// </summary> public FolderNavBar() { PopupButton popupButton = new PopupButton() { DisplayMode = PopupButtonDisplayMode.ButtonOnly, IsRounded = false, IsTransparencyModeEnabled = true }; Image refresh = new Image() { Source = new BitmapImage(new Uri("Resources/Refresh16.png", UriKind.Relative)), Stretch = Stretch.None, VerticalAlignment = System.Windows.VerticalAlignment.Center }; MultiBinding tooltip = new MultiBinding() { Converter = new StringFormatConverter(), ConverterParameter = "{}Refresh {0}" }; PathConverter pathConverter = new PathConverter(); FolderIconConverter imageConverter = new FolderIconConverter(); FolderMenuIconConverter imageMenuConverter = new FolderMenuIconConverter(); this.breadcrumb = new Breadcrumb(); this.breadcrumb.Margin = new Thickness(0); this.breadcrumb.MenuVerticalOffset = -2; this.breadcrumb.AutoMinimizeItemCount = 0; this.breadcrumb.ConvertItem += OnBreadcrumbConvertItem; this.breadcrumb.ImageMinWidth = 16; this.breadcrumb.SetBinding(Breadcrumb.RootItemProperty, new Binding() { Source = this, Path = new PropertyPath("RootNode") }); this.breadcrumb.ItemContainerStyle = CreateRootBreadcrumbItemStyle(imageConverter); this.breadcrumb.ItemTemplate = CreateBreadcrumbItemTemplate(); this.breadcrumb.MenuItemTemplate = CreateMenuItemNormalTemplate(); this.breadcrumb.MenuItemContainerStyle = CreateMenuItemContainerStyle(imageMenuConverter); this.breadcrumb.MenuItemExpandedTemplate = CreateMenuItemExpandedTemplate(); this.breadcrumb.ComboBoxItemTemplate = CreateComboBoxItemTemplate(pathConverter); this.breadcrumb.SetBinding(Control.BackgroundProperty, new Binding("Background") { Source = this, Mode = BindingMode.TwoWay }); this.breadcrumb.SetBinding(Control.BorderThicknessProperty, new Binding("BorderThickness") { Source = this, Mode = BindingMode.TwoWay }); this.breadcrumb.SetBinding(Control.BorderBrushProperty, new Binding("BorderBrush") { Source = this, Mode = BindingMode.TwoWay }); tooltip.Bindings.Add(new Binding() { Source = this.breadcrumb, Path = new PropertyPath("SelectedItem.Entity.Name"), Mode = BindingMode.OneWay }); popupButton.Content = refresh; this.breadcrumb.ActionButtons.Add(popupButton); this.Content = this.breadcrumb; this.history = new ObservableCollection <FolderNavNode>(); this.breadcrumb.ComboBoxItemsSource = history; this.breadcrumb.SelectedItemChanged += OnSelectedItemChanged; this.SetBinding(FolderNavBar.IsEditingProperty, new Binding("IsEditing") { Source = this.breadcrumb }); if (pathConverter != null) { pathConverter.SetBinding(PathConverter.RootProperty, new Binding("RootNode") { Source = this, Mode = BindingMode.OneWay }); } }