protected override void OnDisappearing() { base.OnDisappearing(); ButtonTimer.Elapsed -= ButtonTimer_Elapsed; ButtonTimer.Stop(); }
protected override void OnDisappearing() { base.OnDisappearing(); RemoveEvents(); ButtonTimer.Stop(); }
private void RightButton_Released(object sender, EventArgs e) { ButtonTimer.Stop(); if (DateTime.Now - StartTime >= TimeSpan.FromMilliseconds(TimerInternal)) { return; } if (_elements == null || _elements.Index > _elements.MaxElement() - 1) { return; } ++_elements.Index; RefreshPage(false); }
private void LeftButton_Released(object sender, EventArgs e) { ButtonTimer.Stop(); if (DateTime.Now - StartTime >= TimeSpan.FromMilliseconds(TimerInternal)) { return; } if (_officeElements == null || _officeElements.Index <= 0) { return; } --_officeElements.Index; RefreshPage(); }
private void StartButtonTimer() { ButtonTimer.Interval = ButtonTimerInterval; ButtonTimer.Start(); }
private void OnButtonTimerTick(object sender, EventArgs e) { ButtonTimer.Stop(); ToggleButton.Enabled = SettingsNotDefault; SetButtonDefaults(); }
private void RightButton_Pressed(object sender, EventArgs e) { ButtonTimer.Start(); StartTime = DateTime.Now; LeftRightButton = true; }
private void OnButtonTimerTick(object sender, EventArgs e) { ButtonTimer.Stop(); SetToggleButtonDefault(); SetWriteButtonDefault(); }
// Create UI buttons for the player private void SetupButtons() { // Only create the interface for the local player if (owner.Id != localOwner.Id) { return; } GameObject newButton = Instantiate(buttonPrefab, canvas.gameObject.transform) as GameObject; if (newButton == null) { Debug.Log("Could not instantiate new button"); return; } newButton.transform.localPosition = new Vector3(-220, -220, 0); buttonLeftMelee = newButton.GetComponent <Button>(); ButtonTimer buttonTimer = newButton.GetComponent <ButtonTimer>(); buttonLeftMelee.onClick.AddListener(delegate { buttonTimer.DisableButtonAndStartTimer(meleeDelay); }); buttonLeftMelee.onClick.AddListener(delegate { CreateLeftMeleeUnit(); }); newButton = Instantiate(buttonPrefab, canvas.gameObject.transform) as GameObject; if (newButton == null) { Debug.Log("Could not instantiate new button"); return; } newButton.transform.localPosition = new Vector3(-125, -220, 0); buttonLeftRanged = newButton.GetComponent <Button>(); ButtonTimer buttonTimer2 = newButton.GetComponent <ButtonTimer>(); buttonLeftRanged.onClick.AddListener(delegate { buttonTimer2.DisableButtonAndStartTimer(rangedDelay); }); buttonLeftRanged.onClick.AddListener(delegate { CreateLeftRangedUnit(); }); buttonLeftRanged.GetComponentInChildren <Text>().text = "Left Ranged"; newButton = Instantiate(buttonPrefab, canvas.gameObject.transform) as GameObject; if (newButton == null) { Debug.Log("Could not instantiate new button"); return; } newButton.transform.localPosition = new Vector3(125, -220, 0); buttonRightMelee = newButton.GetComponent <Button>(); ButtonTimer buttonTimer3 = newButton.GetComponent <ButtonTimer>(); buttonRightMelee.onClick.AddListener(delegate { buttonTimer3.DisableButtonAndStartTimer(meleeDelay); }); buttonRightMelee.onClick.AddListener(delegate { CreateRightMeleeUnit(); }); buttonRightMelee.GetComponentInChildren <Text>().text = "Right Melee"; newButton = Instantiate(buttonPrefab, canvas.gameObject.transform) as GameObject; if (newButton == null) { Debug.Log("Could not instantiate new button"); return; } newButton.transform.localPosition = new Vector3(220, -220, 0); buttonRightRanged = newButton.GetComponent <Button>(); ButtonTimer buttonTimer4 = newButton.GetComponent <ButtonTimer>(); buttonRightRanged.onClick.AddListener(delegate { buttonTimer4.DisableButtonAndStartTimer(rangedDelay); }); buttonRightRanged.onClick.AddListener(delegate { CreateRightRangedUnit(); }); buttonRightRanged.GetComponentInChildren <Text>().text = "Right Ranged"; }