SlideShare una empresa de Scribd logo
C ésar A. Fong E. [email_address] Riminigames MS MVP Mobile Devices Usando las APIs administradas de Windows Mobile 5.0
Apis Administradas de Microsoft Windows Mobile 5.0 State and Notification Broker (Manejador de Notificaciones y Estado) Pocket Outlook  Contact Chooser (Seleccionar Contactos) Picture Picker (Seleccionar Imagen) SMS Interception (Intercepción SMS) Telephony (Telefonía)
Resumen del Namespace Microsoft.WindowsMobile WindowsMobile.PocketOutlook Editar Contactos, Citas y Tareas Controlar la aplicación de Mensajería Enviar SMS y E-Mail Interceptar mensajes SMS ingresantes WindowsMobile.Status   Consultar más de 100 propiedades de sistema Ser notificados en los cambios WindowsMobile.Configuration Configuration Manager WindowsMobile.Telephony Iniciar llamadas telefónicas WindowsMobile.Forms Contact Picker Dialog Picture Picker Dialog Camera Capture Dialog
¿Cuantás veces hemos querido saber cómo se hacen las siguientes operaciones? Detectar una llamada perdida. Enviar SMS personalizados Citas actuales Mensajes personalizados Consultas remotas por SMS.
State and Notification Broker (S&N) Microsoft.WindowsMobile.Status Sobre 100 estados predefinidos Unificación de estado if (SystemState.CradlePresent) { // Descarga los datos . } Red Mensajeria Teléfono Citas Media Player Hardware  disponible
S&N Broker Notifications Notificación cuando un estado cambia Notificaciones temporales Aplicación sólo es notificada mientras está siendo ejecutada. Se elimina si el dispositivo se reinicia. Notificaciones persistentes Lanzará la aplicación aun así no esté siendo ejecutado. Persiste despues de reiniciar el dispositivo.
Usando Notificaciones SystemState cradle;  // variable cradle  = new SystemState(System Property . CradlePresent ); cradle .Changed +=  new ChangeEventHandler( cradle_Changed );  void  cradle_Changed (object sender, ChangeEventArgs args) { bool present = (int)args.NewValue == 1; } private void MainForm_Closed(object sender, EventArgs e) { cradle .Dispose(); }
Notificaciones condicionales Operadores condicionales enteros ==, !=, >, >=, <, <= Operadores condicionales para texto ==, !=, >, >=, <, <=, contains (contiene), starts with (inicia con), ends with (termina con) No hay condiciones disponibles para datos binarios
Usando Condiciones SystemState cradle;  // member variable cradle  = new SystemState( SystemProperty.CradlePresent ); cradle .ComparisonType = StatusComparisonType. Equal; cradle .ComparisonValue =  1 ; cradle .Changed +=  new ChangeEventHandler( cradle _Changed);  v oid  cradle _Changed(object sender, ChangeEventArgs args) { bool present = (int)args.NewValue == 1; } private void MainForm_Closed(object sender, EventArgs e) { cradle.Dispose(); } // Empiezar a descargar info
Usando Notificaciones Persistentes SystemState cradle;  // member variable cradle  = new SystemState( SystemProperty.CradlePresent ); cradle .ComparisonType = StatusComparisonType. Equal; cradle .ComparisonValue =  1 ; cradle .Changed +=  new ChangeEventHandler( cradle _Changed); cradle.EnableApplicationLauncher(“ MS .Cradle&quot;); v oid  cradle _Changed(object sender, ChangeEventArgs args) { // Empieza a descargar los datos } private void MainForm_Closed(object sender, EventArgs e) { cradle.Dispose(); }
Usando Notificaciones Persistentes cradle  = new SystemState( SystemProperty.CradlePresent ); cradle .ComparisonType = StatusComparisonType. Equal; cradle .ComparisonValue =  1 ; cradle .Changed +=  new ChangeEventHandler( cradle _Changed); cradle.EnableApplicationLauncher(“ MS .Cradle&quot;); if (SystemState.IsApplicationLauncherEnabled(“ MS .Cradle&quot;)) { cradle = new SystemState(“MS.Cradle”); cradle .Changed +=  new ChangeEventHandler( cradle _Changed); } else { } SystemState cradle;  // member variable
Usando Notificaciones
Extendiendo el S&N Broker Estados son almacenados en el registro Class RegistryState Habilita aplicaciones externas string key = @&quot;HKEY_CURRENT_USER\SOFTWARE\COMPANY\APP&quot;; string value = &quot;AppState&quot;; RegistryState  myState = new RegistryState(key, value);
Pocket Outlook Microsoft.WindowsMobile.PocketOutlook Todo se inicia aqui Necesita ser liberado (disposed) Contactos Citas Tareas OutlookSession outlook = new OutlookSession(); int contContactos = outlook.Contacts.Items.Count; Outlook.Dispose(); Sesion de Outlook Información Personal
Pocket Outlook Microsoft.WindowsMobile.PocketOutlook 1 folder por tipo Cada uno tiene una colección Enumera items Verifica capacidades Ordenar y Filtrar Agregar y Remover Evento ListChanged Folders y Colecciones
Pocket Outlook Microsoft.WindowsMobile.PocketOutlook Muchas propiedades y eventos No olvidar  Update() Contactos Citas Tareas OutlookSession outlook = new OutlookSession(); Contact yo = new Contact(); yo.FullName = “Cesar Fong”; outlook.Contacts.Items.Add( me ); // <-- Grabado yo.JobTitle = “Desarrollador”;  yo.Update();  // <-- Grabado Información Personal
Citas y Tareas pueden ser recurrentes Microsoft.WindowsMobile.PocketOutlook
Citas y Tareas pueden ser recurrentes Microsoft.WindowsMobile.PocketOutlook Recurrence Type Properties to Use Example Daily Interval Cada 4 días Weekly Interval DaysOfWeekMask Cada Lunes y Martes Monthly Interval DayOfMonth Cada 3 meses MonthlyByNumber Interval DaysOfWeekMask Instance Segundo viernes de cada mes Yearly DayOfMonth MonthOfYear 10 de Mayo de cada año YearlyByNumber DaysOfWeekMask Instance MonthOfYear Segundo martes de Mayo de cada año (All) PatternStartDate PatternEndDate NoEndDate
Items con ShowDialog Microsoft.WindowsMobile.PocketOutlook Appointment cita = new Appointment(); cita.Subject = &quot;Launch Windows Mobile 5.0!&quot;; cita.AllDayEvent = true; cita.Start = new DateTime(2005, 5, 10); outlook.Appointments.Items.Add(appt); cita.ShowDialog(); Los items pueden ser mostrados en Outlook Mobile con ShowDialog
Propiedades Personalizadas Pocket Outlook Agrega tus propias propiedades No sincroniza con el escritorio Tener en cuenta lo siguiente: Ver si la propiedad ha sido definido Si no, defínelo Úsalo Contact miCliente; // ... if(!miCliente.Properties.Contains(“ID Empleado”)) { miCliente.Properties.Add(&quot;ID Empleado&quot;, typeof(string)); } miCliente.Properties[&quot;ID Empleado&quot;] = &quot;ABC1234&quot;; miCliente.Update();
Usando las propiedades de los contactos
Pocket Outlook Microsoft.WindowsMobile.PocketOutlook E-mail SMS Mensajeria
Enviando un E-mail OutlookSession session = new OutlookSession(); EmailMessage email = new EmailMessage(); email.To.Add(new Recipient(“tu@dominio.com”); email.Subject = “Webcast”; email.BodyText = “¡Hola!”; EmailAccount emailAccount =  session.EmailAccounts[0]; email.Send(emailAccount); session.Dispose(); // Enviar el correo MessagingApplication.Synchronize(emailAccount);
Enviando un SMS SmsMessage sms = new SmsMessage(“800-555-1212”, “¿Dónde estás?”); sms.Send();
Contactos no son Recipientes Contact miCliente; // ... EmailMessage msg = new EmailMessage(); msg.To.Add(miCliente );  // ¡No compilará! msg.To.Add( new Recipient(miCliente.Email2Address ) );// OK
Usando SMS
Controlar la aplicación de Mensajería Mostrar el Componer Mostrar el Inbox Iniciar sincronización
Contact Chooser Microsoft.WindowsMobile.Forms Fácilmente escoge un contacto Puede limitarse por propiedades Look and Feel Consistente ChooseContactDialog  selectContacto = new ChooseContactDialog(); If (selectContacto.ShowDialog() == DialogResult.OK) { // Especifica que sucede // si el usuario selecciona // un contacto }
Contact Chooser Microsoft.WindowsMobile.Forms Traer propiedades sólo del usuario Una vez que tiene un  contacto seleccionado llama a ShowDialog, despues: Configurar ChoosePropertyOnly=True Retornar SelectedProperty, (typeof PocketOutlook.Property); y SelectedPropertyValue, (string) selectContacto.RestrictContacts =  “ [CompanyName] = “\Contoso\””; selectContacto.RequiredProperties =  new ContactProperty[] { ContactProperty.AllTextMessaging };
Usando  Contact Chooser
Picture Picker Microsoft.WindowsMobile.Forms Fácilmente seleccionar una imagen Puede habilitar el uso de la camara Look and Feel Consistente SelectPictureDialog  escogeimagen = new SelectPictureDialog(); If (escogeimagen.ShowDialog()  == DialogResult.OK) { // Especifica que pasa //  }
Camera Picker Microsoft.WindowsMobile.Forms CameraCaptureDialog camara  = new CameraCaptureDialog(); If (camara.ShowDialog() == DialogResult.OK) { // Especifica que pasa }
Usando el Picture Picker
Intercepción SMS PocketOutlook.MessageInterception Recibe una notificación cuando arriva el SMS Notificaciones temporales Notificaciones persistentes Eliminación opcional del SMS Se puede filtrar notificaciones SMS usando condiciones Campos SMS: Cuerpo (Body) o Enviado Por (Sender) Operadores: Equal, Not Equal, Contains, StartsWith, EndsWith
Interceptar mensajes SMS en código nativo //================================================================= // MonitorThread - Monitors event for timer notification  // DWORD WINAPI MonitorThread (PVOID pArg) { TEXT_PROVIDER_SPECIFIC_DATA tpsd; SMS_HANDLE smshHandle = (SMS_HANDLE)pArg; PMYMSG_STRUCT pNextMsg; BYTE bBuffer[MAXMESSAGELEN]; PBYTE pIn; SYSTEMTIME st; HANDLE hWait[2]; HRESULT hr; int rc; DWORD dwInSize, dwSize, dwRead = 0; hWait[0] = g_hReadEvent;  // Need two events since it isn't hWait[1] = g_hQuitEvent;  // allowed for us to signal SMS event. while (g_fContinue) { rc = WaitForMultipleObjects (2, hWait, FALSE, INFINITE); if (!g_fContinue || (rc != WAIT_OBJECT_0)) break; // Point to the next free entry in the array pNextMsg = &g_pMsgDB->pMsgs[g_pMsgDB->nMsgCnt]; // Get the message size hr = SmsGetMessageSize (smshHandle, &dwSize); if (hr != ERROR_SUCCESS) continue; // Check for message larger than std buffer if (dwSize > sizeof (pNextMsg->wcMessage)) { if (dwSize > MAXMESSAGELEN)  continue; pIn = bBuffer; dwInSize = MAXMESSAGELEN; } else { pIn = (PBYTE)pNextMsg->wcMessage; dwInSize = sizeof (pNextMsg->wcMessage); } // Set up provider specific data tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE; tpsd.psMessageClass = PS_MESSAGE_CLASS0; tpsd.psReplaceOption = PSRO_NONE; tpsd.dwHeaderDataSize = 0; // Read the message hr = SmsReadMessage (smshHandle, NULL, &pNextMsg->smsAddr, &st, (PBYTE)pIn, dwInSize, (PBYTE)&tpsd,  sizeof(TEXT_PROVIDER_SPECIFIC_DATA), &dwRead); if (hr == ERROR_SUCCESS) { // Convert GMT message time to local time FILETIME ft, ftLocal; SystemTimeToFileTime (&st, &ft); FileTimeToLocalFileTime (&ft, &ftLocal); FileTimeToSystemTime (&ftLocal, &pNextMsg->stMsg); // If using alt buffer, copy to std buff  if ((DWORD)pIn == (DWORD)pNextMsg->wcMessage) { pNextMsg->nSize = (int) dwRead; } else { memset (pNextMsg->wcMessage, 0,  sizeof(pNextMsg->wcMessage)); memcpy (pNextMsg->wcMessage, pIn,  sizeof(pNextMsg->wcMessage)-2); pNextMsg->nSize = sizeof(pNextMsg->wcMessage); } // Increment message count if (g_pMsgDB->nMsgCnt < MAX_MSGS-1) { if (g_hMain) PostMessage (g_hMain, MYMSG_TELLNOTIFY, 1,  g_pMsgDB->nMsgCnt); g_pMsgDB->nMsgCnt++; } } else { ErrorBox (g_hMain, TEXT(&quot;Error %x (%d) reading msg&quot;),  hr, GetLastError()); break; } } SmsClose (smshHandle); return 0; }
Usando el MessageInterceptor MessageInterceptor  mi = new  M essageInterceptor(); mi.InterceptionAction = InterceptionAction.NotifyAndDelete; MessageCondition mc = new MessageCondition(); mc .CaseSensitive =  true ; m c .ComparisonType = MessagePropertyComparisonType .EndsWith ; mc. ComparisonValue = “ MobDay &quot;; mi.MessageCondition =  mc; mi.MessageReceived +=  new MessageInterceptorEventHandler(mi_MessageReceived); void mi _ MessageReceived(object sender,  MessageInterceptorEventArgs e) { if (e.Message is SmsMessage) { SmsMessage sms = (SmsMessage)e.Message; } }
Escenarios para Intercepción de SMS SMS cómo un transporte Iniciar una actualización Consultas remotas Control y administración remoto.
Telephony Microsoft.WindowsMobile.Telephony Hacer una llamada. Escoger hacer prompt o no Se puede obtener propiedades usando el S&N Broker Dim phone As New Phone phone.Talk( “425-555-1212” )
Usando Telephony
Apis Administradas de Microsoft Windows Mobile 5.0 State and Notification Broker Pocket Outlook Contact Chooser Picture Picker SMS Interception Telephony
Más información Windows Mobile 5.0 SDK Documentación en MSDN http://msdn.microsoft.com/mobility/ Windows Mobile Blog http://blogs.msdn.com/windowsmobile/default.aspx Blog:  http://www.cesarfong.info

Más contenido relacionado

PDF
Guia no2 ado.net
DOCX
CONEXION VISUAL STUDIO.NET - SQL SERVER
PDF
Ejercicios en Netbeans
PDF
Elemento n3
ODP
JSR354: Moneda y Dinero
DOC
Trucos en excel avanzado
PDF
Windows forms c# visual basic .net ejercicios
Guia no2 ado.net
CONEXION VISUAL STUDIO.NET - SQL SERVER
Ejercicios en Netbeans
Elemento n3
JSR354: Moneda y Dinero
Trucos en excel avanzado
Windows forms c# visual basic .net ejercicios

La actualidad más candente (20)

PDF
Manual tecnico
PDF
Practica Dos Delphi
PDF
Guia 12 js
PDF
Ejemplo de aplicación cliente-servidor en C#
DOCX
Parte II. Notas Rapidas (sticky notes) App W8: MVVM y SQLite.
PDF
Aplicación Cliente - Servidor / GUI - Consola
PPTX
P1C5 Lenguaje de Expresiones
PDF
Guia5 java
PDF
Practica Cuatro Delphi
PDF
Tips componentes swing_v5
DOC
Formulario De Registro De Boleta De Ventay Mantenimiento De Cliente
PDF
5. Interacción con el usuario: eventos y formularios
PPT
Desarrollo de Aplicaciones con Microsoft Ajax 1.0 y Ajax Control Toolkit
PDF
Secure txscalacsharp
DOCX
FormularioFaturaFoxpro
PDF
Práctica Completa en Flash – ActionScript
PDF
6. Utilización del modelo de objetos del documento (DOM)
PDF
Clase 10 formularios
PDF
Manuales seminario java-manualdejava-sem 3 - 4
Manual tecnico
Practica Dos Delphi
Guia 12 js
Ejemplo de aplicación cliente-servidor en C#
Parte II. Notas Rapidas (sticky notes) App W8: MVVM y SQLite.
Aplicación Cliente - Servidor / GUI - Consola
P1C5 Lenguaje de Expresiones
Guia5 java
Practica Cuatro Delphi
Tips componentes swing_v5
Formulario De Registro De Boleta De Ventay Mantenimiento De Cliente
5. Interacción con el usuario: eventos y formularios
Desarrollo de Aplicaciones con Microsoft Ajax 1.0 y Ajax Control Toolkit
Secure txscalacsharp
FormularioFaturaFoxpro
Práctica Completa en Flash – ActionScript
6. Utilización del modelo de objetos del documento (DOM)
Clase 10 formularios
Manuales seminario java-manualdejava-sem 3 - 4
Publicidad

Destacado (20)

PDF
CNTF investor presentation june 2013
PDF
Financial planning & capital investment evaluation
PDF
Mas2 analysis and interpretation of fs
PPT
Strategic Market Research (Chapter 7): Analyzing Numeric Data to Determine W...
PPT
Strategic Market Research (Chapter 5): Reading the Hidden Communications of R...
PPT
Strategic Market Research (Chapter 3): Choosing the Right Method
PPT
Marketing Research (Marketing, 8th Edition)
PDF
Creating a new language to support open innovation
DOC
Sententzia Amatasuna2.Ariketa
DOC
FairTrade poster
PPT
7.Ariketa Familia babesa
PPS
69 Mortal
 
PPT
Porter Novelli
PPS
The Usa 1
PDF
from Belles and Brigands collection
PDF
Elk Layout 2
PDF
Foreign Born: NYLON
PPT
Produtos Desenvolva
PPT
Los Fundamentos FilolóGicos De La InvestigacióN De La
PPS
Pan Diario 06 De Enero De 2009
CNTF investor presentation june 2013
Financial planning & capital investment evaluation
Mas2 analysis and interpretation of fs
Strategic Market Research (Chapter 7): Analyzing Numeric Data to Determine W...
Strategic Market Research (Chapter 5): Reading the Hidden Communications of R...
Strategic Market Research (Chapter 3): Choosing the Right Method
Marketing Research (Marketing, 8th Edition)
Creating a new language to support open innovation
Sententzia Amatasuna2.Ariketa
FairTrade poster
7.Ariketa Familia babesa
69 Mortal
 
Porter Novelli
The Usa 1
from Belles and Brigands collection
Elk Layout 2
Foreign Born: NYLON
Produtos Desenvolva
Los Fundamentos FilolóGicos De La InvestigacióN De La
Pan Diario 06 De Enero De 2009
Publicidad

Similar a Ap Is En Windows Mobile 5.0 V2.1 (20)

PPT
JUG DAY FLEX / JEE
PPTX
Statement
PDF
eyeOS: Arquitectura y desarrollo de una aplicación
KEY
Introducción a DJango
PPTX
Framework .NET 3.5 06 Operativa básica del framework .net
PPT
Jsf
PPT
Introducción Seam
PDF
CSA - Web Parts en SharePoint 2010
PPTX
Reglas de Oro para el Desarrollo con Windows Vista
PDF
UiPath Community - Automation Explorer Training - Bootcamp Día 3
PPT
Android Bootcamp - GTUG Uruguay
PDF
Bases de Datos en Java - Intro a JDBC
DOCX
Guía JavaScript
PPT
01 Ext Js Introduccion
PPT
Eventos
DOCX
Udproco undecimo b_y_c[1]
PPT
Clase09 java script
PDF
06. Creando un proceso web worker
PDF
Guia de Laboratorios 2 - VB.NET 2005
PPTX
Exposicion Dispositivos Moviles
JUG DAY FLEX / JEE
Statement
eyeOS: Arquitectura y desarrollo de una aplicación
Introducción a DJango
Framework .NET 3.5 06 Operativa básica del framework .net
Jsf
Introducción Seam
CSA - Web Parts en SharePoint 2010
Reglas de Oro para el Desarrollo con Windows Vista
UiPath Community - Automation Explorer Training - Bootcamp Día 3
Android Bootcamp - GTUG Uruguay
Bases de Datos en Java - Intro a JDBC
Guía JavaScript
01 Ext Js Introduccion
Eventos
Udproco undecimo b_y_c[1]
Clase09 java script
06. Creando un proceso web worker
Guia de Laboratorios 2 - VB.NET 2005
Exposicion Dispositivos Moviles

Último (20)

PPTX
ANCASH-CRITERIOS DE EVALUACIÓN-FORMA-10-10 (2).pptx
PDF
Influencia-del-uso-de-redes-sociales.pdf
DOCX
Zarate Quispe Alex aldayir aplicaciones de internet .docx
PPTX
Historia Inteligencia Artificial Ana Romero.pptx
PDF
Documental Beyond the Code (Dossier Presentación - 2.0)
PPTX
Propuesta BKP servidores con Acronis1.pptx
DOCX
Guía 5. Test de orientación Vocacional 2.docx
PPT
introduccion a las_web en el 2025_mejoras.ppt
PPTX
Presentación PASANTIAS AuditorioOO..pptx
PDF
Instrucciones simples, respuestas poderosas. La fórmula del prompt perfecto.
PPTX
historia_web de la creacion de un navegador_presentacion.pptx
DOCX
Contenido Fundamentos de comunicaciones Fibra Optica (1).docx
PPTX
Presentación de Redes de Datos modelo osi
PPT
El-Gobierno-Electrónico-En-El-Estado-Bolivia
PPTX
sa-cs-82-powerpoint-hardware-y-software_ver_4.pptx
PDF
TRABAJO DE TECNOLOGIA.pdf...........................
PDF
informe_fichas1y2_corregido.docx (2) (1).pdf
PPTX
Power Point Nicolás Carrasco (disertación Roblox).pptx
PDF
CyberOps Associate - Cisco Networking Academy
PDF
Maste clas de estructura metálica y arquitectura
ANCASH-CRITERIOS DE EVALUACIÓN-FORMA-10-10 (2).pptx
Influencia-del-uso-de-redes-sociales.pdf
Zarate Quispe Alex aldayir aplicaciones de internet .docx
Historia Inteligencia Artificial Ana Romero.pptx
Documental Beyond the Code (Dossier Presentación - 2.0)
Propuesta BKP servidores con Acronis1.pptx
Guía 5. Test de orientación Vocacional 2.docx
introduccion a las_web en el 2025_mejoras.ppt
Presentación PASANTIAS AuditorioOO..pptx
Instrucciones simples, respuestas poderosas. La fórmula del prompt perfecto.
historia_web de la creacion de un navegador_presentacion.pptx
Contenido Fundamentos de comunicaciones Fibra Optica (1).docx
Presentación de Redes de Datos modelo osi
El-Gobierno-Electrónico-En-El-Estado-Bolivia
sa-cs-82-powerpoint-hardware-y-software_ver_4.pptx
TRABAJO DE TECNOLOGIA.pdf...........................
informe_fichas1y2_corregido.docx (2) (1).pdf
Power Point Nicolás Carrasco (disertación Roblox).pptx
CyberOps Associate - Cisco Networking Academy
Maste clas de estructura metálica y arquitectura

Ap Is En Windows Mobile 5.0 V2.1

  • 1. C ésar A. Fong E. [email_address] Riminigames MS MVP Mobile Devices Usando las APIs administradas de Windows Mobile 5.0
  • 2. Apis Administradas de Microsoft Windows Mobile 5.0 State and Notification Broker (Manejador de Notificaciones y Estado) Pocket Outlook Contact Chooser (Seleccionar Contactos) Picture Picker (Seleccionar Imagen) SMS Interception (Intercepción SMS) Telephony (Telefonía)
  • 3. Resumen del Namespace Microsoft.WindowsMobile WindowsMobile.PocketOutlook Editar Contactos, Citas y Tareas Controlar la aplicación de Mensajería Enviar SMS y E-Mail Interceptar mensajes SMS ingresantes WindowsMobile.Status Consultar más de 100 propiedades de sistema Ser notificados en los cambios WindowsMobile.Configuration Configuration Manager WindowsMobile.Telephony Iniciar llamadas telefónicas WindowsMobile.Forms Contact Picker Dialog Picture Picker Dialog Camera Capture Dialog
  • 4. ¿Cuantás veces hemos querido saber cómo se hacen las siguientes operaciones? Detectar una llamada perdida. Enviar SMS personalizados Citas actuales Mensajes personalizados Consultas remotas por SMS.
  • 5. State and Notification Broker (S&N) Microsoft.WindowsMobile.Status Sobre 100 estados predefinidos Unificación de estado if (SystemState.CradlePresent) { // Descarga los datos . } Red Mensajeria Teléfono Citas Media Player Hardware disponible
  • 6. S&N Broker Notifications Notificación cuando un estado cambia Notificaciones temporales Aplicación sólo es notificada mientras está siendo ejecutada. Se elimina si el dispositivo se reinicia. Notificaciones persistentes Lanzará la aplicación aun así no esté siendo ejecutado. Persiste despues de reiniciar el dispositivo.
  • 7. Usando Notificaciones SystemState cradle; // variable cradle = new SystemState(System Property . CradlePresent ); cradle .Changed += new ChangeEventHandler( cradle_Changed ); void cradle_Changed (object sender, ChangeEventArgs args) { bool present = (int)args.NewValue == 1; } private void MainForm_Closed(object sender, EventArgs e) { cradle .Dispose(); }
  • 8. Notificaciones condicionales Operadores condicionales enteros ==, !=, >, >=, <, <= Operadores condicionales para texto ==, !=, >, >=, <, <=, contains (contiene), starts with (inicia con), ends with (termina con) No hay condiciones disponibles para datos binarios
  • 9. Usando Condiciones SystemState cradle; // member variable cradle = new SystemState( SystemProperty.CradlePresent ); cradle .ComparisonType = StatusComparisonType. Equal; cradle .ComparisonValue = 1 ; cradle .Changed += new ChangeEventHandler( cradle _Changed); v oid cradle _Changed(object sender, ChangeEventArgs args) { bool present = (int)args.NewValue == 1; } private void MainForm_Closed(object sender, EventArgs e) { cradle.Dispose(); } // Empiezar a descargar info
  • 10. Usando Notificaciones Persistentes SystemState cradle; // member variable cradle = new SystemState( SystemProperty.CradlePresent ); cradle .ComparisonType = StatusComparisonType. Equal; cradle .ComparisonValue = 1 ; cradle .Changed += new ChangeEventHandler( cradle _Changed); cradle.EnableApplicationLauncher(“ MS .Cradle&quot;); v oid cradle _Changed(object sender, ChangeEventArgs args) { // Empieza a descargar los datos } private void MainForm_Closed(object sender, EventArgs e) { cradle.Dispose(); }
  • 11. Usando Notificaciones Persistentes cradle = new SystemState( SystemProperty.CradlePresent ); cradle .ComparisonType = StatusComparisonType. Equal; cradle .ComparisonValue = 1 ; cradle .Changed += new ChangeEventHandler( cradle _Changed); cradle.EnableApplicationLauncher(“ MS .Cradle&quot;); if (SystemState.IsApplicationLauncherEnabled(“ MS .Cradle&quot;)) { cradle = new SystemState(“MS.Cradle”); cradle .Changed += new ChangeEventHandler( cradle _Changed); } else { } SystemState cradle; // member variable
  • 13. Extendiendo el S&N Broker Estados son almacenados en el registro Class RegistryState Habilita aplicaciones externas string key = @&quot;HKEY_CURRENT_USER\SOFTWARE\COMPANY\APP&quot;; string value = &quot;AppState&quot;; RegistryState myState = new RegistryState(key, value);
  • 14. Pocket Outlook Microsoft.WindowsMobile.PocketOutlook Todo se inicia aqui Necesita ser liberado (disposed) Contactos Citas Tareas OutlookSession outlook = new OutlookSession(); int contContactos = outlook.Contacts.Items.Count; Outlook.Dispose(); Sesion de Outlook Información Personal
  • 15. Pocket Outlook Microsoft.WindowsMobile.PocketOutlook 1 folder por tipo Cada uno tiene una colección Enumera items Verifica capacidades Ordenar y Filtrar Agregar y Remover Evento ListChanged Folders y Colecciones
  • 16. Pocket Outlook Microsoft.WindowsMobile.PocketOutlook Muchas propiedades y eventos No olvidar Update() Contactos Citas Tareas OutlookSession outlook = new OutlookSession(); Contact yo = new Contact(); yo.FullName = “Cesar Fong”; outlook.Contacts.Items.Add( me ); // <-- Grabado yo.JobTitle = “Desarrollador”; yo.Update(); // <-- Grabado Información Personal
  • 17. Citas y Tareas pueden ser recurrentes Microsoft.WindowsMobile.PocketOutlook
  • 18. Citas y Tareas pueden ser recurrentes Microsoft.WindowsMobile.PocketOutlook Recurrence Type Properties to Use Example Daily Interval Cada 4 días Weekly Interval DaysOfWeekMask Cada Lunes y Martes Monthly Interval DayOfMonth Cada 3 meses MonthlyByNumber Interval DaysOfWeekMask Instance Segundo viernes de cada mes Yearly DayOfMonth MonthOfYear 10 de Mayo de cada año YearlyByNumber DaysOfWeekMask Instance MonthOfYear Segundo martes de Mayo de cada año (All) PatternStartDate PatternEndDate NoEndDate
  • 19. Items con ShowDialog Microsoft.WindowsMobile.PocketOutlook Appointment cita = new Appointment(); cita.Subject = &quot;Launch Windows Mobile 5.0!&quot;; cita.AllDayEvent = true; cita.Start = new DateTime(2005, 5, 10); outlook.Appointments.Items.Add(appt); cita.ShowDialog(); Los items pueden ser mostrados en Outlook Mobile con ShowDialog
  • 20. Propiedades Personalizadas Pocket Outlook Agrega tus propias propiedades No sincroniza con el escritorio Tener en cuenta lo siguiente: Ver si la propiedad ha sido definido Si no, defínelo Úsalo Contact miCliente; // ... if(!miCliente.Properties.Contains(“ID Empleado”)) { miCliente.Properties.Add(&quot;ID Empleado&quot;, typeof(string)); } miCliente.Properties[&quot;ID Empleado&quot;] = &quot;ABC1234&quot;; miCliente.Update();
  • 21. Usando las propiedades de los contactos
  • 23. Enviando un E-mail OutlookSession session = new OutlookSession(); EmailMessage email = new EmailMessage(); email.To.Add(new Recipient(“tu@dominio.com”); email.Subject = “Webcast”; email.BodyText = “¡Hola!”; EmailAccount emailAccount = session.EmailAccounts[0]; email.Send(emailAccount); session.Dispose(); // Enviar el correo MessagingApplication.Synchronize(emailAccount);
  • 24. Enviando un SMS SmsMessage sms = new SmsMessage(“800-555-1212”, “¿Dónde estás?”); sms.Send();
  • 25. Contactos no son Recipientes Contact miCliente; // ... EmailMessage msg = new EmailMessage(); msg.To.Add(miCliente ); // ¡No compilará! msg.To.Add( new Recipient(miCliente.Email2Address ) );// OK
  • 27. Controlar la aplicación de Mensajería Mostrar el Componer Mostrar el Inbox Iniciar sincronización
  • 28. Contact Chooser Microsoft.WindowsMobile.Forms Fácilmente escoge un contacto Puede limitarse por propiedades Look and Feel Consistente ChooseContactDialog selectContacto = new ChooseContactDialog(); If (selectContacto.ShowDialog() == DialogResult.OK) { // Especifica que sucede // si el usuario selecciona // un contacto }
  • 29. Contact Chooser Microsoft.WindowsMobile.Forms Traer propiedades sólo del usuario Una vez que tiene un contacto seleccionado llama a ShowDialog, despues: Configurar ChoosePropertyOnly=True Retornar SelectedProperty, (typeof PocketOutlook.Property); y SelectedPropertyValue, (string) selectContacto.RestrictContacts = “ [CompanyName] = “\Contoso\””; selectContacto.RequiredProperties = new ContactProperty[] { ContactProperty.AllTextMessaging };
  • 30. Usando Contact Chooser
  • 31. Picture Picker Microsoft.WindowsMobile.Forms Fácilmente seleccionar una imagen Puede habilitar el uso de la camara Look and Feel Consistente SelectPictureDialog escogeimagen = new SelectPictureDialog(); If (escogeimagen.ShowDialog() == DialogResult.OK) { // Especifica que pasa // }
  • 32. Camera Picker Microsoft.WindowsMobile.Forms CameraCaptureDialog camara = new CameraCaptureDialog(); If (camara.ShowDialog() == DialogResult.OK) { // Especifica que pasa }
  • 34. Intercepción SMS PocketOutlook.MessageInterception Recibe una notificación cuando arriva el SMS Notificaciones temporales Notificaciones persistentes Eliminación opcional del SMS Se puede filtrar notificaciones SMS usando condiciones Campos SMS: Cuerpo (Body) o Enviado Por (Sender) Operadores: Equal, Not Equal, Contains, StartsWith, EndsWith
  • 35. Interceptar mensajes SMS en código nativo //================================================================= // MonitorThread - Monitors event for timer notification // DWORD WINAPI MonitorThread (PVOID pArg) { TEXT_PROVIDER_SPECIFIC_DATA tpsd; SMS_HANDLE smshHandle = (SMS_HANDLE)pArg; PMYMSG_STRUCT pNextMsg; BYTE bBuffer[MAXMESSAGELEN]; PBYTE pIn; SYSTEMTIME st; HANDLE hWait[2]; HRESULT hr; int rc; DWORD dwInSize, dwSize, dwRead = 0; hWait[0] = g_hReadEvent; // Need two events since it isn't hWait[1] = g_hQuitEvent; // allowed for us to signal SMS event. while (g_fContinue) { rc = WaitForMultipleObjects (2, hWait, FALSE, INFINITE); if (!g_fContinue || (rc != WAIT_OBJECT_0)) break; // Point to the next free entry in the array pNextMsg = &g_pMsgDB->pMsgs[g_pMsgDB->nMsgCnt]; // Get the message size hr = SmsGetMessageSize (smshHandle, &dwSize); if (hr != ERROR_SUCCESS) continue; // Check for message larger than std buffer if (dwSize > sizeof (pNextMsg->wcMessage)) { if (dwSize > MAXMESSAGELEN) continue; pIn = bBuffer; dwInSize = MAXMESSAGELEN; } else { pIn = (PBYTE)pNextMsg->wcMessage; dwInSize = sizeof (pNextMsg->wcMessage); } // Set up provider specific data tpsd.dwMessageOptions = PS_MESSAGE_OPTION_NONE; tpsd.psMessageClass = PS_MESSAGE_CLASS0; tpsd.psReplaceOption = PSRO_NONE; tpsd.dwHeaderDataSize = 0; // Read the message hr = SmsReadMessage (smshHandle, NULL, &pNextMsg->smsAddr, &st, (PBYTE)pIn, dwInSize, (PBYTE)&tpsd, sizeof(TEXT_PROVIDER_SPECIFIC_DATA), &dwRead); if (hr == ERROR_SUCCESS) { // Convert GMT message time to local time FILETIME ft, ftLocal; SystemTimeToFileTime (&st, &ft); FileTimeToLocalFileTime (&ft, &ftLocal); FileTimeToSystemTime (&ftLocal, &pNextMsg->stMsg); // If using alt buffer, copy to std buff if ((DWORD)pIn == (DWORD)pNextMsg->wcMessage) { pNextMsg->nSize = (int) dwRead; } else { memset (pNextMsg->wcMessage, 0, sizeof(pNextMsg->wcMessage)); memcpy (pNextMsg->wcMessage, pIn, sizeof(pNextMsg->wcMessage)-2); pNextMsg->nSize = sizeof(pNextMsg->wcMessage); } // Increment message count if (g_pMsgDB->nMsgCnt < MAX_MSGS-1) { if (g_hMain) PostMessage (g_hMain, MYMSG_TELLNOTIFY, 1, g_pMsgDB->nMsgCnt); g_pMsgDB->nMsgCnt++; } } else { ErrorBox (g_hMain, TEXT(&quot;Error %x (%d) reading msg&quot;), hr, GetLastError()); break; } } SmsClose (smshHandle); return 0; }
  • 36. Usando el MessageInterceptor MessageInterceptor mi = new M essageInterceptor(); mi.InterceptionAction = InterceptionAction.NotifyAndDelete; MessageCondition mc = new MessageCondition(); mc .CaseSensitive = true ; m c .ComparisonType = MessagePropertyComparisonType .EndsWith ; mc. ComparisonValue = “ MobDay &quot;; mi.MessageCondition = mc; mi.MessageReceived += new MessageInterceptorEventHandler(mi_MessageReceived); void mi _ MessageReceived(object sender, MessageInterceptorEventArgs e) { if (e.Message is SmsMessage) { SmsMessage sms = (SmsMessage)e.Message; } }
  • 37. Escenarios para Intercepción de SMS SMS cómo un transporte Iniciar una actualización Consultas remotas Control y administración remoto.
  • 38. Telephony Microsoft.WindowsMobile.Telephony Hacer una llamada. Escoger hacer prompt o no Se puede obtener propiedades usando el S&N Broker Dim phone As New Phone phone.Talk( “425-555-1212” )
  • 40. Apis Administradas de Microsoft Windows Mobile 5.0 State and Notification Broker Pocket Outlook Contact Chooser Picture Picker SMS Interception Telephony
  • 41. Más información Windows Mobile 5.0 SDK Documentación en MSDN http://msdn.microsoft.com/mobility/ Windows Mobile Blog http://blogs.msdn.com/windowsmobile/default.aspx Blog: http://www.cesarfong.info

Notas del editor

  • #2: 06/07/09 06:00 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.