/// <summary> /// Constructor of TitleText2Button class /// </summary> public TitleText2Button(string title, string text) { Title = title; Text = text; // Create FirstButton FirstButton = new MenuItem() { // Set icon IconImageSource = ImageSource.FromFile("image/tw_ic_popup_btn_delete.png"), //Set command Command = new Command(() => { ButtonClicked.Invoke(false, new EventArgs()); }) }; // Create SecondButton SecondButton = new MenuItem() { // Set icon IconImageSource = ImageSource.FromFile("image/tw_ic_popup_btn_check.png"), //Set command Command = new Command(() => { ButtonClicked.Invoke(true, new EventArgs()); }) }; //Request to dismiss this popup when back button event occurs BackButtonPressed += (s, e) => { ButtonClicked.Invoke(false, new EventArgs()); }; }
// handling if the "button" to the right of an item is clicked.. private void ListBoxExtension_MouseClick(object sender, MouseEventArgs e) { // if an image is set, assume it will be wanted to be visible as well.. if (_RightImage != null && _RightImageScaled != null) { // get the point where the mouse was clicked.. Point point = new Point(e.X, e.Y); int clickIndex = IndexFromPoint(point); // ..and get an item's index on the point.. if (clickIndex != -1) // if an index was found.. { Point p2 = new Point(e.X, 0); // check if the click hit the "button".. if (RightButtonRectangle.Contains(p2)) { // raise an event for the "button" click if subscribed.. ButtonClicked?.Invoke(this, new ListBoxButtonClickEventArgs() { ItemIndex = clickIndex, Item = Items[clickIndex] }); } else { // raise an event for the item click if subscribed.. ItemClicked?.Invoke(this, new ListBoxButtonClickEventArgs() { ItemIndex = clickIndex, Item = Items[clickIndex] }); } } } }
/// <inheritdoc /> public override bool OnMouseUp(Vector2 location, MouseButton buttons) { if (base.OnMouseUp(location, buttons)) { return(true); } // Check if mouse was pressing if (_isMouseDown) { // Clear flag _isMouseDown = false; // Close topmost context menu ParentContextMenu?.TopmostCM.Hide(); // Auto check logic if (AutoCheck) { Checked = !Checked; } // Fire event Clicked?.Invoke(); ButtonClicked?.Invoke(this); ParentContextMenu?.OnButtonClicked(this); // Event handled return(true); } return(false); }
public bool ButtonClick(ButtonClicked button) { switch (button) { case ButtonClicked.Computer: currentToolStripItem.HasComputer = !currentToolStripItem.HasComputer; ButtonComputer.Checked = currentToolStripItem.HasComputer; currentToolStripItem.Computer = currentToolStripItem.HasComputer ? ComputerName : string.Empty; return(currentToolStripItem.HasComputer); case ButtonClicked.User: currentToolStripItem.HasUser = !currentToolStripItem.HasUser; ButtonUser.Checked = currentToolStripItem.HasUser; currentToolStripItem.User = currentToolStripItem.HasUser ? UserName : string.Empty; return(currentToolStripItem.HasUser); case ButtonClicked.Application: currentToolStripItem.HasApplication = !currentToolStripItem.HasApplication; ButtonApplication.Checked = currentToolStripItem.HasApplication; currentToolStripItem.Application = currentToolStripItem.HasApplication ? ApplicationName : string.Empty; return(currentToolStripItem.HasApplication); default: return(false); } }
private void Button_Clicked(object sender, EventArgs e) { var lbl = sender as Label; if (lbl == null) { return; } // De-select the other controls foreach (var ctl in this.panel1.Controls) { var l = ctl as Label; if (l != null) { l.Tag = ""; l.BackColor = this.panel1.BackColor; } } // Select this control lbl.Tag = "SELECTED"; lbl.BackColor = ButtonSelected; // Tell the world ButtonClicked?.Invoke(lbl, lbl.Name); }
protected override void OnMouseDown(MouseEventArgs e) { OnMouseClick(e); if (MouseOnButton) { MouseState = MouseStates.Pressed; } else { MouseState = MouseStates.Hover; } if (_borderButton.Visible) { // Check if mouse in X position. if ((_xValue > _buttonRectangle.X) && (_xValue < Width)) { // Determine the button middle separator by checking for the Y position. if ((_yValue > _buttonRectangle.Y) && (_yValue < Height)) { ButtonClicked?.Invoke(); } } } Invalidate(); }
private void StartButton_Released(object sender, System.EventArgs e) { if (string.IsNullOrWhiteSpace(Shared.BirdieLib.TwitterConfig.AccessToken) || string.IsNullOrWhiteSpace(Shared.BirdieLib.TwitterConfig.AccessTokenSecret) || (!Shared.BirdieLib.Active && PressedStart.HasValue && PressedStart.Value.AddSeconds(10) <= DateTime.Now)) { // Hold the Start button for 10 seconds to clear Twitter credentials and return to auth screen. --Kris Shared.BirdieLib.TwitterConfig.Clear(); Shared.BirdieLib.TwitterConfig.Save(); Navigation.PushAsync(new TwitterAuth(this)); } else { // Fire event that tells Android/iOS apps that the start/stop button was pressed. --Kris ButtonClickedEventArgs args = new ButtonClickedEventArgs { ClickedAt = DateTime.Now }; ButtonClicked?.Invoke(this, args); /* * if (BirdieLib.Active) * { * BirdieLib.Stop(); * } * else * { * BirdieLib.Start(); * } */ } }
private void toolStripButton_Click(object sender, EventArgs e) { StackBarButton senderButton = (StackBarButton)((ToolStripButton)sender).Tag; if (senderButton == this.selectedButton) { // Just need to re-set the checked status senderButton.Button.Checked = true; } else { foreach (StackBarButton button in buttonList) { button.Button.Checked = false; } senderButton.Button.Checked = true; selectedButton = senderButton; titleLabel.Text = senderButton.Button.Text; if (senderButton.NavigationPaneControl != null) { navigationPanel.SuspendLayout(); navigationPanel.Controls.Clear(); navigationPanel.Controls.Add(senderButton.NavigationPaneControl); navigationPanel.ResumeLayout(); } if (ButtonClicked != null) { ButtonClicked.Invoke(senderButton, EventArgs.Empty); } } }
/// <summary> /// Sets the button list to the indicated titles. /// </summary> /// <param name="buttonTitles">The button titles.</param> public void SetButtons(List <string> buttonTitles) { RemoveAllViews(); for (int i = 0; i < buttonTitles.Count; i++) { var button = new MenuButton(Context) { Title = buttonTitles[i], Tag = i, LayoutParameters = new LayoutParams(ViewGroup.LayoutParams.WrapContent, Height / 2) }; button.Click += (sender, e) => { ButtonClicked?.Invoke(this, new ButtonClickEventArgs(( int )(( Button )sender).Tag)); }; button.FocusChange += (sender, e) => { if (e.HasFocus) { LastFocusedButton = ( int )(( Button )sender).Tag; } }; AddView(button); } }
private void OnButtonClicked(ButtonClicked Click) { if (Click.Button == gameObject) { EventManager.instance.Fire(new GameSceneMenuClose()); } }
// to do: debugmode, stat public override void Load() { // Since we are using hooks not in older versions, and since ItemID.Count changed, we need to do this. if (ModLoader.version < new Version(0, 10, 1, 3)) { throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n"); } instance = this; ButtonClicked.Clear(); ButtonTexture.Clear(); ButtonTooltip.Clear(); ToggleCheatSheetHotbarHotKey = RegisterHotKey("Toggle Cheat Sheet Hotbar", "K"); if (Main.rand == null) { Main.rand = new Terraria.Utilities.UnifiedRandom(); } FieldInfo translationsField = typeof(Mod).GetField("translations", BindingFlags.Instance | BindingFlags.NonPublic); translations = (Dictionary <string, ModTranslation>)translationsField.GetValue(this); //LoadTranslations(); }
private void LinkClicked(object arg) { if (ButtonClicked != null) { ButtonClickedEventArgs args; string str = arg.ToString(); switch (str) { case "Reply": args = new ButtonClickedEventArgs(ButtonType.Reply); break; case "Modify": args = new ButtonClickedEventArgs(ButtonType.Edit); break; case "Delete": args = new ButtonClickedEventArgs(ButtonType.Delete); break; default: throw new NotSupportedException(str); } args.SelectedItem = DataContext as FeedItem; //Change to ButtonClicked ButtonClicked.Invoke(this, args); } }
private void RayToDoor() { Ray ray = new Ray(playerView.transform.position, playerView.transform.forward); RaycastHit hit; if (Physics.Raycast(ray, out hit, MAXDISTANCEOFRAY)) { if (Input.GetKeyDown(leftMouseKeyDown)) { if (hit.collider.gameObject.layer == LayerMask.NameToLayer("Buttons")) { currentButtonState = hit.collider.gameObject.GetComponent <ButtonClicked>(); currentDoorTransform = hit.collider.gameObject.GetComponentInParent <DoorIsOpenedAndClosed>(); doorOpenCloseSound = hit.collider.gameObject.GetComponentInParent <DoorOpenColseSound>(); currentButtonState.ButtonClick(); doorOpenCloseSound.PlayClip(); if (emergencyLights.GetLightState() != LightsState.Off) { currentDoorTransform.SetDoorIsOpened(); } } } } }
private void Button_Clicked(object sender, ButtonClickedEventArgs args) { if (ButtonClicked != null) { ButtonClicked.Invoke(sender, args); } }
// to do: debugmode, stat public override void Load() { // Since we are using hooks not in older versions, and since ItemID.Count changed, we need to do this. if (ModLoader.version < new Version(0, 10)) { throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n"); } instance = this; ButtonClicked.Clear(); ButtonTexture.Clear(); ButtonTooltip.Clear(); ToggleCheatSheetHotbarHotKey = RegisterHotKey("Toggle Cheat Sheet Hotbar", "K"); if (Main.rand == null) { Main.rand = new Terraria.Utilities.UnifiedRandom(); } ModTranslation text = CreateTranslation("ButcherNotification"); text.SetDefault("NPCs were butchered by {0}"); AddTranslation(text); text = CreateTranslation("VacuumNotification"); text.SetDefault("Items on the ground were vacuumed by {0}"); AddTranslation(text); text = CreateTranslation("SpawnNPCNotification"); text.SetDefault("Spawned {0} by {1}"); AddTranslation(text); text = CreateTranslation("VolcanoWarning"); text.SetDefault("Did you hear something....A Volcano! Find Cover!"); AddTranslation(text); }
/// <summary> /// Sends out event that button has been right clicked /// </summary> protected virtual void OnButtonClicked() { if (ActiveInWindow) { ButtonClicked?.Invoke(this, mEventArgs); } }
} // buttonFullView_Click private void buttonEpgGrid_Click(object sender, EventArgs e) { ButtonClicked?.Invoke(this, new EpgMiniBarButtonClickedEventArgs(Button.EpgGrid)); // There's no automatic action for this button // It must be handled by the owner } // buttonEpgGrid_Click
private void UserControl_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEventArgs args) { args.Handled = true; ButtonClicked?.Invoke(this, new RoutedEventArgs()); ToggleMenu(); }
protected virtual void OnNewButtonClick(EventArgs e) { if (ButtonClicked != null) { ButtonClicked.Invoke(this, null); } }
private void applyButton_Click(object sender, EventArgs e) { if (ButtonClicked != null) { ButtonClicked.Invoke(sender, e); } applyButton.Enabled = false; }
private void OnButtonClicked(ButtonClicked Click) { if (Click.Button == gameObject) { Debug.Log("ggg"); Application.Quit(); } }
void OnCancelButtonClick(object sender, RoutedEventArgs e) { if (!m_modal) { ButtonClicked?.Invoke(sender, e, false); Close(); } }
public void SetupPanel( TenderTypePanelType tpType, List <PairType <TenderTypeButton, bool> > enableFlags, ButtonClicked buttonClickedFxn) { //InitializeComponent(); this.initPanel(tpType, enableFlags, buttonClickedFxn); }
private void OnButtonClicked(ButtonClicked Click) { if (Click.Button == gameObject) { EventManager.instance.Fire(new EnterMenu(ControlMenu)); EventManager.instance.Fire(new ExitMenu(transform.parent.gameObject)); } }
public void OnButton3Clicked() { Button3ClickCount++; // Log event by type; name will be derived from class name, and object contents will be serialized into JSON data ButtonClicked data = new ButtonClicked("Button 3", Button2ClickCount); LogSession.Log(data); }
private void Button_OnClick(object sender, RoutedEventArgs e) { FillCircle(true); if (HandIsVisible == false) { HandIsVisible = true; } ButtonClicked?.Invoke(this, null); }
public void RegisterButton(Texture2D texture, Action buttonClickedAction, Func <string> tooltip) { ButtonClicked.Add(buttonClickedAction); ButtonTexture.Add(texture); ButtonTooltip.Add(tooltip); //ErrorLogger.Log("1 "+ButtonClicked.Count); //ErrorLogger.Log("2 "+ ButtonTexture.Count); //ErrorLogger.Log("3 "+ ButtonTooltip.Count); }
private void button1_Click(object sender, EventArgs e) { ButtonClicked?.Invoke(this, new AddNodeEventArgs(comboBox1.Text)); if (!comboBox1.Items.Contains(comboBox1.Text)) { comboBox1.Items.Add(comboBox1.Text); } }
private void OnButtonClicked(ButtonClicked B) { if (B.Button == gameObject) { EventManager.instance.Fire(new QuitGame(false)); AcrossSceneInfo.AcrossGameLevel = false; SceneManager.LoadScene("MainPage", LoadSceneMode.Single); } }
} // buttonDisplayChannel_Click private void buttonRecordChannel_Click(object sender, EventArgs e) { ButtonClicked?.Invoke(this, new EpgMiniBarButtonClickedEventArgs(Button.Record)); if (ManualActions) { return; } RecordHelper.RecordProgram(ParentForm as CommonBaseForm, SelectedService, SelectedProgram, LocalReferenceTime, true); } // buttonRecordChannel_Click
public static UIButton MakeButton(UIPanel panel, string name, string text, Vector2 position, ButtonClicked clicked) { var button = panel.AddUIComponent<UIButton>(); button.name = name; button.text = text; button.relativePosition = position; button.size = new Vector2(200.0f, 24.0f); button.normalBgSprite = "ButtonMenu"; button.disabledBgSprite = "ButtonMenuDisabled"; button.hoveredBgSprite = "ButtonMenuHovered"; button.focusedBgSprite = "ButtonMenu"; button.pressedBgSprite = "ButtonMenuPressed"; button.textScale = 0.8f; button.eventClick += (component, param) => clicked(); return button; }
private void SetButtons(ButtonClicked button) { switch (button) { case ButtonClicked.Play: var template = btnPlay.Template; var imageControl = (Image)template.FindName("imagePlay", btnPlay); var uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPlayMouseOverSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); //playImage.Source = new BitmapImage(uriSource); template = btnStop.Template; imageControl = (Image)template.FindName("imageStop", btnStop); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnStopSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); template = btnPause.Template; imageControl = (Image)template.FindName("imagePause", btnPause); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPauseSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); lstNowPlaying.Focus(); break; case ButtonClicked.Stop: template = btnPlay.Template; imageControl = (Image)template.FindName("imagePlay", btnPlay); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPlaySmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); //playImage.Source = new BitmapImage(uriSource); template = btnStop.Template; imageControl = (Image)template.FindName("imageStop", btnStop); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnStopMouseOverSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); template = btnPause.Template; imageControl = (Image)template.FindName("imagePause", btnPause); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPauseSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); lstNowPlaying.Focus(); break; case ButtonClicked.Pause: if (isPaused) { template = btnPlay.Template; imageControl = (Image)template.FindName("imagePlay", btnPlay); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPlaySmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); // playImage.Source = new BitmapImage(uriSource); template = btnStop.Template; imageControl = (Image)template.FindName("imageStop", btnStop); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnStopSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); template = btnPause.Template; imageControl = (Image)template.FindName("imagePause", btnPause); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPauseMouseOverSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); } else { template = btnPlay.Template; imageControl = (Image)template.FindName("imagePlay", btnPlay); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPlayMouseOverSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); template = btnStop.Template; imageControl = (Image)template.FindName("imageStop", btnStop); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnStopSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); template = btnPause.Template; imageControl = (Image)template.FindName("imagePause", btnPause); uriSource = new Uri(@"/WhisperingAudioMusicPlayer;component/images/btnPauseSmall.png", UriKind.Relative); imageControl.Source = new BitmapImage(uriSource); lstNowPlaying.Focus(); } break; } }
/// <summary> /// This method sets the paging and binds the details table /// </summary> /// <param name="entitySetDetails">object of type EntitySetDetails</param> /// <param name="buttonClicked">value of the type ButtonClicked</param> /// <param name="stack">Stack used for storing ContinuationTokens</param> private void SetPagingAndBind(EntitySetDetails entitySetDetails, ButtonClicked buttonClicked, Stack<ContinuationToken> stack) { // Initially disable both ViewData viewDataModel.NextEnable = false; viewDataModel.PrevEnable = false; // If data exists in the DetailsTable if (entitySetDetails.DetailsTable.Rows.Count != 0) { switch (buttonClicked) { // Run case ButtonClicked.Run: // Add code to disable Previous Link viewDataModel.PrevEnable = false; stack = new Stack<ContinuationToken>(); // If NextPartitionKey and NextRowKey exists if (!string.IsNullOrEmpty(entitySetDetails.NextPartitionKey) && !string.IsNullOrEmpty(entitySetDetails.NextRowKey)) { var nextContinuationToken = new ContinuationToken { NextPartitionKey = entitySetDetails.NextPartitionKey, NextRowKey = entitySetDetails.NextRowKey, Skip = entitySetDetails.Skip }; // push the ContinuationToken stack.Push(nextContinuationToken); // Add code to enable Next Link viewDataModel.NextEnable = true; } if (stack.Count == 0) { // Add code to disable Next Link viewDataModel.NextEnable = false; } break; // Previous case ButtonClicked.Previous: if (stack.Count == 1) { // Add code to disable Previous Link viewDataModel.PrevEnable = false; } else { // Add code to enable Previous Link viewDataModel.PrevEnable = true; } // Add code to enable Next Link viewDataModel.NextEnable = true; break; // Next case ButtonClicked.Next: // If NextPartitionKey and NextRowKey exists if (!string.IsNullOrEmpty(entitySetDetails.NextPartitionKey) && !string.IsNullOrEmpty(entitySetDetails.NextRowKey)) { var nextContinuationToken = new ContinuationToken { NextPartitionKey = entitySetDetails.NextPartitionKey, NextRowKey = entitySetDetails.NextRowKey, Skip = entitySetDetails.Skip }; // push the ContinuationToken stack.Push(nextContinuationToken); // Add code to enable Next Link viewDataModel.NextEnable = true; // Add code to enable Previous Link viewDataModel.PrevEnable = true; } else { // The else condition means there are no more pages of data. // The PreviousLink click handler ALWAYS throws away what // is on top of the stack. Therefore, we add a bogus token. stack.Push(new ContinuationToken { NextPartitionKey = "X", NextRowKey = "X" }); // Add code to enable Previous Link viewDataModel.PrevEnable = true; // Add code to disable Next Link viewDataModel.NextEnable = false; } break; } if (Session["ContinuationTokenStack"] != null) Session.Remove("ContinuationTokenStack"); Session.Add("ContinuationTokenStack", stack); viewDataModel.TableBrowserData = entitySetDetails.DetailsTable; } else { ShowError(UIConstants.DBPC_ErrorZeroResults, UIConstants.DBPC_ErrorChkQuery); } }
private static UIButton MakeButton(UIPanel panel, string name, string text, float y, ButtonClicked clicked) { var button = panel.AddUIComponent<UIButton>(); button.name = name; button.text = text; button.relativePosition = new Vector3(200.0f, y - 6.0f); button.size = new Vector2(100.0f, 24.0f); button.normalBgSprite = "ButtonMenu"; button.disabledBgSprite = "ButtonMenuDisabled"; button.hoveredBgSprite = "ButtonMenuHovered"; button.focusedBgSprite = "ButtonMenu"; button.pressedBgSprite = "ButtonMenuPressed"; button.eventClick += (component, param) => { clicked(); }; return button; }
public void AddResetButtonClicked(ButtonClicked h) { this.resetButton.Click += (o, eA) => h(); }