473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Timers and NotifyIcons in C#

1
i am working on a application which has timers set up in it as
System.Threading.Timer timer = new System.Threading.Timer(timerDelegate, autoEvent, new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, -1));


now when i am trying to support this application in task bar, using notifyIcons --- whenever i try to close the app, the icon doesn't go away and the application keeps on running in task manager, untill i again click on icon (just clicking on icon serves, no need to select any option)


Actually the timers are running as below, cause i want them to run continuosly with doing some calculation every 12 hours

Expand|Select|Wrap|Line Numbers
  1. private void Form1_Load(object sender, EventArgs e)
  2.         {
  3.             while (true)
  4.             {
  5.                 if (x == 0)
  6.                 {
  7.                     System.Threading.Timer timer = new System.Threading.Timer(timerDelegate, autoEvent, new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 0, 0, -1));
  8.                     autoEvent.WaitOne();
  9.                     x++;
  10.                 }
  11.                 else if (x == 1)
  12.                 {
  13.                     System.Threading.Timer timer = new System.Threading.Timer(timerDelegate, autoEvent, new TimeSpan(12, 0, 0), new TimeSpan(0, 0, 0, 0, -1));
  14.                     autoEvent.WaitOne();
  15.                 }
  16.             }
  17. }
Dec 7 '09 #1
1 1816
tlhintoq
3,525 Expert 2GB
TIP: When you are writing your question, there is a button on the tool bar that wraps the [code] tags around your copy/pasted code. It helps a bunch. Its the button with a '#' on it. More on tags. They're cool. Check'em out.
Dec 7 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: GDumencu | last post by:
I have a C# program that have to run all the time. For some reasons I cannot make it a service. This program has 3 timers and by time to time ( days or weeks) one of them stops. Some times, starts...
0
by: Dmitry Demchuk | last post by:
Hi everybody. Recently I ran into situation with System.Threading.Timer in my ASP.NET application. I reinstalled Windows on one of my servers and got timers stop firing events after while, they...
0
by: Cider123 | last post by:
I was originally using: System.Windows.Forms.Timer It started to lock my Window Service up, so I went to the next evolution: System.Threading.Timer All was good. I was using it to send...
3
by: Nathan Kovac | last post by:
I have a feeling I am missing something simple, but I just can't find it. Perhaps someone can give me a lead on where to look. I will describe the issue then post my code to the web service. My...
3
by: Jeff Greenland | last post by:
Hello everyone, I am having problems with Timers in a web application. They just seem to stop running after 15 minutes or so. My web application is set up like this: When a user hits a...
9
by: Mark Rae | last post by:
Hi, I've seen several articles about using System Timers in ASP.NET solutions, specifically setting them up in Global.asax' Application_OnStart event. I'm thinking about the scenario where I...
5
by: Michael C# | last post by:
Hi all, I set up a System.Timers.Time in my app. The code basically just updates the screen, but since the processing performed is so CPU-intensive, I wanted to make sure it gets updated...
1
by: | last post by:
Frustrated.. (I have seen other posts regarding this problem with no resolution..) I am using dotnet 1.1 with latest SP on a Win2KP box (actually 2 boxes), have even run the service on WinXP SP2...
1
by: Jonathan Woods | last post by:
Hi there, I have three methods these need to execute at every interval time. I would like to know which option is better? Option A) Three System.Timers.Timer objects these execute each...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.