30 Jul 2007
Migration CF1.0 to CF2.0
Here is an interesting link on migration of an application from CF1.0 to CF2.0. I will add just a recommendation as me you had used Forms imbricated in panels for stage the lack of UserControls in CF1.0, it is no more possible under the CF2.0, it will thus be necessary for you to convert your Forms into UserControl. Else, you will obtain an exception at the execution.
http://msdn2.microsoft.com/en-us/library/bb435027.aspx
19 Jul 2007
Hibernate Windows CE message
Ce message Windows est envoyé à toutes les applications ouvertes quand les ressources mémoires sont très faibles (en dessous de 224KB sur PPC). Une application doit libérer de la mémoire autant que possible quand elle reçoit ce message en déchargeant des boîtes de dialogue, détruisant des fenêtres ou libérer de l'espace de stockage temporaire.
What is it?
This Windows message is sent to all opened applications when system resources are running low (under 224KB on PPC). An application should attempt to release as many resources as possible when sent this message by unloading dialog boxes, destroying windows, or freeing up as much local storage.
Vous pouvez répondre à cette évènement en code managé en s'accrochant sur l'event Hibernate.
You can respond to this event in managed code with the Hibernate event.
Voici un exemple d'utilisation :
Here is an example :
// Connect an event hander, OnHibernate, to the Hibernate event.
MobileDevice.Hibernate += new EventHandler(OnHibernate);
private void OnHibernate(object sender, EventArgs e)
{
// Add code here to release cached resources
// for relieving memory pressure.
}
12 Jul 2007
Book for CF2.0 developper
If you need a book about Compact Framework, check out this one. I have bought it at the MEDC 2007 in Berlin and I find it is very interesting and well written and covers many subjects on CF.
http://www.danielmoth.com/Blog/2007/05/mobile-development-handbook.html
11 Jul 2007
Time event on Windows Mobile with SNAPI
Tout d'abord, il suffit de créer un objet SystemState avec la property Time.
First of all, you need to create a SystemState object with the property Time.
SystemState _time = new SystemState(SystemProperty.Time);
Puis, s'accrocher à l'évènement Changed.
Then, add the Changed event to _time object.
_time.Changed += new ChangeEventHandler(_time_Changed);
Toutes les minutes, l'évènement est remonté. Ensuite dans le délégué, vous pouvez tester la valeur courante en la convertissant en DateTime:
Every minute, the event fired. Then in the delegate, you can test the current value by converting it into DateTime type:
void _time_Changed(object sender, ChangeEventArgs args)
{
// Obtenir la date courante
// Get the current Date Time
byte[] btTime = (byte[])SystemState.GetValue(SystemProperty.Time);
Int64 lngTime = BitConverter.ToInt64(btTime, 0);
DateTime time = DateTime.FromFileTime(lngTime);
// Ajouter le test sur la date que vous voulez !
// Add the test on the date you want !
}
J'ai essayé de mettre une condition pour l'évènement SystemState, mais ça ne fonctionne pas.
Voici le code réutilisable pour les autres propriétés pour lesquelles ça fonctionne:
I tried to put a condition for the SystemState event, but it doesn't work. Here is the reusable code for the others properties for which that works:
_time.ComparisonType = StatusComparisonType.Equal;
_time.ComparisonValue = TheValueToCompare;
J'espère que ça vous sera utile si vous avez besoin de faire un réveil ou pour une autre utilisation, n'hésitez pas à poster vos commentaires.
I hope that that will be useful for you if you need to make an alarm or for another use, don't hesitate to post your comments.
9 Jul 2007
Interesting links
2 Jul 2007
MVP nomination...
For the first time, I'm nominated Device Application Development MVP by Microsoft. Thanks !
Install unicode Fonts
If you need to use Chinese, Russian or others fonts..., you can use the ArialUnicode font (
ArialUni.ttf). You can find it on the Internet or on your PC.
Voici le code en C# qui vous permet d'installer des fonts sur votre device :
Here is the C# code in order to install fonts on your device:
[DllImport("coredll.dll", SetLastError = true)]
public static extern int AddFontResource(string lpName);
Pour l'utilisation :
For using:
AddFontResource(@"\Windows\Polices\" + theFontYouWantToAdd);