jueves, 21 de mayo de 2020

Certificación alcanzada

lunes, 21 de abril de 2014

Script para generar el diccionario de datos

/*****************/
Actualización 21 de octubre de 2014
*Adjunto el archivo SQL para facilitar su utilizacion

Diccionario.sql


/*****************/


Hola, una de las cosas por las que uno como freelancer tiene que pasar es por entregar una documentación adecuada de sus proyectos, y una parte de esta documentación es el diccionario de datos, y la mejor forma de hacerlo (En SQL Server 2005 o superior) , es:

1. Al crear la tablas, campos, y vistas utilizar el la propiedades la descripción de dicho objeto:

Una ventaja de esta opción, es que si se hace un backup, o si se genera un script del objeto o de la base de datos, la descripción de este siempre estará incluida, otra ventaja, es que es fácilmente actualizable el diccionario pues solo es necesario actualizar esta propiedad cuando sea conveniente. 


2. Una vez diseñada la base de datos se debe abrir el siguiente script 


--Cut and paste the results to note pad and name with a *.html format when saving.


--//SQL Database documentation script
--//Author: Nitin Patel, Email: nitinpatel31@gmail.com
--//Modificado por :Robinson Moscoso, Email: robinmp@gmail.com
--//Date:26-Jun-2013
--//Description: T-SQL script to generate the database document for SQL server 2005
Declare @i Int, @maxi Int
Declare @j Int, @maxj Int
Declare @sr int
Declare @Output varchar(4000)
Declare @SqlVersion varchar(5)
Declare @last varchar(155), @current varchar(255), @typ varchar(255), @description varchar(4000)
Declare @NombreTabla nvarchar(100)


--crear la tabla donde se van a guardar los tamaños
declare @tamanio as table (objname varchar(255),rows varchar (100),reserved varchar(100),data varchar(100),index_size varchar(100),unused varchar(100))


create Table #Tables (id int identity(1, 1), Object_id int, Name varchar(155), Type varchar(20), [description] varchar(4000))
create Table #Columns (id int identity(1,1), Name varchar(155), Type Varchar(155), Nullable varchar(2), [description] varchar(4000),[valor] varchar(4000))
create Table #Fk(id int identity(1,1), Name varchar(155), col Varchar(155), refObj varchar(155), refCol varchar(155))
create Table #Constraint(id int identity(1,1), Name varchar(155), col Varchar(155), definition varchar(1000))
create Table #Indexes(id int identity(1,1), Name varchar(155), Type Varchar(25), cols varchar(1000))
create Table #Procedure(id int identity(1,1), Shema varchar(50), [Procedure] Varchar(100), CreadoEl varchar(100), UltimaModificacion varchar(100))


If (substring(@@VERSION, 1, 25 ) = 'Microsoft SQL Server 2005')
set @SqlVersion = '2005'
else if (substring(@@VERSION, 1, 26 ) = 'Microsoft SQL Server 2000')
set @SqlVersion = '2000'
else
set @SqlVersion = '2005'
Print ''
Print '::' + DB_name()+'::'
Print ''
Print ''
Print ''


set nocount on
if @SqlVersion = '2000'
begin
insert into #Tables (Object_id, Name, Type, [description])
--FOR 2000
select object_id(table_name), '[' + table_schema + '].[' + table_name + ']',
case when table_type = 'BASE TABLE' then 'Table' else 'View' end,
cast(p.value as varchar(4000))
from information_schema.tables t
left outer join sysproperties p on p.id = object_id(t.table_name) and smallid = 0 and p.name = 'MS_Description'
order by table_type, table_schema, table_name
end
else
if @SqlVersion = '2005'
begin
insert into #Tables (Object_id, Name, Type, [description])
--FOR 2005
Select o.object_id, '[' + s.name + '].[' + o.name + ']',
case when type = 'V' then 'View' when type = 'U' then 'Table' end,
cast(p.value as varchar(4000))
from sys.objects o
left outer join sys.schemas s on s.schema_id = o.schema_id
left outer join sys.extended_properties p on p.major_id = o.object_id and minor_id = 0 and p.name = 'MS_Description'
where type in ('U', 'V')
order by type, s.name, o.name;
end
Set @maxi = @@rowcount
set @i = 1
print '
Index
'
print ' '


While(@i <= @maxi)
begin
select @Output = ' '
from #Tables where id = @i

