Activesync service

  • Thread starter Thread starter Robert Camsky
  • Start date Start date
R

Robert Camsky

Hi,
does anyone know how to write an own activesync service in .NET C#?

Thanks for any advice.

Regards,
Robert
 
You'd like to rewrite activesync?

Why not just distribute activesync with your solution, and use opennetcf's
desktop class to access the device? (http://www.opennetcf.org)

Perhaps if you describe a little more about what you want to do, we'll be
able to point you in the right direction. =o)

Hope that helps.

Daniel.
 
Sorry for my explanation,

you wrote what I exactly want to do. I don't want to rewrite ActiveSync, but
just to create my own synch. item for AS. But I don't really don't know how
to do this.


The goal
when I put device into a cradle, I need to update SqlCe sdf file in it.

Thanks.
R.
 
The goal when I put device into a cradle, I need to update SqlCe sdf file

Automatically (as soon as you're docked and connected) or manually (with the
click of a button or something to that affect)?
 
The goal when I put device into a cradle, I need to update SqlCe sdf
file
Automatically (as soon as you're docked and connected) or manually (with the
click of a button or something to that affect)?
Automatically would be better. But manually is also possible.
 
The problem with automatic that I've had is the library's (opennetcf)
inability to determine whether a device is connected or not. You first have
to try to establish a connection, then check for whether that connection
worked...

As follows:

OpenNETCF.Desktop.Communication.RAPI desktopComm = new
OpenNETCF.Desktop.Communication.RAPI();
desktopComm.Connect ();
if ( !desktopComm.DevicePresent )
{
// do your synchronisation here
}
desktopComm.Disconnect();


The catch is, if you call Connect(), and there's no device present, it just
hangs. The timeout option that comes with the method doesn't seem to work. I
suppose if you were running a windows service that checked every few seconds
for a connection then you could spawn a thread to check, and have the main
thread abort this new thread should with your own time out mechanism. I'm
not sure how reliable this would be though.


The manual part of this is easy, simply ask the user to ensure a device is
connected, and that active sync has established a connection, then perform
your synchronisation. This is better as it also allows you the oppurtunity
to ask the user to insure the database file isn't locked or currently in
use...

Good luck.
Dan.
 
I would really thanks to Jan and Dan. I tried it and it works. But I get
stucked on followig:
when AS connection is established, I download the .sdf file contains SqlCe
data. I have discovered no classes to work with SqlCe database file on
"normal" .NET framework. Is there any way to modify them outside PPC?

Regards
Robert

You can try to use AutoStartOnConnect registry in pc, which will
launch your own application when a device is cradled.
Then use Dan's code to do your SQLCE update operation.

For your reference,
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=397&SearchTerms=autostart
onconnect
--

Best Regards,

Jan Yeh
MVP - Windows CE.NET, MCSD.NET, .NETcf consultant
Web - http://www.mobilemind.com.tw , Blog - http://blog.mvpcn.net/janyeh


"Dan Bass" <danielbass [at] postmaster [dot] co [dot] uk> ¼¶¼g©ó¶l¥ó·s»D:[email protected]...
The problem with automatic that I've had is the library's (opennetcf)
inability to determine whether a device is connected or not. You first
have to try to establish a connection, then check for whether that
connection worked...

As follows:

OpenNETCF.Desktop.Communication.RAPI desktopComm = new
OpenNETCF.Desktop.Communication.RAPI();
desktopComm.Connect ();
if ( !desktopComm.DevicePresent )
{
// do your synchronisation here
}
desktopComm.Disconnect();


The catch is, if you call Connect(), and there's no device present, it
just hangs. The timeout option that comes with the method doesn't seem to
work. I suppose if you were running a windows service that checked every
few seconds for a connection then you could spawn a thread to check, and
have the main thread abort this new thread should with your own time out
mechanism. I'm not sure how reliable this would be though.


The manual part of this is easy, simply ask the user to ensure a device is
connected, and that active sync has established a connection, then perform
your synchronisation. This is better as it also allows you the oppurtunity
to ask the user to insure the database file isn't locked or currently in
use...

Good luck.
Dan.
 
Have you looked into using System.Data.SqlServerCe?

http://msdn.microsoft.com/library/d...-us/cpref/html/frlrfsystemdatasqlserverce.asp


Good luck!
Thanks for that tip Jan, never knew about that!

Dan


Robert Camsky said:
I would really thanks to Jan and Dan. I tried it and it works. But I get
stucked on followig:
when AS connection is established, I download the .sdf file contains SqlCe
data. I have discovered no classes to work with SqlCe database file on
"normal" .NET framework. Is there any way to modify them outside PPC?

Regards
Robert

You can try to use AutoStartOnConnect registry in pc, which will
launch your own application when a device is cradled.
Then use Dan's code to do your SQLCE update operation.

For your reference,
http://www.opennetcf.org/forums/topic.asp?TOPIC_ID=397&SearchTerms=autostart
onconnect
--

Best Regards,

Jan Yeh
MVP - Windows CE.NET, MCSD.NET, .NETcf consultant
Web - http://www.mobilemind.com.tw , Blog - http://blog.mvpcn.net/janyeh


"Dan Bass" <danielbass [at] postmaster [dot] co [dot] uk> ¼¶¼g©ó¶l¥ó·s»D:[email protected]...
The problem with automatic that I've had is the library's (opennetcf)
inability to determine whether a device is connected or not. You first
have to try to establish a connection, then check for whether that
connection worked...

As follows:

OpenNETCF.Desktop.Communication.RAPI desktopComm = new
OpenNETCF.Desktop.Communication.RAPI();
desktopComm.Connect ();
if ( !desktopComm.DevicePresent )
{
// do your synchronisation here
}
desktopComm.Disconnect();


The catch is, if you call Connect(), and there's no device present, it
just hangs. The timeout option that comes with the method doesn't seem to
work. I suppose if you were running a windows service that checked
every
few seconds for a connection then you could spawn a thread to check,
and
have the main thread abort this new thread should with your own time
out
mechanism. I'm not sure how reliable this would be though.


The manual part of this is easy, simply ask the user to ensure a device is
connected, and that active sync has established a connection, then perform
your synchronisation. This is better as it also allows you the oppurtunity
to ask the user to insure the database file isn't locked or currently
in
use...

Good luck.
Dan.

The goal when I put device into a cradle, I need to update SqlCe
sdf
file
in it.

Automatically (as soon as you're docked and connected) or manually (with
the
click of a button or something to that affect)?

Automatically would be better. But manually is also possible.
 
Back
Top