M
Maxus
Hi People,
I have written my first CE application that uses SQL CE to store its
data when the user chooses syncronise the data is shifted from the unit
to the main server and removed off the unit. All of this works
brilliantly (i actually thought that would be the hard bit).
Now I need a way to trigger the sync'ing automatically when the unit is
connected or in a cradle. I have read through a huge amount of forums
and basically driven my self nuts. Here are the solutions I have tried
:
1. CeRunAppAtEvent method - This works except it has to run a seperate
application and some how comunicate back to the orginal application not
a good solution found it unstable. It also fires the event when the
unit is restarted causing applications to open up over and over.
2. I tried OpenNETCF: using the code below and linked to the event but
there seem to be a bug where it never actually fires the event. I think
beacuse the unit has a wireless and active sync connecton this seem to
only moniter the wireless which we dont use (but might in future). I
cant figure out how to set the CE unit to moniter the active sync
connection.
AdapterStatusMonitor ASM = AdapterStatusMonitor.NDISMonitor;
ASM.AdapterNotification += new EventHandler(ASM_AdapterNotification);
ASM.StartStatusMonitoring();
3. NotifyAddrChange : This a non managed function I was hoping It
could just detect the IP change and fire an event to sync from that.
but I have no idea how to DLL import it into managed code
4. Another options is to make call to web sites or a server and wait to
see if it times out Or check the IP on the interfaces. This would need
to be put in a Loop in a seperate thread and fire events back to cause
it to sync when things change. This is also one i have no idea how to
do
Does anyone know how I can do this?
Thanks in advance!
M
I have written my first CE application that uses SQL CE to store its
data when the user chooses syncronise the data is shifted from the unit
to the main server and removed off the unit. All of this works
brilliantly (i actually thought that would be the hard bit).
Now I need a way to trigger the sync'ing automatically when the unit is
connected or in a cradle. I have read through a huge amount of forums
and basically driven my self nuts. Here are the solutions I have tried
:
1. CeRunAppAtEvent method - This works except it has to run a seperate
application and some how comunicate back to the orginal application not
a good solution found it unstable. It also fires the event when the
unit is restarted causing applications to open up over and over.
2. I tried OpenNETCF: using the code below and linked to the event but
there seem to be a bug where it never actually fires the event. I think
beacuse the unit has a wireless and active sync connecton this seem to
only moniter the wireless which we dont use (but might in future). I
cant figure out how to set the CE unit to moniter the active sync
connection.
AdapterStatusMonitor ASM = AdapterStatusMonitor.NDISMonitor;
ASM.AdapterNotification += new EventHandler(ASM_AdapterNotification);
ASM.StartStatusMonitoring();
3. NotifyAddrChange : This a non managed function I was hoping It
could just detect the IP change and fire an event to sync from that.
but I have no idea how to DLL import it into managed code
4. Another options is to make call to web sites or a server and wait to
see if it times out Or check the IP on the interfaces. This would need
to be put in a Loop in a seperate thread and fire events back to cause
it to sync when things change. This is also one i have no idea how to
do
Does anyone know how I can do this?
Thanks in advance!
M