473,396 Members | 1,996 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,396 software developers and data experts.

Run a timer on a different thread

Hi,

I have an application which does some file manipulation. While the file
manipulation takes place, the timer in the statusbar freezes.

How can I tell the timer to run on a different thread?

Also, my UI freezes if there is a big file to move. I have a label on the
form which shows the current file being copied and the number of files still
to be copied, but once a big file is encountered, it never updates these
details. The work goes on in the background, it is just the form which
doesn't update.

Can anyone suggest a reason for this and a possible solution?

Thanks,

Cashdeskmac
May 8 '07 #1
4 9962
On May 8, 9:48 am, cashdeskmac <cashdesk...@discussions.microsoft.com>
wrote:
I have an application which does some file manipulation. While the file
manipulation takes place, the timer in the statusbar freezes.

How can I tell the timer to run on a different thread?
Either keep using a windows forms timer, but when the timer is
invoked, perform the operation itself on a different thread; or use a
different timer. See
http://pobox.com/~skeet/csharp/threads/timers.shtml
Also, my UI freezes if there is a big file to move. I have a label on the
form which shows the current file being copied and the number of files still
to be copied, but once a big file is encountered, it never updates these
details. The work goes on in the background, it is just the form which
doesn't update.
How are you trying to copy the file, and how are you trying to update
the UI?

Jon

May 8 '07 #2
Guess you are doing some thing in wrong. Now, change the code so that the
file manipulation is done on a seperate thread and let the timer be on the
main thread. So that you have control on both the process.

By doing this, you are file handling thread doesn't have to take control on
your winform and freeze all the controls.

For more indetail, post the code here. so that we can help you to finetune
the code.

HTH
--
Every thing is perfect, as long as you share!!!

Don't forget to rate the post
"cashdeskmac" wrote:
Hi,

I have an application which does some file manipulation. While the file
manipulation takes place, the timer in the statusbar freezes.

How can I tell the timer to run on a different thread?

Also, my UI freezes if there is a big file to move. I have a label on the
form which shows the current file being copied and the number of files still
to be copied, but once a big file is encountered, it never updates these
details. The work goes on in the background, it is just the form which
doesn't update.

Can anyone suggest a reason for this and a possible solution?

Thanks,

Cashdeskmac
May 8 '07 #3
Thanks, Chakravarthy. I will try running the file manipoulation on a
different thread.

"Chakravarthy" wrote:
Guess you are doing some thing in wrong. Now, change the code so that the
file manipulation is done on a seperate thread and let the timer be on the
main thread. So that you have control on both the process.

By doing this, you are file handling thread doesn't have to take control on
your winform and freeze all the controls.

For more indetail, post the code here. so that we can help you to finetune
the code.

HTH
--
Every thing is perfect, as long as you share!!!

Don't forget to rate the post
"cashdeskmac" wrote:
Hi,

I have an application which does some file manipulation. While the file
manipulation takes place, the timer in the statusbar freezes.

How can I tell the timer to run on a different thread?

Also, my UI freezes if there is a big file to move. I have a label on the
form which shows the current file being copied and the number of files still
to be copied, but once a big file is encountered, it never updates these
details. The work goes on in the background, it is just the form which
doesn't update.

Can anyone suggest a reason for this and a possible solution?

Thanks,

Cashdeskmac
May 8 '07 #4
Post back if you require any further code support. Meanwhile dont forget to
rate this post
--
Every thing is perfect, as long as you share!!!

Don''t forget to rate the post
"cashdeskmac" wrote:
Thanks, Chakravarthy. I will try running the file manipoulation on a
different thread.

"Chakravarthy" wrote:
Guess you are doing some thing in wrong. Now, change the code so that the
file manipulation is done on a seperate thread and let the timer be on the
main thread. So that you have control on both the process.

By doing this, you are file handling thread doesn't have to take control on
your winform and freeze all the controls.

For more indetail, post the code here. so that we can help you to finetune
the code.

HTH
--
Every thing is perfect, as long as you share!!!

Don't forget to rate the post
"cashdeskmac" wrote:
Hi,
>
I have an application which does some file manipulation. While the file
manipulation takes place, the timer in the statusbar freezes.
>
How can I tell the timer to run on a different thread?
>
Also, my UI freezes if there is a big file to move. I have a label on the
form which shows the current file being copied and the number of files still
to be copied, but once a big file is encountered, it never updates these
details. The work goes on in the background, it is just the form which
doesn't update.
>
Can anyone suggest a reason for this and a possible solution?
>
Thanks,
>
Cashdeskmac
May 9 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

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: Jakub Moskal | last post by:
Hi, I want to write a benchmark that will measure performance of several different algorithms for the same problem. There is a set time bound though, the algorithm cannot run longer than n...
7
by: RobKinney1 | last post by:
Hello, Wow...I have one for you all and hopefully I am not understanding this timer object correctly. I have a timer setup that pulses a connection through a socket every 60 seconds. But it...
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
11
by: =?Utf-8?B?RXJpYw==?= | last post by:
I'm coming from Win32 world. Now, I'm porting the existing code to C#. I cannot find the equivalent Win32 Waitable Timer in C#. I have a thread to perform some task periodically like following: ...
5
by: Peted | last post by:
i have an mdi application with two child forms Childform A and childform B in a nutshell Childform B has a timer with a routine that polls a ip socket for information every 30sec.
2
by: RP | last post by:
I have a Timer control on a form. When this Timer starts, it will do certain task on every tick. I want that this Timer be linked to a new thread so that the Timer does not disturb other...
1
by: Lou | last post by:
Do these run on a separate thread? I created a COM .NET class and use the timer in this class to call a private function of the class. If I use this COM dll in a VB6 app, does the function...
5
by: Kate77 | last post by:
Hello, Im trying to do something very simple but having problems.. What I want to accomplish sounds simple but I cant find anywhere on the web answer of how to do that so it will work. I want...
3
by: Steve | last post by:
Hi All I am using VB.net 2008 and use timer controls within my applications Question Does the code in a Timer control.tick event run on a different thread to the main Application thread (UI...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.