/// <summary> /// Schedule a timer event to switch to editing mode after a given time. /// </summary> private void ScheduleStartEditing() { if (!Editable) { return; } // Get the double-click delay from the user's preferences, set in the Windows Control Panel int DoubleClickTime = System.Windows.Forms.SystemInformation.DoubleClickTime; TimeSpan MinimumDelay = TimeSpan.FromMilliseconds(DoubleClickTime); TimeSpan ActualDelay = ClickDelay >= MinimumDelay ? ClickDelay : MinimumDelay; StartEditingTimer.Change(ActualDelay, Timeout.InfiniteTimeSpan); }
/// <summary> /// Cancel the timer event scheduled by ScheduleStartEditing, for instance in case of a double-click. /// </summary> private void CancelStartEditing() { StartEditingTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); }