print @Output
set @i = @i + 1
end
print '
SrObjectType
' + Cast((@i) as varchar) + '' + name + '' + Type + '

'


set @i = 1
While(@i <= @maxi)
begin
--table header
select @NombreTabla = name from #Tables where id = @i
delete from @tamanio
insert into @tamanio
exec sp_spaceused @NombreTabla


select @Output = ' ' + Type + ':' + name + ' ', @description = [description]
from #Tables where id = @i
print '


'
print @Output
print '
Index

'
print ' '
select @Output = ' '
from @tamanio
print @Output
print '
Nro FilasReservadoTamaño de los DatosTamaño de los IndicesNo Usado
'+ rows +''+ reserved +'' + data + '' + index_size + '' + unused+ '

'

print '
Description
' + isnull(@description,'') + '

'


--table columns
truncate table #Columns
if @SqlVersion = '2000'
begin
insert into #Columns (Name, Type, Nullable, [description], valor)
--FOR 2000
Select c.name,
type_name(xtype) + (
case when (type_name(xtype) = 'varchar' or type_name(xtype) = 'nvarchar' or type_name(xtype) ='char' or type_name(xtype) ='nchar')
then '(' + cast(length as varchar) + ')'
when type_name(xtype) = 'decimal'
then '(' + cast(prec as varchar) + ',' + cast(scale as varchar) + ')'
else ''
end
),
case when isnullable = 1 then 'Y' else 'N' end,
cast(p.value as varchar(8000)),
''
from syscolumns c
inner join #Tables t on t.object_id = c.id
left outer join sysproperties p on p.id = c.id and p.smallid = c.colid and p.name = 'MS_Description'
where t.id = @i
order by c.colorder
end
else
if @SqlVersion = '2005'
begin
insert into #Columns (Name, Type, Nullable, [description],valor)
--FOR 2005
Select c.name,
type_name(user_type_id) + (
case when (type_name(user_type_id) = 'varchar' or type_name(user_type_id) = 'nvarchar' or type_name(user_type_id) ='char' or type_name(user_type_id) ='nchar')
then '(' + cast(max_length as varchar) + ')'
when type_name(user_type_id) = 'decimal'
then '(' + cast([precision] as varchar) + ',' + cast(scale as varchar) + ')'
else ''
end
),
case when is_nullable = 1 then 'Y' else 'N' end,
cast(p.value as varchar(4000)),
cast(p1.value as varchar(4000))
from sys.columns c
inner join #Tables t on t.object_id = c.object_id
left outer join sys.extended_properties p on p.major_id = c.object_id and p.minor_id = c.column_id and p.name = 'MS_Description'
left outer join sys.extended_properties p1 on p1.major_id = c.object_id and p1.minor_id = c.column_id and p1.name = 'Valor'
where t.id = @i
order by c.column_id
end
Set @maxj = @@rowcount
set @j = 1


print '
Table Columns
'
print ' '

While(@j <= @maxj)
begin
select @Output = ' '
from #Columns where id = @j

print @Output
Set @j = @j + 1;
end


print '
Sr.NameDatatypeNullableDescriptionValue
' + Cast((@j) as varchar) + '' + isnull(name,'') + '' + upper(isnull(Type,'')) + '' + isnull(Nullable,'N') + '' + isnull([description],'') + '' + isnull(valor,'') + '

'


--reference key
truncate table #FK
if @SqlVersion = '2000'
begin
insert into #FK (Name, col, refObj, refCol)
-- FOR 2000
select object_name(constid), s.name, object_name(rkeyid) , s1.name
from sysforeignkeys f
inner join sysobjects o on o.id = f.constid
inner join syscolumns s on s.id = f.fkeyid and s.colorder = f.fkey
inner join syscolumns s1 on s1.id = f.rkeyid and s1.colorder = f.rkey
inner join #Tables t on t.object_id = f.fkeyid
where t.id = @i
order by 1
end
else if @SqlVersion = '2005'
begin
insert into #FK (Name, col, refObj, refCol)
-- FOR 2005
select f.name, COL_NAME (fc.parent_object_id, fc.parent_column_id) , object_name(fc.referenced_object_id) , COL_NAME (fc.referenced_object_id, fc.referenced_column_id)
from sys.foreign_keys f
inner join sys.foreign_key_columns fc on f.object_id = fc.constraint_object_id
inner join #Tables t on t.object_id = f.parent_object_id
where t.id = @i
order by f.name
end

