10 sesiones del PDC 09 que deberías ver

Del Blog de Pete Brown he sacado este extracto de las 10 sesiones (11 en realidad) que no debemos de dejar de ver acerca de nuestras tecnologias favoritas WPF y Silverlight

 

Top 10 11

1 CL09 How Microsoft Visual Studio 2010 Was Built with WPF 4

This is interesting both from a “how they did it” standpoint, as well as for the topic of putting a slick WPF user interface over C++ and dealing with things like Win32 interop

2 CL17 Building Sensor and Location-Aware Applications with Windows 7 and .NET Framework 4

The sensor and location platform is one of the coolest things to come out with Windows 7. I’ve had a ton of fun with the sensors, and will be trying out some of the location API stuff soon.

3 CL01 Microsoft Silverlight 4 Overview

Silverlight 4 was one of the big announcements at PDC. If you want an overview of all the new features in SL4, this is the session to watch. Plus, Karen is a great speaker and super smart.

4 CL21 Building Amazing Business Applications with Microsoft Silverlight and Microsoft .NET RIA Services

Brad Abrams and his team put together a great talk that covers all the new stuff in RIA Services. If you build Silverlight business apps, don’t miss this.

5 FT24 Building Extensible Rich Internet Applications with the Managed Extensibility Framework

This is the only session I was able to attend in-person at PDC. Glenn goes through what’s new in MEF and how to use it in Silverlight 4 applications. MEF also applies to desktop apps, Visual Studio add-ins, server-side apps etc, so make sure you watch this.

6 CL24 XAML Futures in Microsoft .NET Framework, Microsoft Silverlight and Tools

Rob and friends talk about some of the coolness in the new and upcoming Xaml stacks. They’ve done some awesome work here.

7 CL12 Developing with the Windows API Code Pack for the Microsoft .NET Framework

For folks using .NET 3.5SP1, the Windows API Code Pack provides access to the Windows 7 features offered in .NET 4, as well as a bunch of things (like sensors) that .NET 4 doesn’t include in the box.

8 CL10 Windows Presentation Foundation 4 Plumbing and Internals

If you want to understand the guts of WPF, this is the session.

9 FT03 Manycore and the Microsoft .NET Framework 4: A Match Made in Microsoft Visual Studio 2010

Most of us have multi-core CPUs with 2 as the norm, 4 pretty common and 6 coming to the mainstream in 2010. If you want to incorporate parallel computing into your apps, Stephen will show you how, and tell you about the support built into VS2010 to help you work with it.

10 CL15 Modern Graphics Using Windows 7 and Direct 3D 11 Hardware

DirectX 11 includes tons of cool new features. This talk focuses primarily on Direct 3D 11. If you code against Direct 3D for visualization, games or other apps, check this out.

11 SVC23 Using the Microsoft Sync Framework to Connect Apps to the Cloud

How do you connect desktop apps to the cloud, and handle synchronization and reliability concerns? If you’re considering tapping into the cloud from your existing or new local applications, check this out.

Acceder a Word desde SilverLight

Con Silverlight 4 dentro de sus nuevas funcionalidades tenemos el acceso a objetos COM, aunque hay que indicar que solo podemos acceder con elevación de permisos. Esta nueva funcionalidad nos abre un nuevo camino de posibilidades, como por ejemplo interactuar con Word o Excel, y vamos a ver un ejmplo.

Añadimos la referencia al asembly Microsoft.CSharp.dll que se encuentra en Program Files/Microsoft SDKs/Silverlight/V4.0/Libraries/Client/ , creamos nuestro control

  1. <UserControl x:Class=»SilverlightWord.MainPage»
  2.    xmlns=»http://schemas.microsoft.com/winfx/2006/xaml/presentation»
  3.    xmlns:x=»http://schemas.microsoft.com/winfx/2006/xaml»
  4.    xmlns:d=»http://schemas.microsoft.com/expression/blend/2008″
  5.    xmlns:mc=»http://schemas.openxmlformats.org/markup-compatibility/2006″
  6.    mc:Ignorable=»d»
  7.    d:DesignHeight=»300″ d:DesignWidth=»400″>
  8.     <Grid x:Name=»LayoutRoot» Background=»White»>
  9.         <Button Content=»Abrir Word» Width=»100″ Height=»30″ Click=»Button_Click» />
  10.     </Grid>
  11. </UserControl>

Contiene un botón que abrirá Word e insertará un texto, tan sencillo como

 

 

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Shapes;
  12. using System.Windows.Interop;
  13. namespace SilverlightWord
  14. {
  15.     public partial class MainPage : UserControl
  16.     {
  17.         public MainPage()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.         private void Button_Click(object sender, RoutedEventArgs e)
  22.         {
  23.             dynamic word = ComAutomationFactory.CreateObject(«Word.Application»);
  24.             word.Visible = true;
  25.             dynamic doc = word.Documents.Add();
  26.             string insertText = «Aqui introducimos texto a Word desde Silverlight 4!»;
  27.             dynamic range = doc.Range(0, 0);
  28.             range.Text = insertText;
  29.         }
  30.     }
  31. }

Si os fijáis estamos utilizando una nueva funcionalidad de C#4 que es dynamic que nos permite instanciar el objeto COM

 

Impresionante el camino que esta tomando Silverlight

Como grabar Ink de WPF como BitMap

Hola, aparte de los enlaces interesantes que voy poniendo, seguiré con cosas de mi cosecha, lo siguiente me surgió en un proyecto y resumidamente tenemos un bitmap al cual le habíamos puesto un objeto Ink para que el usuario pintase por encima y a la hora de grabar grabase el Bitmap con lo dibujado por el usuario encima del Bitmap, es decir incrustar lo dibujado en el Bitmap creando un Bitmap nuevo (me explico como las gallinas)

 

Al grano, es muy sencillo aquí tenéis el código que renderiza como bitmap la problemática anterior

 

  1. // Renderiza el arbol visual de  InkCanvas’ a RenderTargetBitmap
  2.             RenderTargetBitmap targetBitmap =
  3.                 new RenderTargetBitmap((int)inkCanvas1.ActualWidth,
  4.                                        (int)inkCanvas1.ActualHeight,
  5.                                        96d, 96d,
  6.                                        PixelFormats.Default);
  7.             targetBitmap.Render(inkCanvas1);
  8.             
  9.             BmpBitmapEncoder encoder = new BmpBitmapEncoder();
  10.             encoder.Frames.Add(BitmapFrame.Create(targetBitmap));
  11.             // Salva el fichero a disco
  12.             FileStream fs = File.Open(fileName, FileMode.OpenOrCreate);
  13.             encoder.Save(fs);

Espero que os sirva

Enlaces Interesantes WPF/Silverlight – 01/12/2009

Aquí vienen los enlaces correspondientes a hoy

 

  • WCF RIA Services and a guide to use DTO/”Presentation Model” and WCF RIA Services Unity DomainServiceFactory (Fredrik Normen)
  • MEF has landed in Silverlight 4. We come in the name of extensibility. and Building the Hello MEF dashboard in Silverlight 4 – Part I (Glenn Block)
  • Silverlight 4: Sum is Greater than the Parts (John Papa)
  • Adding Images on Silverlight 4 using drag and drop and the web camera. (Al Pascual)
  • Document Toolkit Roadmap (Koen Zwikstra)
  • Data Driven Application Development using WCF and Silverlight 3.0 User Controls (Mahesh Sabnis)
  • Text Deformation Based on Bézier Splines (Charles Petzold)
  • Silverlight Game: Froggy Math (Andy Beaulieu)
  •  

    Espero que os sirvan