Blog Home  Home RSS 2.0 Atom 1.0 CDF  
.NET (Compact) Framework - OpenNETCF
Haggy's technischer BLog
 
 Tuesday, February 06, 2007
Das Forum zum .NET (Compact) Framework ist nun unter http://smartdevelopment.de/forums/default.aspx online.

Viel Spaß beim Austausch mit gleichgesinnnten! ;-)

2/6/2007 1:28:36 PM (W. Europe Standard Time, UTC+01:00)  #    Comments [0]    | .NET Allgemein | BLogs | Compact Framework | Controls | OpenNETCF | Tutorials  | 
 Tuesday, July 04, 2006

 

All the code tipps tricks and hints are providerer “As Is” and there are no garantuees that it works. You have to test ,evaluate and use these things at your own Risk!

 

Also think about that Storagecard don’t have unlimited write accesses!

 

When I started developping software for small devices like PocketPC’s the applications were first of all very small and the databasesize didn’t exceed 10 MB.

Also on WinCE4 devices there was plenty enough of space for the database.

 

Now with the time the application growed and WinMobile 5 appaered , the things changed.

First of all the Database size has grown dramatically also the aviable space for file storage (e.g. the T-Mobile MDA PRO) decreased.

On some devices t here was only 10MB space for Files left.
So I decided to put the Database on the storagecard. After the first run I thought “Great it works”.

 
But first of all some strange errors occured. For example an error said “The command needs an open and prepared connection” meanwhile in the same moment the state property of the connection said the database were open and ready.

 

Time after time I found out, that this problems only happen when the device were turned off or was in some kind of sleep state.
Therefore I found a nice class of the OpenNETCF (s. OpenNETCF.org) which gave me the abillity to react on the device open event.

So first of I all I bind the event like this:

 
DeviceManagement
.DeviceWake += new DeviceNotification(DeviceManagement_DeviceWake);

 

Then I add some code which reopens the SQL Connection. But attention! I experienced that the event doesn’t always fire IMMEDIATLY when the device is turned on and ofte n fire many times instead of exact one time per turn on!

 

So you have to handle that this mehtod aren’t going to run twice ore more times at once!

 

To Handle the multiple DeviceWake events I write back the DateTime of the DeviceWake events and I only execute code if some time (one second) has passed till the last Wakeevent.

I assume no one is quick enough to turn the PocketPC on and off again in one second...

 

/// <summary>

/// Time when the Devicewakeevent fired the last time

/// </summary>

DateTime LastWake = DateTime.Now;

 

/// <summary>

/// As long as an Wakeevent is in progress this flag is true!

/// </summary>

