Technology Questions

Go Back   Technology Questions > Hardware Questions > Electronics > Pocket PC General

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 07-04-2007, 07:20 AM
Luckcao
Newsgroup Contributor
 
Posts: n/a
System time(minute) change event doesn't raise per minute.

I wrote the following code to write the current datetime into a txt file per
minute in .Net CF2.0 version:

SystemState s = new SystemState(SystemProperty.Time);
s.Changed += new ChangeEventHandler(s_Changed);

void s_Changed(object sender, ChangeEventArgs args)
{
FileStream fsMyfile = new FileStream("\Program Files\Sender\1.txt",
FileMode.Append, FileAccess.Write);
StreamWriter swMyfile = new StreamWriter(fsMyfile);
swMyfile.WriteLine("CurrentDateTime:" + DateTime.Now.ToString());
swMyfile.Flush();
swMyfile.Close();
}

I wrote this code according to the sample in WM6 SDK.
But, after few hours, I checked the txt file, it didn't write the system
time per minute.
The Actual Results as follow:
CurrentDateTime:07-6-30 17:37:02
CurrentDateTime:07-6-30 17:38:02
CurrentDateTime:07-6-30 17:39:02
CurrentDateTime:07-6-30 19:03:38
CurrentDateTime:07-6-30 19:04:03
CurrentDateTime:07-6-30 19:05:03
CurrentDateTime:07-6-30 19:10:51
CurrentDateTime:07-6-30 19:11:02
CurrentDateTime:07-6-30 19:12:02
CurrentDateTime:07-6-30 19:13:02

During 07-6-30 17:39:02 to 07-6-30 19:03:38, I didn't use my mobile. So, I
think, maybe it's the problem.

Then I tried the System.Threading.Timer also. It's same problem as above.
When the screen turn off, then the system will not raise the timer tick event
again.

I don't know it's the .Net CF2.0's bug or not.

So, I submit it here.

Could you help me on it?

Thanks a lot!

=============================
btw, What I want to do is to monitor a directory, If got any file, then
process it and cut it to other folder.

It looks like a Service. Right?
I found a lot of documents that talk about how to create Service in VC++,
but, I don't know anything about VC++, I just know C#.

Could you teach me to create a service by C#?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 07-04-2007, 07:20 AM
  #2 (permalink)  
Old 07-07-2007, 02:20 PM
r_z_aret@pen_fact.com
Newsgroup Contributor
 
Posts: n/a
Re: System time(minute) change event doesn't raise per minute.

Questions about programming are far more likely to get useful answers
if asked in a newsgroup for programmers. I just used google
(http://groups.google.com/advanced_group_search) to look up
systemstate cf
and got 349 hits. I took a quick look and didn't see anything directly
relevant. But I sure saw leads to a more likely newsgroup.

On Wed, 4 Jul 2007 07:16:17 -0700, Luckcao
<Luckcao@discussions.microsoft.com> wrote:

>I wrote the following code to write the current datetime into a txt file per
>minute in .Net CF2.0 version:
>
>SystemState s = new SystemState(SystemProperty.Time);
>s.Changed += new ChangeEventHandler(s_Changed);
>
>void s_Changed(object sender, ChangeEventArgs args)
>{
> FileStream fsMyfile = new FileStream("\Program Files\Sender\1.txt",
>FileMode.Append, FileAccess.Write);
> StreamWriter swMyfile = new StreamWriter(fsMyfile);
> swMyfile.WriteLine("CurrentDateTime:" + DateTime.Now.ToString());
> swMyfile.Flush();
> swMyfile.Close();
>}
>
>I wrote this code according to the sample in WM6 SDK.
>But, after few hours, I checked the txt file, it didn't write the system
>time per minute.
>The Actual Results as follow:
>CurrentDateTime:07-6-30 17:37:02
>CurrentDateTime:07-6-30 17:38:02
>CurrentDateTime:07-6-30 17:39:02
>CurrentDateTime:07-6-30 19:03:38
>CurrentDateTime:07-6-30 19:04:03
>CurrentDateTime:07-6-30 19:05:03
>CurrentDateTime:07-6-30 19:10:51
>CurrentDateTime:07-6-30 19:11:02
>CurrentDateTime:07-6-30 19:12:02
>CurrentDateTime:07-6-30 19:13:02
>
>During 07-6-30 17:39:02 to 07-6-30 19:03:38, I didn't use my mobile. So, I
>think, maybe it's the problem.
>
>Then I tried the System.Threading.Timer also. It's same problem as above.
>When the screen turn off, then the system will not raise the timer tick event
>again.
>
>I don't know it's the .Net CF2.0's bug or not.
>
>So, I submit it here.
>
>Could you help me on it?
>
>Thanks a lot!
>
>=============================
>btw, What I want to do is to monitor a directory, If got any file, then
>process it and cut it to other folder.
>
>It looks like a Service. Right?
>I found a lot of documents that talk about how to create Service in VC++,
>but, I don't know anything about VC++, I just know C#.
>
>Could you teach me to create a service by C#?


-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATI 7.5...At the last minute Dale White Vista Games 0 05-31-2007 06:00 PM
Last Minute Question OpeXp Windows Vista 11 01-30-2007 07:15 AM
34° minute & stop OIDDI Windows XP 0 01-04-2007 03:17 AM
Script for ping one time a minute. Massimo Windows XP 4 01-04-2007 02:23 AM
RC2 - 20 minute install!!!!? RandyH Windows Vista 3 01-01-2007 09:35 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 10:58 AM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0