Set @maxj = @@rowcount
set @j = 1
if (@maxj >0)
begin


print '
Refrence Keys
'
print ' '


While(@j <= @maxj)
begin


select @Output = ' '
from #FK where id = @j


print @Output
Set @j = @j + 1;
end


print '
Sr.NameColumnReference To
' + Cast((@j) as varchar) + '' + isnull(name,'') + '' + isnull(col,'') + '[' + isnull(refObj,'N') + '].[' + isnull(refCol,'N') + ']

'
end


--Default Constraints
truncate table #Constraint
if @SqlVersion = '2000'
begin
insert into #Constraint (Name, col, definition)
select object_name(c.constid), col_name(c.id, c.colid), s.text
from sysconstraints c
inner join #Tables t on t.object_id = c.id
left outer join syscomments s on s.id = c.constid
where t.id = @i
and
convert(varchar,+ (c.status & 1)/1)
+ convert(varchar,(c.status & 2)/2)
+ convert(varchar,(c.status & 4)/4)
+ convert(varchar,(c.status & 8)/8)
+ convert(varchar,(c.status & 16)/16)
+ convert(varchar,(c.status & 32)/32)
+ convert(varchar,(c.status & 64)/64)
+ convert(varchar,(c.status & 128)/128) = '10101000'
end
else if @SqlVersion = '2005'
begin
insert into #Constraint (Name, col, definition)
select c.name, col_name(parent_object_id, parent_column_id), c.definition
from sys.default_constraints c
inner join #Tables t on t.object_id = c.parent_object_id
where t.id = @i
order by c.name
end
Set @maxj = @@rowcount
set @j = 1
if (@maxj >0)
begin


print '
Default Constraints
'
print ' '


While(@j <= @maxj)
begin


select @Output = ' '
from #Constraint where id = @j


print @Output
Set @j = @j + 1;
end


print '
Sr.NameColumnValue
' + Cast((@j) as varchar) + '' + isnull(name,'') + '' + isnull(col,'') + '' + isnull(definition,'') + '

'
end


--Check Constraints
truncate table #Constraint
if @SqlVersion = '2000'
begin
insert into #Constraint (Name, col, definition)
select object_name(c.constid), col_name(c.id, c.colid), s.text
from sysconstraints c
inner join #Tables t on t.object_id = c.id
left outer join syscomments s on s.id = c.constid
where t.id = @i
and ( convert(varchar,+ (c.status & 1)/1)
+ convert(varchar,(c.status & 2)/2)
+ convert(varchar,(c.status & 4)/4)
+ convert(varchar,(c.status & 8)/8)
+ convert(varchar,(c.status & 16)/16)
+ convert(varchar,(c.status & 32)/32)
+ convert(varchar,(c.status & 64)/64)
+ convert(varchar,(c.status & 128)/128) = '00101000'
or convert(varchar,+ (c.status & 1)/1)
+ convert(varchar,(c.status & 2)/2)
+ convert(varchar,(c.status & 4)/4)
+ convert(varchar,(c.status & 8)/8)
+ convert(varchar,(c.status & 16)/16)
+ convert(varchar,(c.status & 32)/32)
+ convert(varchar,(c.status & 64)/64)
+ convert(varchar,(c.status & 128)/128) = '00100100')


end
else if @SqlVersion = '2005'
begin
insert into #Constraint (Name, col, definition)
select c.name, col_name(parent_object_id, parent_column_id), definition
from sys.check_constraints c
inner join #Tables t on t.object_id = c.parent_object_id
where t.id = @i
order by c.name
end
Set @maxj = @@rowcount

set @j = 1
if (@maxj >0)
begin


print '
Check Constraints
'
print ' '


While(@j <= @maxj)
begin


select @Output = ' '
from #Constraint where id = @j
print @Output
Set @j = @j + 1;
end


print '
Sr.NameColumnDefinition
' + Cast((@j) as varchar) + '' + isnull(name,'') + '' + isnull(col,'') + '' + isnull(definition,'') + '

'
end