public bool lWakeInProgress = false;

 

 

      void DeviceManagement_DeviceWake()

        {

 

         //Gettin the Timespan till the last Wakeevent fired

  TimeSpan TimeLastWake = DateTime.Now.Subtract(this.LastWake);

           

 

//So if theres no other Wake in Progress and the last wake event was before one second or longer I run my wake code

            if (!this.lWakeInProgress && TimeLastWake.TotalSeconds > 1)

            {

               

                try

                {

                    //Setting a hint to see that a wake is in progress

                    this.lWakeInProgress = true;

 

                    //Showing the user that we do something

                    Program.SetCursor(true);

 

                    //Giving the OS the change to handle own events ( this seemed to be important du to incoming phone calls which could wake up the device)

                    Program.Sleep(2);

 

                    //Now look if the Database physically exists, if not..

                    if (!System.IO.File.Exists(Program.cDataBaseFile))

                    {

                        // We’ll waiit 2 Seconds ( after this I never had any problems of an missing database file

                        Program.Sleep(2);

                    }

 

                    //Now I call my code to reconnect to database (closing and reponing the conection)

                    Program.ReConnectToDataBase();

 

                    //Soll das Wake protokolliert werden?

                    if (Program.lLogWake)

                    {

                        Program.oLog.LogErr("DeviceWake()", "Wake beendet");

                    }

 

                    //Wieder aufbauen

                    Program.SetCursor(false);

 

                    this.lWakeInProgress = false;

                }

                catch

                {

                   

                }

                finally

                {

                    this.lWakeInProgress = false;

                }

 

                //Updating the LastWake event DateTime ...

   this.LastWake = DateTime.Now;

 

   //and resetting the hint that the wake is in progress

                this.lWakeInProgress = false;

            }

 

Some more hints:

-         Check that SQL Procedures triggered by timer or something similar have their on SQL Connection otherwise you could get some errors conecrning and “already in use “ error of the SQL Connection

 

-         Be aware of using the PowerDown event in combination with the DeviceWake event. Some times the order of these 2 Events are mixed up ! So the PowerDown fires after the DeviceWake.

 

-         The Code of the PowerDown event isn’T always execute before  the device is really off . Furthermore it seems like the code is put onto the stakc and executet when the device is turned on again

 

-         No code of your .NET Enviroment is beeing executed while de device is off ( no timmer, no events, etc...) But there are APIfunctions to set an wakeup time. For this s. s. Daniel Moth’s Blog

     -   All devices should have installed the Latest ROM and OS Version because they improved a lot of handling of internal storages !

So I hope this was some kind of help concerning database SQL Mobile on PocketPC’s with, .NET CF2.0 and Storagecards

 

It this was helpfull pls. Concider an paypal spent

7/4/2006 2:58:37 PM (W. Europe Standard Time, UTC+01:00)  #    Comments [0]    | Compact Framework | OpenNETCF | SQL Mobile  | 
 Tuesday, June 13, 2006

Hi

das OpenNETCF 2.0 gibts nun in 2 Versionen.
Eine kostenlose und eine für 50$ zu lizensierende Version.

Der Entscheidende unterschied ist dass die Kostenlose keine Designer oder Intellisense unterstützung mehr hat.
Die Kostenpflichte Version unterstützt sowohl designer als auch Intellisense und bietet uach einige Tolls an die sich in die IDE integrieren.

Mehr infos dazu gibts auch unter :  <ctake/> -BLog

OpenNETCF scheint also immer mehr in die,  inzwischen fast übliche, Richtung zugehen von Ihren Produkten eine Standard und eine kostenlose abgespeckte Version zu gehen.

Falls daraus resultiert dass es noch bessere Controls gibt fände ich das gar nicht mal so schlecht, zu mal mir 50$ verkfraftbar erscheinen



Google Anzeige:
6/13/2006 7:37:39 AM (W. Europe Standard Time, UTC+01:00)  #    Comments [0]    | Compact Framework | Controls | OpenNETCF | Updates & SP  | 
 Wednesday, June 07, 2006
Hi
Von OpenNETCF gibts eine neue kommerzielle Bibliothek, welche Kalenderansichten auf dem PocketPC im Outlook style ermöglicht.

Hier ein Bild:


Weitere Infos unter:

http://www.opennetcf.com/controls/calendar


6/7/2006 11:59:41 AM (W. Europe Standard Time, UTC+01:00)  #    Comments [0]    | .NET Allgemein | Compact Framework | Controls | GUI | OpenNETCF | Updates & SP  | 
 Tuesday, May 02, 2006

Bei dem DeviceManagement des OpenNetCF habe ich einen Bug festgestellt.
Dieser tritt auf, wenn man das DeviceWake event bindet und folgende Schritte tut:


- Anwendung starten
- Device Binden
- Andere Anwendung öffnen und in den Vordergrund holen
- PPC für einige Zeit ausschalten und dann nach einer Weile wieder einschalten.

Es folgt ein Object disposed error.

ctake  hat den Bug behoben und soll im nächsten Release drin sein.

Nochmal vielen Dank anihn für das schnelle Bugfix! :)
5/2/2006 12:30:54 PM (W. Europe Standard Time, UTC+01:00)  #    Comments [0]   Compact Framework | Controls | Updates & SP | OpenNETCF  | 
Copyright © 2010 Haggy. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: