共用方式為


Windows Embedded CE6 R3 released including Silverlight for Windows Embedded

The project I've been working on since my last blog posts has finally been released!  There is some fantastic documentation out on MSDN that can get you familiar with the new Silverlight for Windows Embedded API and how to create applications: Silverlight for Windows Embedded on MSDN

The first thing you might wonder is how to create an application that uses this new api.  There's an MSDN page for that: https://msdn.microsoft.com/en-us/library/ee503558.aspx, but I thought I would start out by showing some code that I've used when creating applications.  This uses all the functions detailed on MSDN.

 INT WINAPI WinMain(
     HINSTANCE hInstance, 
     HINSTANCE hPrevInstance, 
     LPWSTR lpCmdLine, 
     int nCmdShow
     )
 {
     int             exitCode = -1;
     HRESULT         hr = S_OK;
  
     XamlRuntimeManager xr;
  
     if(xr.IsInitialized())
     {
         if(SUCCEEDED(DoSomethingHere(lpCmdLine)))
         {
             exitCode = 0;
         }
     }
  
     return exitCode;
 }
  

The main thing to notice here is the XamlRuntimeManager, this does all the initilization for you.  Lets take a look at what that class does.

 //this class will initialize and uninitialize XamlRuntime
 //
 class XamlRuntimeManager
 {
 private:
     BOOL m_IsInitialized;
  
 public:
     XamlRuntimeManager()
     {
         m_IsInitialized = XamlRuntimeInitialize();
     }
  
     ~XamlRuntimeManager()
     {
         if(m_IsInitialized)
         {
             XamlRuntimeUninitialize();
         }
     }
  
     BOOL IsInitialized() { return m_IsInitialized; }
  
 };
  

If you want to see this code in action it is in one of the sample applications that has shipped with R3, XamlPerf.

Comments

  • Anonymous
    December 17, 2009
    The comment has been removed
  • Anonymous
    December 29, 2009
    Embedded Silverlight is an enormous addition to Windows Embedded CE. Congrats on accomplishing this.However, I would like to see more complex examples by Microsoft out there.Thanks,Shai
  • Anonymous
    February 11, 2010
    Hi Shai - what kind of examples are you interested in?  I would be glad to provide an example that is more complicated.  Brett
  • Anonymous
    December 29, 2010
    Hi Brett, perhaps some example about serial I/O via Rs-232 ?  ....