--Triggers
truncate table #Constraint
if @SqlVersion = '2000'
begin
insert into #Constraint (Name)
select tr.name
FROM sysobjects tr
inner join #Tables t on t.object_id = tr.parent_obj
where t.id = @i and tr.type = 'TR'
order by tr.name
end
else if @SqlVersion = '2005'
begin
insert into #Constraint (Name)
SELECT tr.name
FROM sys.triggers tr
inner join #Tables t on t.object_id = tr.parent_id
where t.id = @i
order by tr.name
end
Set @maxj = @@rowcount

set @j = 1
if (@maxj >0)
begin


print '
Triggers
'
print ' '


While(@j <= @maxj)
begin
select @Output = ' '
from #Constraint where id = @j
print @Output
Set @j = @j + 1;
end


print '
Sr.NameDescription
' + Cast((@j) as varchar) + '' + isnull(name,'') + '

'
end


--Indexes
truncate table #Indexes
if @SqlVersion = '2000'
begin
insert into #Indexes (Name, type, cols)
select i.name, case when i.indid = 0 then 'Heap' when i.indid = 1 then 'Clustered' else 'Nonclustered' end , c.name
from sysindexes i
inner join sysindexkeys k on k.indid = i.indid and k.id = i.id
inner join syscolumns c on c.id = k.id and c.colorder = k.colid
inner join #Tables t on t.object_id = i.id
where t.id = @i and i.name not like '_WA%'
order by i.name, i.keycnt
end
else if @SqlVersion = '2005'
begin
insert into #Indexes (Name, type, cols)
select i.name, case when i.type = 0 then 'Heap' when i.type = 1 then 'Clustered' else 'Nonclustered' end, col_name(i.object_id, c.column_id)
from sys.indexes i
inner join sys.index_columns c on i.index_id = c.index_id and c.object_id = i.object_id
inner join #Tables t on t.object_id = i.object_id
where t.id = @i
order by i.name, c.column_id
end


Set @maxj = @@rowcount

set @j = 1
set @sr = 1
if (@maxj >0)
begin


print '
Indexes
'
print ' '
set @Output = ''
set @last = ''
set @current = ''
While(@j <= @maxj)
begin
select @current = isnull(name,'') from #Indexes where id = @j

if @last <> @current and @last <> ''
begin
print ' '
set @Output = ''
set @sr = @sr + 1
end


select @Output = @Output + cols + '
' , @typ = type
from #Indexes where id = @j

set @last = @current
Set @j = @j + 1;
end
if @Output <> ''
begin
print ' '
end


print '
Sr.NameTypeColumns
' + Cast((@sr) as varchar) + '' + @last + '' + @typ + '' + @Output + '
' + Cast((@sr) as varchar) + '' + @last + '' + @typ + '' + @Output + '

'
end
--------------------------------------------------------------------------------------------
Set @i = @i + 1;
--Print @Output
Print 'Autor: ROBINSON MOSCOSO - SIPSE'
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- procedures
truncate table #Procedure
if @SqlVersion = '2005'
begin
---create Table #Procedure(id int identity(1,1), Shema varchar(25), [Procedure] Varchar(60), CreadoEl varchar(50), UltimaModificacion varchar(50))
insert into #Procedure (Shema, [Procedure], CreadoEl, UltimaModificacion)
SELECT SPECIFIC_SCHEMA AS Shema,ROUTINE_NAME As [Procedure],CREATED AS CreadoEl,LAST_ALTERED AS UltimaModificacion
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_TYPE = 'PROCEDURE' -- AND LEFT(ROUTINE_NAME,4) ='usp_'
ORDER BY ROUTINE_NAME
end


Set @maxj = @@rowcount
set @j = 1



print ''
print '
'
print ''
print '
Procedure Name
'
print ' '


While(@j <= @maxj)
begin
select @Output = ' '
from #Procedure where id = @j

print @Output
Set @j = @j + 1;
end


print '
Sr.SchemaProcedure NameCreado ElUltimaModificacion
' + Cast((@j) as varchar) + '' + isnull(Shema,'') + '' + isnull([Procedure],'') + '' + isnull(CreadoEl,'') + '' + isnull(UltimaModificacion,'') + '

'
Print 'Autor: ROBINSON MOSCOSO - SIPSE'
Print ''
Print '
'


drop table #Tables
drop table #Columns
drop table #FK
drop table #Constraint
drop table #Indexes
drop table #Procedure

set nocount off
-- Fin del script




