1
Vote

Double Click Manager Problem

description

Hello,
 
Your double click manager was a huge help. Thanks!
 
I did notice one thing. When i double clicked and came back and triple click a few times it would continue to trigger a double click even when i didn't double click. When I moved a few lines of code around I appear to have gotten rid of my problem. I thought I'd pass it along.
 
BEFORE:
    /// <summary>
    /// Resets the clicked flag after timeout.
    /// </summary>
    /// <param name="state">The state.</param>
    private void ResetThread(object state)
    {
        Thread.Sleep(this.Timeout);
 
        lock (this)
        {
            if (this.Clicked)
            {
                this.Clicked = false;
                OnClick(this, (MouseButtonEventArgs)state);
            }
        }
    }
 
AFTER:
    /// <summary>
    /// Resets the clicked flag after timeout.
    /// </summary>
    /// <param name="state">The state.</param>
    private void ResetThread(object state)
    {
        Thread.Sleep(this.Timeout);
 
        lock (this)
        {
            if (this.Clicked)
            {
                OnClick(this, (MouseButtonEventArgs)state);
            }
            this.Clicked = false;
        }
    }
 
-Andrew

comments