public override void Update(DwarfTime time) { ClickTimer.Update(time); if (IsMouseOver && !IsDead) { //GUI.FocusComponent = Parent; MouseState mouse = Mouse.GetState(); float normalizedX = Math.Min(Math.Max(((float)mouse.X - (float)GlobalBounds.X) / GlobalBounds.Width, 0), 1.0f); int nearestColumn = (int)(normalizedX * Columns.Count); if (nearestColumn >= 0 && nearestColumn < Columns.Count) { Vector2 colMeasure = MeasureColumn(Columns[nearestColumn]); float normalizedY = Math.Min(Math.Max(((float)mouse.Y - (float)GlobalBounds.Y) / colMeasure.Y, 0), 1.0f); int nearestRow = (int)(normalizedY * Columns[nearestColumn].Count); if (nearestRow >= 0 && nearestRow < Columns[nearestColumn].Count) { CurrentValue = Columns[nearestColumn][nearestRow]; Box.CurrentValue = CurrentValue; } } } else { //GUI.FocusComponent = null; } base.Update(time); }
//clike twice, set IsInEditMode = true; private void TextBlock_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (e.ClickCount > 1) { ClickTimer.Stop(); } else { this._startMousePosition = e.GetPosition(this); ClickTimer.Start(); } }
private void btnStart_Click(object sender, EventArgs e) { System.Threading.Thread.Sleep(START_DELAY); if (TimerEnabled) { ClickTimer.Enabled = true; ClickTimer.Start(); } else { ClickTimer_Tick(null, null); } }
public void CallBack() { if (Flag == 0) { ClickTimer.Start(); Flag = 1; } else { ClickTimer.Stop(); Flag = 0; } }
private void RightClick_Click(object sender, EventArgs e) { if (LeftClick.Checked) { LeftClick.Checked = false; } else { LeftClick.Checked = true; } ClickTimer.Stop(); }
/// <summary> /// Resets the timer /// </summary> protected override void ResetTimer(DispatcherTimer timer) { timer.Stop(); if (timer == ClickTimer) { ClickTicks = 0; } else { AfterClickTicks = 0; if (HandIsOverButton) { ClickTimer.Start(); } } }
void Start() { if (!string.IsNullOrEmpty(name)) { NameText.text = name; } if (!EditorApplication.isPlaying) { return; } basesText.text = numOfBases.ToString(); timer = GetComponentInChildren <ClickTimer>(); UpdateStats(); timer.startTimer(countdownTime); }
private void ClickTimer_Tick(object sender, EventArgs e) { int X = Cursor.Position.X; int Y = Cursor.Position.Y; if (LeftClick.Checked) { mouse_event(MOUSEEVENTF_LEFTDOWN | MOUSEEVENTF_LEFTUP, X, Y, 0, 0); //Call the imported function with the cursor's current position } else if (RightClick.Checked) { mouse_event(MOUSEEVENTF_RIGHTDOWN | MOUSEEVENTF_RIGHTUP, X, Y, 0, 0); //Call the imported function with the cursor's current position } else { ClickTimer.Stop(); } }
void ClickTimer_Elapsed(object sender, ElapsedEventArgs e) { ClickTimer.Stop(); if (++nClickCount > 1) { this.mainControl.Dispatcher.Invoke( new Action( delegate { var endMousePosition = Mouse.GetPosition(this); var distance = Math.Sqrt(Math.Pow(this._startMousePosition.X - endMousePosition.X, 2) + Math.Pow(this._startMousePosition.Y - endMousePosition.Y, 2)); if (distance < 2d) { this.nClickCount = 0; this.mainControl.IsInEditMode = true; } } ) ); } }
protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == 0x0312) { /* Note that the three lines below are not needed if you only want to register one hotkey. * The below lines are useful in case you want to register multiple keys, which you can use a switch with the id as argument, or if you want to know which key/modifier was pressed for some particular reason. */ //Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF); // The key of the hotkey that was pressed. //KeyModifier modifier = (KeyModifier)((int)m.LParam & 0xFFFF); // The modifier of the hotkey that was pressed. //int id = m.WParam.ToInt32(); // The id of the hotkey that was pressed. if (ClickTimer.Enabled) { ClickTimer.Stop(); } else { ClickTimer.Start(); } } }
// Invoked when we exit edit mode. void TextBox_LostFocus(object sender, RoutedEventArgs e) { this.IsInEditMode = false; ClickTimer.Stop(); nClickCount = 0; }
/// <summary> /// Handles HandCursorEnter event /// </summary> protected void KinectButton_HandCursorEnter(object sender, HandCursorEventArgs args) { _handIsOverButton = true; ClickTimer.Start(); }
private void btnStop_Click(object sender, EventArgs e) { ClickTimer.Stop(); }
private void delayNum_ValueChanged(object sender, EventArgs e) { ClickTimer.Interval = int.Parse(delayNum.Value.ToString()); ClickTimer.Stop(); }