3. Seleccionar que genere el resultado en un archivo 





3. Al ejecutar el script se abre una ventana para guardar el archivo generado, se especifica el nombre, teniendo en cuenta de agregar el tipo htm al final del nombre (por ejemplo: diccionario.htm) y en tipo de archivo se debe seleccionar "Todos los archivos(*.*)" y se hace clic en guardar.


4. Finalmente abrimos el archivo en cualquier navegador y se podrá observar el diccionario de nuestra base de datos.





Este script, lo encontré hace un tiempo por ahí navegando pero no recuerdo el sitio para hacer referencia a este, sin embargo, quien lo hizo aparece en el Script, por lo tanto agradezco a Nitin Patel por tan buen trabajo.



Saludos

Róbinson

miércoles, 16 de abril de 2014

Lista de tablas con el tamaño ocupado por cada una

En algunos casos, por cuestión de administración uno necesita verificar el tamaño ocupado por las tablas en una base de datos, afortunadamente existe el procedimiento del sistema sp_spaceused, con el cual, enviando como parámetro el nombre de la tabla obtengo la información necesaria.

Sin embargo, necesité virifcar el tamaño de todas las tablas al mismo tiempo, con el fin de comparar la cantidad utilizada en diferentes tablas, y pues buscando encontré en la siguiente dirección http://infoinnova.net/2012/01/tablas-de-una-base-de-datos-con-sus-respectivos-tamanos/  el script que me permitió generar dicha consulta:

SELECT 
    X.[name], 
    REPLACE(CONVERT(varchar, CONVERT(money, X.[rows]), 1), '.00', '') 
        AS [rows], 
    REPLACE(CONVERT(varchar, CONVERT(money, X.[reserved]), 1), '.00', '') 
        AS [reserved], 
    REPLACE(CONVERT(varchar, CONVERT(money, X.[data]), 1), '.00', '') 
        AS [data], 
    REPLACE(CONVERT(varchar, CONVERT(money, X.[index_size]), 1), '.00', '') 
        AS [index_size], 
    REPLACE(CONVERT(varchar, CONVERT(money, X.[unused]), 1), '.00', '') 
        AS [unused] 
FROM 
(SELECT 
    CAST(object_name(id) AS varchar(50)) 
        AS [name], 
    SUM(CASE WHEN indid < 2 THEN CONVERT(bigint, [rows]) END) 
        AS [rows],
    SUM(CONVERT(bigint, reserved)) * 8 
        AS reserved, 
    SUM(CONVERT(bigint, dpages)) * 8 
        AS data, 
    SUM(CONVERT(bigint, used) - CONVERT(bigint, dpages)) * 8 
        AS index_size, 
    SUM(CONVERT(bigint, reserved) - CONVERT(bigint, used)) * 8 
        AS unused 
    FROM sysindexes WITH (NOLOCK) 
    WHERE sysindexes.indid IN (0, 1, 255) 
        AND sysindexes.id > 100 
        AND object_name(sysindexes.id) <> 'dtproperties' 
    GROUP BY sysindexes.id WITH ROLLUP
) AS X
WHERE X.[name] is not null
ORDER BY X.[rows] DESC


Espero sea de utilidad.

Saludos

domingo, 3 de febrero de 2013

Azure–Desarrollando aplicaciones Multi-Cliente para la nube

 

Como ahora ando buscando temas de arquitectura para mis próximos productos para Azure, encontré este libro de “Patterns & Practices“ en el cual describen como debería ser una aplicación para diferentes clientes o suscriptores.

En el vínculo se encuentra el libro completo en PDF (versión 3.0 de diciembre de 2012) , además incluye el código de ejemplo y hands on labs para apoyar el aprendizaje, definitivamente super recomendado.

El link al contenido: http://msdn.microsoft.com/en-us/library/ff966499.aspx

image

martes, 16 de octubre de 2012

Charm de settings con la política de privacidad

Hola, Uno de los motivos por los cuales las app no son aceptadas en el windows store es por que no tienen definida una política de privacidad.

En el siguiente ejemplo voy a mostrar como crear en el charm de settings una política de privacidad.

1. Crear un xaml que contenga la información de “acerca de”

a. En nuestra app adicionar un nuevo control de usuario, en mi caso lo llamaré AcercaDe.xaml:

image

