jueves, 27 de agosto de 2009

Screenshot de cualquier elemento en Silverlight 3

Una forma sencilla de obtener un screenshot de casi cualquier elemento dentro de un objeto Silverlight, es utilizar la clase WriteableBitmap, y usar el método Render que recibe como parámetro un objeto que derive de UIElement, es por eso que virtualmente se le puede sacar la instantánea a cualquier elemento, con unas pocas líneas de código, como las siguientes: 

public Image GetImageFromUIElement(UIElement uiElement) 
{ 
       WriteableBitmap bm = new WriteableBitmap((int)uiElement.RenderSize.Width, (int)uiElement.RenderSize.Height); 
       bm.Render(container, new MatrixTransform()); 
       bm.Invalidate(); 
       Image im = new Image(); 
       im.Source = bm; 
       return im; 
}
La clase WriteableBitmap, puede ser usada como fuente de datos para un objeto Image y asi mostrarlo en pantalla o guardarlo en un archivo.Se me ocurren algunas interesantes aplicaciones como:
  1.  Un método Helper para guardar instantáneas de tu aplicación, en el momento exacto en que truena ocurre un fallo inesperado y asi complementar las explicaciones de los usuarios, tales como, “La aplicación falló cuando la estaba utilizando”
  2. Obtener thumbnails de Videos.
  3. Etc.
Espero encuentren un buen uso a esta clase y me pasen el tip 


Happy Coding! 

jueves, 20 de agosto de 2009

SharePoint Services Site Top Navigation DSL

Sin lugar a dudas un excelente lugar para encontrar proyectos muy buenos y útiles es el Visual Studio Gallery, en el cual podemos encontrar una gran cantidad de addins para VS, algunos totalmente free y otros que tienen un costo.

Por ejemplo el SharePoint Services Site Top Navigation DSL, el cual nos permite modelar la barra de navegación de sitios, recordemos que por default WSS solo despliega un nivel del menú.

Si necesitamos lograr algo como esto:

 

 

 

clip_image002
Primero debemos modificar la Master Page para permitir que se despliegue más de un nivel del menú, como lo explica este artículo.


Acto seguido, utilizamos esta herramienta para modelar el menú en Visual Studio. Al final del modelado, esta herramienta creará un script de PowerShell, que deberemos ejecutar en el servidor de WSS, con permisos de administrador obviamente.

clip_image003

Espero que se den una vuelta por el Visual Studio Gallery.

Happy Coding!

miércoles, 19 de agosto de 2009

Parámetro Windowless del objeto Silverlight

Un problema que ocurre con mucha frecuencia al personalizar SharePoint, sobre todo los menús. Es, que si tenemos objetos Silverlight dentro de la pagina,  los menus aparecen por debajo de los objetos Silverlight, lo cual es un error fácil de solucionar.

Solo se debe establecer el parámetro Windowless a true, y automagicamente el problema estará resuelto. El parámetro se puede establecer de diferentes maneras:


<
object id="xamlHost0" width="900" height="412" type="application/x-silverlight">
   
<param value="transparent" name="background"/>
   
<param value="true" name="windowless"/>
   
<!-- a bunch of other params go here -->
</object>

Silverlight.createHostedObjectEx({
    source:
'Silverlight/Player/Player.xaml?v=1',
    parentElement: $get(parentId ||
"Player_SilverlightContainer"),
    id:
this._hostname,
    properties: {    width:
'900',    height: '412',
    framerate:
'24',
    version:
'1.0',
    background:
'transparent',    isWindowless: 'true'
}
 

<asp:Silverlight runat="server" ID="Silverlight1"

Height="340"

Width="320"

Windowless="true"

Source="../Xaml1.xaml"

OnPluginError="onXamlError"/>

 

<!—Inclusive, mediante javascript-->


silverlightObject.settings.Windowless = true;

 

Para el mismo problema pero con objetos Flash, he aquí un post del buen Haarón González, en el que explica la solución

 

 

Etiquetas

SharePoint 2010 (38) Microsoft (32) Desarrollo SharePoint (31) Gerardo Reyes Ortiz (27) SharePoint (20) SharePoint 2013 (18) Errores SharePoint (12) México (10) PowerShell (9) Silverlight (8) Visio Services (7) Features (6) MVP (6) Silverlight 3 (6) WebCast (6) Workflows (6) Configuracion SharePoint 2010 (5) D.F. (5) API REST (4) Configuracion SharePoint 2010; (4) Troubleshooting (4) Visual Studio 2010 (4) Visual studio (4) WSS (4) Web parts (4) Apps (3) Comunidad SharePoint (3) Configuración SharePoint 2013 (3) ODATA (3) SharePoint Server (3) SharePoint; Instalación SharePoint; Troubleshooting; Search Service (3) Silverlight 3.0 (3) Silverlight Toolkit (3) WebParts (3) javascript (3) jquery (3) Eventos SharePoint (2) Office 2010 (2) PeoplePicker (2) REST (2) SQL Server (2) Scripting (2) Search Service Application (2) SharePoint Designer (2) UPA (2) UPS (2) Workflows SharePoint (2) host header (2) Apps Development (1) Big Bang (1) CAS (1) CSOM (1) Codeplex (1) CompartiMOSS (1) Configuracion SharePoint 2010; Errores SharePoint (1) Configuracion SharePoint 2010; SharePoint 2010 (1) Custom Actions (1) Custom Editor Parts (1) Delegate Controls (1) Deployment (1) DisableLoopbackCheck (1) Document Library (1) Entrevista (1) Examenes de Certificación (1) Extract WSP (1) FBA (1) FS4SP (1) Fakes (1) Fast Search Server 2010 For SharePoint (1) Fiddler (1) HTTP.SYS (1) HTTPS (1) JSON (1) Language Pack's (1) Latam (1) MAXDOP (1) MCSM (1) MSExpertos (1) MVC (1) Microsoft México (1) Microsoft; Codeplex; Screencast; (1) My Sites (1) SQL Server 2012 (1) SQL Server Reporting Services (1) Screencast (1) Screencast; (1) Service Applications (1) Service Pack (1) SharePoint 2007 (1) SharePoint 2010 SP 1 (1) SharePoint API (1) SharePoint Conference (1) SharePoint Emulators (1) SharePoint Farm (1) SharePoint Health Analyzer (1) SharePoint Magazine (1) SharePoint Online (1) SharePoint Search (1) SharePoint Test (1) SharePoint; Desarrollo SharePoint (1) Shims (1) Simposio (1) Simposio Latinoamericano (1) SkyDrive Pro (1) Soporte Microsoft (1) Templates (1) Tip (1) VSeWSS (1) Virtual Machine (1) Visual Studio 2012 (1) WCF (1) WSS; IIS 7 (1) Web API (1) Web Content Management (1) Web Services (1) Windows 8 (1) Windows Live ID (1) Xml (1) appcmd (1) iOS (1) jqGrid (1) onload function (1)