2 Sept 2007

CF 3.5 Debug tools with VS2008 Beta 2

Les outils / Tools

Le CF 3.5 inclut des nouveaux outils de diagnostique et d'analyse des performances.
The CF 3.5 includes new diagnostics and performance tools.

  • Premièrement, si vous voulez avoir accès à tous les remote tools, vous devez désinstaller manuellement le CF3.5 et télécharger et réinstaller la version suivante:

    First of all, if you want to access to all the remote tools, you must manually uninstall the CF3.5 and download and install the following version :

    http://www.microsoft.com/downloads/details.aspx?FamilyID=1343d537-a62f-4a6e-9727-7791bf4cc2bd&displaylang=en

    Ensuite, vous disposerez de tous les outils d'aide au développement dans :
    Then, you will have all the tools to help the application development in :

    C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\bin

  • Le device Security Manager est intégré à VS2008.
    Device Security Manager is now integrated in VS 2008
    http://fabdecret.blogspot.com/2007/04/windows-mobile-security.html

  • Le Remote Performance Monitor est inclus dans VS2008.
    The Remote Performance Monitor is now included in VS2008


Cette application permet aussi de voir le GC heap toute la durée de vie de l'application avec les allocations du GC et les libérations de mémoire. Ainsi, vous pouvez analyser les allocations faites pour les objets.
This application can also show the GC heap over the lifetime of an application and the GC allocates and frees memory. Then, you can analyze objects allocations.
  • Device Logging Configuration tool

    Cette application permet d'activer ou de désactiver le réseau, le loader, native interop logging…
    The application allows you to activate or disable network, loader, native interop logging…



















                                      • Le CF 3.5 supporte le CLR Profiler, qui n'était disponible que pour le Framework dans les versions précédentes. Cet outil offre la possibilité de visualiser le heap managé d'un processus et d'analyser le comportement du garbage collector.
                                        The .NET Compact Framework 3.5 supports the CLR Profiler, which was previously available only with the full .NET Framework. The profiler enables you to view the managed heap of a process and investigate the behavior of the garbage collector.










                                      Grâce à cet outil les éléments suivant peuvent être visualisés (avec quelques copies d'écrans des fenêtres) :
                                      This tool provides viewing the following elements (with some screenshot of the window):




                                      • Histogram allocated Types
                                      • Histogram Relocated Types
                                      • Object by adress
                                      • Histogram by Address
                                      • Allocation Graph
                                      • Assembly Graph
                                      • Function Graph
                                      • Module Graph
                                      • Class Graph
                                      • Heap Graph

                                      • Call Graph
                                      • Time Line
                                      • Call Tree

                                      • Unit Testing pour Smartdevice, permet de tester votre application avec des tests unitaires. Vous pouvez lancer ces tests unitaires tout au long du cycle de développement.
                                        Unit Testing for Devices allows you to develop a suite of unit test to test your code. You can run the tests continuously during the developpement cycle.


                                      Avec Visual 2008 Beta 2 et le Compact Framework 3.5, il y a beaucoup de nouvelles améliorations et perfectionnements qui sont vraiment utiles pour le développement mobilité. Dès que vous l'aurez testé, n'hésitez pas à poster vos commentaires.
                                      There are a lot of new improvements and enhancements for mobile development that are really useful with VS 2008 Beta 2 and Compact Framework 3.5. As soon as you test it, do not hesitate to post your comments.

                                      VS2008 Beta 2 et le CF 3.5

                                      Voici un petit aperçu des nouveautés de VS2008 Beta 2 pour le développement mobilité (CF 3.5). Vous pouvez la télécharger ici:
                                      Here is a small description of the new features in VS2008 Beta 2 for the smartdevice development (CF 3.5). You can download it here:
                                      http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx

                                      Nouveautés pour la création de projets mobile:
                                      New projects wizard for mobile applications:


                                      Vous pouvez choisir la plate-forme et la version du Compact Framework désiré.
                                      You can choose the platform and the Compact Framework version you want.




                                      Compact Framework 3.5

                                      Le CF 3.5 inclut les nouvelles fonctionnalités suivantes :
                                      CF 3.5 includes the new following features:


                                      • WCF (Windows Communications Foundation)
                                        http://blogs.msdn.com/markprenticems/archive/2007/04/25/introduction-to-the-windows-communication-foundation-for-the-net-compact-framework-store-and-forward-messaging.aspx
                                      • LINQ (Language Integrated Queries)
                                        http://msdn2.microsoft.com/fr-fr/netframework/aa904594.aspx
                                      • Améliorations dans les Windows Forms
                                        Windows Forms the improvements :
                                        Les utilisateurs peuvent ajouter des graphiques aux:
                                        Users can now add graphics to:
                                        o System.Windows.Forms.TabPage
                                        o System.Windows.Forms.Panel
                                        o System.Windows.Forms.Splitter
                                        o System.Windows.Forms.PictureBox
                                        Les propriétés System.Windows.Forms.ComboBox.SelectionLength sont maintenant supportées.
                                        System.Windows.Forms.ComboBox.SelectionLength properties are now supported.
                                      • SoundPlayer
                                        Le .NET Compact Framework 3.5 supporte la classe SoundPlayer dans le namespace System.Media, qui permet de jouer plusieurs sons.
                                        The .NET Compact Framework 3.5 supports SoundPlayer in System.Media namespace, which enables you to play multiple sounds.
                                        http://msdn2.microsoft.com/en-us/library/system.media.soundplayer_members(VS.90).aspx

                                        Notez que la méthode Play joue le son dans un nouveau thread. Si vous appelez Play avant que le fichier de musique n'ait été chargé en mémoire, le fichier .Wav sera chargé avant que la lecture ne commence. Vous pouvez utiliser LoadAsync ou Load pour charger le fichier en mémoire par avance.
                                        Note that the Play method plays the sound using a new thread. If you call Play before the .wav file has been loaded into memory, the .wav file will be loaded before playback starts. You can use the LoadAsync or Load method to load the .wav file to memory in advance.

                                      • Compression
                                        Le Compact Framework 3.5 supporte les classes suivantes pour la gestion de la compression.
                                        The .NET Compact Framework 3.5 adds support for the following classes in the System.IO.Compression namespace:
                                        o System.IO.Compression.CompressionMode
                                        o System.IO.Compression.DeflateStream
                                        o System.IO.Compression.GZipStream
                                        De plus, la propriété System.Net.HttpWebRequest.AutomaticDecompression est dorénavant supportée.
                                        In addition, the System.Net.HttpWebRequest.AutomaticDecompression property is supported.

                                      • Les certifications coté client d'authentification des appels de Web Service sont supportées.
                                        Client-side certificates are supported to authentificate Web Service calls.

                                      • Le CF 3.5 fournit des nouvelles informations concernant le type de plate-forme, notamment si c'est une plate-forme de type PPC ou Smartphone ou WinCE.
                                        The .NET Compact Framework 3.5 provides new information about the platform type, specifically whether a platform is a Pocket PC or a Smartphone or Win CE.
                                        La variable contenant ces informations est :
                                        The variable containing this information is :
                                        SystemSettings.Platform with an enumeration type:
                                        o WinCEPlatform.PocketPC
                                        o WinCEPlatform.Smartphone
                                        o WinCEPlatform.WinCEGeneric

                                      • Les DelegatesSupport pour System.Delegate.CreateDelegate(System.Type,System.Object,System.Reflection.MethodInfo) ont été ajoutés au .NET Compact Framework 3.5.
                                        DelegatesSupport for System.Delegate.CreateDelegate(System.Type,System.Object,System.Reflection.MethodInfo) has been added to the .NET Compact Framework 3.5.

                                        http://msdn2.microsoft.com/en-us/library/74x8f551.aspx
                                      Avec Visual 2008 Beta 2 et le Compact Framework 3.5, il y a beaucoup de nouvelles améliorations et perfectionnements qui sont vraiment utiles pour le développement mobilité. Dès que vous l'aurez testé, n'hésitez pas à poster vos commentaires.
                                      There are a lot of new improvements and enhancements for mobile development that are really useful with VS 2008 Beta 2 and Compact Framework 3.5. As soon as you test it, do not hesitate to post your comments.

                                      13 Aug 2007

                                      Bitmap lock

                                      Pour éviter de verrouiller un fichier Bitmap lors de son utilisation, voici comment charger un Bitmap. Sinon quand you essayerez d'accéder au fichier, vous obtiendrez une exception "can not access file".

                                      To avoid to lock a Bitmap file, here is how to load a Bitmap. Else, when you access to the file, you will have a "can not access file" exception.

                                      using (Stream s = File.OpenRead(@"\My Documents\My Pictures\Waterfall.jpg"))
                                      Bitmap _backImage = (Bitmap)Bitmap.FromStream(s);


                                      Ink WISP Lite

                                      Dans le SDK WM 6.0 pour les applications natives, vous avez le nouveau composant WISP Lite qui permet à l'utilisateur d'utiliser le stylet pour saisir du texte, ensuite ce composant peut reconnaître le texte saisi.
                                      In WM6.0 SDK for native application, you have the new WISP Lite component allows user to input text with stylus, then WISP Lite can recognize the text.

                                      Voici un exemple de code pour utiliser le WISP Lite:
                                      Here is a code example for using WISP Lite:


                                      1. // Create the signature window
                                        hWndInk = CreateWindow( TEXT("static"),
                                        NULL,
                                        WS_VISIBLE WS_CHILD WS_BORDER,
                                        left,
                                        top + 20,
                                        215,
                                        150,
                                        hWnd,
                                        NULL,
                                        hInstance, NULL);

                                      2. // Attach the inkoverlay to the windows and enable it
                                        hr = ::CoCreateInstance(CLSID_InkOverlay,
                                        NULL,
                                        CLSCTX_INPROC_SERVER,
                                        IID_IInkOverlay,
                                        (void **)&g_pInkOverlay);
                                        ASSERT(SUCCEEDED(hr));

                                        hr = g_pInkOverlay->put_hWnd((long)hWndInk);
                                        ASSERT(SUCCEEDED(hr));

                                        hr = g_pInkOverlay->put_Enabled(VARIANT_TRUE);
                                        ASSERT(SUCCEEDED(hr));

                                      3. // Get the strokes and convert to a string
                                        hr = g_pInkOverlay->get_Ink( &pInk );
                                        // Get all the strokes in the ink object
                                        hr = pInk->get_Strokes(&pStrokes);
                                        // Get the recognition result for these strokes
                                        hr = pStrokes->get_RecognitionResult(&result);
                                        // Get the top recognized string
                                        hr = result->get_TopString(&resultString);

                                      Et c'est fini, resultString contient la chaîne de caractères.
                                      And it is finished, resultString contains the string.


                                      Vous pouvez trouver des exemples plus complets dans le WM6 SDK Refresh :
                                      You can find more examples in the WM6 SDK Refresh directory:

                                      \Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CPP\win32\WISPLite


                                      7 Aug 2007

                                      Extract method tool

                                      Cet outil permet de créer une nouvelle méthode à partir d'un morceau de code. Il est alors très aisé de faire appel à plusieurs reprises à cette section de code, par un simple appel de la méthode. Les paramètres en entrée ou en retour sont automatiquement gérés.
                                      This tool makes it possible to create a new method starting from a piece of code. Then, it is very easy to on several occasions call this section of code, by a simple call of the method. The returns and in parameters are automatically managed.


                                      1) Sélectionner le code

                                      1) Select the code


                                      2)Cliquer sur la fonction extract

                                      2) Click on extract method




                                      3)Attribuer un nom à la nouvelle fonction

                                      3) Set the name of the new function