b. Escribir en este xaml la información de contacto y la información de la política de privacidad, para ello he creado en este xaml un stackpanel dentro del cual utilicé varios textblok para especificar la información:

<UserControl
x:Class="MiTaskList.AcercaDe"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MiTaskList"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400">

<Grid Background="Black">
<StackPanel>
<TextBlock>Acerca de:</TextBlock>
<TextBlock>Aplicacion desarrollada por:</TextBlock>
<TextBlock>Robinson Moscoso</TextBlock>
<TextBlock>rmoscosp@hotmail.com</TextBlock>
<TextBlock>Tel: 57-3002141652</TextBlock>
<TextBlock>robinmp.wix.com</TextBlock>
<TextBlock></TextBlock>
<TextBlock>Política de privacidad</TextBlock>
<TextBlock TextWrapping="Wrap">Esta aplicación hace uso de la conexión a internet, única y exclusivamente, para descargar información relativa de la misma desde nuestros servidores. Ninguna información de la máquina o del usuario es enviada de vuelta a ellos ni a ningún otro servidor a través de internet ni de ningún otro medio por parte de esta aplicación.</TextBlock>

</StackPanel>

</Grid>
</UserControl>



2. Definir una variable en el app.xaml.cs que permita controlar que ya se registró el evento que publica el vinculo en el charm de settings.



image


3. Definir en la primera pagina que se ejecuta en mi app el evento que adiciona a settings el vinculo al xaml que he creado en el punto 1:



a. adicionar variables de control:


image


b. Adicionar en el constructor el registro del evento:


image


c. Adicionar el método OnCommandRequest:


image


d. Adicionar el método onSettingsCommand: (en este método relaciono el xaml de AcercaDe.xaml creado en el numeral 1 de este post)


image


e. agrego los métodos de OnWindowSizeChanged, OnWindowActivated y OnPopupClosed


image


f. todo el código debería verse asi:

using MiTaskList.DataModel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.ApplicationSettings;
using Windows.UI.Popups;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Media.Animation;
using Windows.UI.Xaml.Navigation;

// The Basic Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234237

namespace MiTaskList
{
/// <summary>
/// A basic page that provides characteristics common to most applications.
/// </summary>
public sealed partial class Inicio : MiTaskList.Common.LayoutAwarePage
{

// Used to determine the correct height to ensure our custom UI fills the screen.
private Rect windowBounds;

// Desired width for the settings UI. UI guidelines specify this should be 346 or 646 depending on your needs.
private double settingsWidth = 646;

// This is the container that will hold our custom content.
private Popup settingsPopup;


public Inicio()
{
this.InitializeComponent();

windowBounds = Window.Current.Bounds;

// Added to listen for events when the window size is updated.
Window.Current.SizeChanged += OnWindowSizeChanged;

//Evento de lanzamiento de settings
//rootPage.NotifyUser("Defaults command added", NotifyType.StatusMessage);
if (!App.isEventRegistered)
{
// Listening for this event lets the app initialize the settings commands and pause its UI until the user closes the pane.
// To ensure your settings are available at all times in your app, place your CommandsRequested handler in the overridden
// OnWindowCreated of App.xaml.cs
SettingsPane.GetForCurrentView().CommandsRequested += onCommandsRequested;
App.isEventRegistered = true;
}


}

private void onCommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs eventArgs)
{
UICommandInvokedHandler handler = new UICommandInvokedHandler(onSettingsCommand);

SettingsCommand generalCommand = new SettingsCommand("DefaultsId", "Acerca de", handler);
eventArgs.Request.ApplicationCommands.Add(generalCommand);
}

private void onSettingsCommand(IUICommand command)
{
//rootPage.NotifyUser("Defaults command invoked", NotifyType.StatusMessage);

// Create a Popup window which will contain our flyout.
settingsPopup = new Popup();
settingsPopup.Closed += OnPopupClosed;
Window.Current.Activated += OnWindowActivated;
settingsPopup.IsLightDismissEnabled = true;
settingsPopup.Width = settingsWidth;
settingsPopup.Height = windowBounds.Height;

// Add the proper animation for the panel.
settingsPopup.ChildTransitions = new TransitionCollection();
settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
{
Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
EdgeTransitionLocation.Right :
EdgeTransitionLocation.Left
});

// Create a SettingsFlyout the same dimenssions as the Popup.
AcercaDe mypane = new AcercaDe();
mypane.Width = settingsWidth;
mypane.Height = windowBounds.Height;

// Place the SettingsFlyout inside our Popup window.
settingsPopup.Child = mypane;

// Let's define the location of our Popup.
settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
settingsPopup.SetValue(Canvas.TopProperty, 0);
settingsPopup.IsOpen = true;
}

void OnWindowSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
windowBounds = Window.Current.Bounds;
}

private void OnWindowActivated(object sender, Windows.UI.Core.WindowActivatedEventArgs e)
{
if (e.WindowActivationState == Windows.UI.Core.CoreWindowActivationState.Deactivated)
{
settingsPopup.IsOpen = false;
}
}

void OnPopupClosed(object sender, object e)
{
Window.Current.Activated -= OnWindowActivated;
}


/// <summary>
/// Populates the page with content passed during navigation. Any saved state is also
/// provided when recreating a page from a prior session.
/// </summary>
/// <param name="navigationParameter">The parameter value passed to
/// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested.
/// </param>
/// <param name="pageState">A dictionary of state preserved by this page during an earlier
/// session. This will be null the first time a page is visited.</param>
protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
}

/// <summary>
/// Preserves state associated with this page in case the application is suspended or the
/// page is discarded from the navigation cache. Values must conform to the serialization
/// requirements of <see cref="SuspensionManager.SessionState"/>.
/// </summary>
/// <param name="pageState">An empty dictionary to be populated with serializable state.</param>
protected override void SaveState(Dictionary<String, Object> pageState)
{
}

}
}

 


luego se ejecutar y al hacer clic en settings  se ve de esta forma:


image


y al hacer clic en acerca de, se abre el AcercaDe.xaml:


image

domingo, 9 de septiembre de 2012

Iconos para mi WinRT App

Cuando vemos el diseño que traen las app para windows 8 los iconos llaman bastante la atención.
image
Y cuando desarrollamos nuestras apps y queremos tener dicho iconos en ellas, para muchos la opción es buscar el png en algún buscador de imagenes, o incluso abrir paint y manos a la obra.
Lo que muchos no saben, es que estos íconos son una fuente que viene en windows, y que la podemos utilizar en nuestra app y solo utilizar el simbolo que correspone al icono respectivo dentro de un textblock por ejemplo.
El tipo de letra a utilizar es “Segoe UI Symbol” y con el mapa de caracteres podemos identificar el simbolo que queremos utilizar en nuestra app.
image
Luego lo seleccionamos, lo copiamos y lo pegamos dentro de un Textblock que tenga en el atributo FontFamily el tipo de letra “Segoe UI Symbol”.
image
Y pues al ser una fuente tenemos la ventaja de poder cambiar el tamaño fácilmente, el color de nuestros iconos, y lo mejor de todo, nuestra app queda mucho mas liviana al no tener que incluir este tipo de imágenes. 
El resultado:
 image

jueves, 6 de septiembre de 2012

A desarrollar Windows 8 apps con BDotNet, Microsoft y apps.co

 

Hola, teniendo en cuenta la iniciativa del Ministerio TIC , apps co en la cual se apoya el desarrollo de aplicaciones en nuevas tecnologías (Click aquí para más información) y el apoyo de Microsoft para que estas apps sean en Windows 8 y Windows Phone, BDotNet se une a esta iniciativa capacitando a los desarrolladores que quieran hacer parte de esta iniciativa.

¿Cómo se van a realizar dichas capacitaciones?

Esta capacitaciones se harán por medio de web cast, en los cuales guiaremos el proceso del desarrollo de las apps que nuestros miembros quieran sacar adelante.

Inicialmente las capacitaciones estarán basadas en Windows 8, para lo cual es importante que se inscriban en la pagina oficial del apps co, seleccionando que la tecnología a aprendes de desarrollo Nativo y dentro de esta Windows 8

image

image

Es muy importante tener en cuenta que solo se pueden capacitar en una tecnología a la vez, y si el usuario se inscribe más de una vez, solo se tendrá en cuenta el ultimo registro que haya realizado.

Ahora, los invitamos a que sigan la comunidad, a través de nuestra página www.bogotadotnet.org, en nuestra página de facebook https://www.facebook.com/ComunidadBogotaDotNet y en twitter a través del hashtag #BDotNet  para informarlos de los pasos a seguir.