Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8511385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:58:34+00:00 2026-06-11T03:58:34+00:00

I am writting some code in a wpf and I have a mouse that

  • 0

I am writting some code in a wpf and I have a mouse that performs a click if the cursor stands still for a few seconds..I want to stop clicking if I open a new wpf window that i created…But it seems that dispachers doesn’t stop, even if I tried almost everything…Is there any way??

   public DispatcherTimer NewDispacher = new DispatcherTimer();
   public DispatcherTimer NewDispacher2 = new DispatcherTimer();

   public void CreateDispachers() 
   {
       NewDispacher.Tick += new EventHandler(NewDispacher_Tick);
       NewDispacher.Interval = new TimeSpan(0, 0, 0, 0, 10);
       NewDispacher.Start();
       NewDispacher2.Tick += new EventHandler(NewDispacher2_Tick);
       NewDispacher2.Interval = new TimeSpan(0, 0, 0, 4);
       NewDispacher2.Start();
   }

   public void NewDispacher_Tick(object sender, EventArgs e)
    {
        pointcur = GetCursorPosition(); 
    }

   public void NewDispacher2_Tick(object sender, EventArgs e)
    {
        pointdiff = GetCursorPosition();
        if(form1opened==true)
        {   
             NewDispacher.Stop();
             NewDispacher = null;
             NewDispacher2.Stop();
             NewDispacher2 = null;
        }
        else if ((pointdiff.X >= pointcur.X - 5) 
                 && (pointdiff.X <= pointcur.X + 5) 
                 && (pointdiff.Y >= pointcur.Y - 5) 
                 && (pointdiff.Y <= pointdiff.Y + 5))
        {
            DoMouseClick();
            pointcur.X = 0;
        }

    }

I make the bool Form1opened=true when the new Form is opened, but even if it gets into the if, dispachers doesn’t stop…
Thanks in advance..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:58:36+00:00Added an answer on June 11, 2026 at 3:58 am

    The fact is, Stop() *emphasized text*does*emphasized text* stop a DispatcherTimer in its tracks. So there must be an explanation elsewhere in your code. Perhaps you are restarting the timer somehow? Check when the code can execute that instantiates/starts the timers, in case it’s getting called again unintentionally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

see by writting some code here we select that code & press ctrl +
I'm writing some code that will take a screenshot of another application, given its'
I am writing some code that will go through a file, edit it as
I'm writing some code (just for fun so far) in Python that will store
I'm writing some code that has a lot of substitution. There's a list<char> productions
I am writing some code that connects to a website, and using C#, and
I'm writing some WPF code involving Adorners. I'm using Josh Smith's UIElementAdorner.cs (found in
I have some commercial equipment that I can connect to with a .Net library
I need to implement some kind of RBAC for a WPF app that I'm
I'm writting some code to explore the bookmarks of Firefox ( https://developer.mozilla.org/en/Retrieving_part_of_the_bookmarks_tree ) and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.