La descarga está en progreso. Por favor, espere

La descarga está en progreso. Por favor, espere

Conferencias Técnicas MSDN

Presentaciones similares


Presentación del tema: "Conferencias Técnicas MSDN"— Transcripción de la presentación:

1 Conferencias Técnicas MSDN
BIENVENIDOS

2 Desarrollo de Aplicaciones Windows con Visual Studio 2005
Daniel A. Montero González Jefe de Proyecto - Ministerio de Salud Santiago, Abril 2006

3 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

4 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

5 Introducción a Windows Forms ¿Qué es?
Tecnología incluida en el Framework .NET Aprovecha lo mejor de Windows Alta usabilidad para los clientes Aprovecha hardware local Layout preciso al pixel Y soluciona sus problemas típicos Instalación, mantenimiento Seguridad

6 Introducción a Windows Forms Se basa en…
Manejo de Eventos Desarrollo basado en Controles Despliegue y Manipulación de Datos Controles Data-Bound Administración de Configuraciones Distribución de Aplicaciones en los Computadores Clientes Manejo de Recursos

7 “Hola Mundo!!!”

8 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

9 Windows Forms como Cliente Inteligente

10 Clientes Inteligentes Atributos de los clientes inteligentes
Web Services & Soporte Offline/Online Dispositivos Adaptables Instalación Manual Grandes Tamaños Versionamiento Dependientes de conectividad Mala Experiencia del Usuario Desarrollo Complejo Pequeños Tamaños Experiencia del usuario Productividad en el desarrollo Facil Manejo del cambio Responsivos Fácil Instalación

11 Clientes Inteligentes Atributos de los clientes inteligentes
Servicios de web y soporte conectado/desconectado Adaptabilidad a dispositivos Experiencia de usuario rica Desarrolladores productivos Buena respuesta Gran alcance Administración de cambios fácil Facilidad de instalación

12 Clientes Inteligentes Atributos de los clientes inteligentes
Servicios de web y soporte conectado/desconectado Adaptabilidad a dispositivos Experiencia de usuario rica Desarrolladores productivos Buena respuesta Gran alcance Administración de cambios fácil Facilidad de instalación Los clientes inteligentes son aplicaciones de cliente fáciles de instalar y administrar que proveen una experiencia interactiva y adaptiva aprovechando los recursos locales y conectándose a fuentes de datos distribuidas

13 ¿Por qué es Windows Forms un cliente inteligente?
Servicios de web y soporte conectado/desconectado Adaptabilidad a dispositivos Experiencia de usuario rica Desarrolladores productivos Buena respuesta Gran alcance Administración de cambios fácil Facilidad de instalación

14 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Experiencia de usuario rica Productividad del desarrollador Administración de cambios fácil Buena respuesta Servicios de web y soporte conectado/desconectado

15 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Metáfora de cliente Windows familiar Variedad de controles de IU Capacidad de tinta y habla Experiencia de usuario rica Productividad del desarrollador Administración de cambios fácil Buena respuesta Servicios de web y soporte conectado/desconectado

16 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Metáfora de cliente Windows familiar Variedad de controles de IU Capacidad de tinta y habla Experiencia de usuario rica Parte del .Net Framework Múltiples componentes de cajón Localización/globalización fácil Soporte para diseñador visual extensible Look&Feel de Office fácil de lograr Productividad del desarrollador Administración de cambios fácil Buena respuesta Servicios de web y soporte conectado/desconectado

17 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Metáfora de cliente Windows familiar Variedad de controles de IU Capacidad de tinta y habla Experiencia de usuario rica Parte del .Net Framework Múltiples componentes de cajón Localización/globalización fácil Soporte para diseñador visual extensible Look&Feel de Office fácil de lograr Productividad del desarrollador Administración de cambios fácil Buena respuesta Usa la capacidad de procesamiento local para operaciones comunes Asociación con datos potente Soporte asincrónico incorporado Servicios de web y soporte conectado/desconectado

18 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Metáfora de cliente Windows familiar Variedad de controles de IU Capacidad de tinta y habla Experiencia de usuario rica Instalación en el cliente con ClickOnce Soporte de publicación en las herramientas Dependencias instaladas automáticamente Varias opciones de instalación Parte del .Net Framework Múltiples componentes de cajón Localización/globalización fácil Soporte para diseñador visual extensible Look&Feel de Office fácil de lograr Productividad del desarrollador Administración de cambios fácil Buena respuesta Usa la capacidad de procesamiento local para operaciones comunes Asociación con datos potente Soporte asincrónico incorporado Servicios de web y soporte conectado/desconectado

19 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Metáfora de cliente Windows familiar Variedad de controles de IU Capacidad de tinta y habla Experiencia de usuario rica Instalación en el cliente con ClickOnce Soporte de publicación en las herramientas Dependencias instaladas automáticamente Varias opciones de instalación Parte del .Net Framework Múltiples componentes de cajón Localización/globalización fácil Soporte para diseñador visual extensible Look&Feel de Office fácil de lograr Productividad del desarrollador Versionamiento en el cliente con ClickOnce Actualizaciones y retrocesos flexibles API rica para controlar la administración del cambio Administración de cambios fácil Buena respuesta Usa la capacidad de procesamiento local para operaciones comunes Asociación con datos potente Soporte asincrónico incorporado Servicios de web y soporte conectado/desconectado

20 ¿Por qué es Windows Forms un cliente inteligente?
Facilidad de instalación Metáfora de cliente Windows familiar Variedad de controles de IU Capacidad de tinta y habla Experiencia de usuario rica Instalación en el cliente con ClickOnce Soporte de publicación en las herramientas Dependencias instaladas automáticamente Varias opciones de instalación Parte del .Net Framework Múltiples componentes de cajón Localización/globalización fácil Soporte para diseñador visual extensible Look&Feel de Office fácil de lograr Productividad del desarrollador Versionamiento en el cliente con ClickOnce Actualizaciones y retrocesos flexibles API rica para controlar la administración del cambio Administración de cambios fácil Buena respuesta Usa la capacidad de procesamiento local para operaciones comunes Asociación con datos potente Soporte asincrónico incorporado Servicios de web y soporte conectado/desconectado Consume servicios de Web Data Binding fácil Procesamiento de XML fácil Consciente de conectividad

21 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

22 Windows Forms 2.0 Brinda la facilidad y la confiabilidad del uso de aplicaciones Web a las aplicaciones de cliente Look & Feel profesional Mejoras y Lo Nuevo... Simplifica el desarrollo de las aplicaciones cliente Simplifica el trabajo con datos Menos líneas de códigos Menos clicks

23 Windows Forms 2.0 Windows Forms
Un conjunto completo de controles y componentes reusables y extensibles Un diseñador WYSIWYG extensible Windows Forms Un marco para publicar, instalar y versionar aplicaciones fácilmente Soporte para gráficos sofisticados, accesibilidad, localización e impresión

24 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

25 Ayuda Diseño Windows Forms Visual Studio
Smart tags Facilita las tareas comunes con los controles Trabajo con formularios complejos Document outline Edición rápida de propiedades Alineamiento de controles automático Nuevas fuentes de datos XML, objeto, servicio, base de datos

26 SnapLines

27 Document Outline

28 Ayudas al Diseño de Windows Forms…

29 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

30 Lo nuevo…

31 Nuevos controles… Menu y Barra de Herramientas (ToolStrip)
Data Controls DataGridView (nuevo Grid Control) DataContainer (ahora DataConnector) Divisor de Contenedores (“Splitter Container”) Web Browser MaskedEdit Grid and Flow layout

32 Funcionalidades de Runtime
Configuraciones del Cliente Configuraciones de Usuario de lectura / escritura Configuraciones de aplicaciones de solo lectura Componentes asincrónicos API de sonido API de impresión mejorada Control y funcionalidades del sistema operativo XP Mejora de Controles Existentes

33 Configuraciones de Aplicaciones
Qué son las Configuraciones de Aplicaciones? Las configuraciones son almacenadas como fragmentos XML en archivos de configuracion Empezando con Configuraciones de Aplicaciones The Application Settings feature of Windows Forms makes it easy to create, store, and maintain custom application and user preferences on the client computer. With Windows Forms application settings, you can store not only application data such as database connection strings, but also user-specific data, such as user application preferences. Using Visual Studio or custom managed code, you can create new settings, read them from and write them to disk, bind them to properties on your forms, and validate settings data prior to loading and saving. Application settings enables developers to save state in their application using very little custom code, and is a replacement for dynamic properties in previous versions of the .NET Framework. Application settings contains many improvements over dynamic properties, which are read-only, late-bound, and require more custom programming. The dynamic property classes have been retained in Microsoft .NET Framework version 2.0, but they are just shell classes that thinly wrap the application settings classes. What Are Application Settings? Your Windows Forms applications will often require data that is critical to running the application, but which you do not want to include directly in the application's code. If your application uses a Web Service or a database server, you may want to store this information in a separate file, so that you can change it in the future without re-compiling. Similarly, your applications may require storing data that is specific to the current user. Most applications, for example, have user preferences that customize the application's appearance and behavior. Application settings addresses both needs by providing an easy way to store both application-scoped and user-scoped settings on the client computer. Using Visual Studio or a code editor, you define a setting for a given property by specifying its name, data type, and scope (application or user). You can even place related settings into named groups for easier use and readability. Once defined, these settings are persisted and read back into memory automatically at run time. A pluggable architecture enables the persistence mechanism to be changed, but by default, the local file system is used. Application settings works by persisting data as XML to different configuration (.config) files, corresponding to whether the setting is application-scoped or user-scoped. In most cases, the application-scoped settings are read-only; because they are program information, you will typically not need to overwrite them. By contrast, user-scoped settings can be read and written safely at run time, even if your application runs under partial trust. Settings are stored as XML fragments in configuration files. Application-scoped settings are represented by the <application.Settings> element, and generally are placed in app.exe.config, where app is the name of your main executable file. User-scoped settings are represented by the <userSettings> element and are placed in user.config, where user is the user name of the person currently running the application. You must deploy the app.exe.config file with your application; the settings architecture will create the user.config files on demand the first time the application saves settings for that user. You can also define a <userSettings> block within app.exe.config to provide default values for user-scoped settings. Getting Started with Application Settings If you use Visual Studio, you can define settings within the Windows Forms Designer using the (ApplicationSettings) property in the Properties window. When you define settings this way, Visual Studio automatically creates a custom managed wrapper class which associates each setting with a class property. Visual Studio also takes care of binding the setting to a property on a form or control so that the control's settings are restored automatically when its form is displayed, and saved automatically when the form is closed. If you want more detailed control over your settings, you can define your own custom applications settings wrapper class. This is accomplished by deriving a class from System.Configuration.ApplicationSettingsBase, adding a property that corresponds to each setting, and applying special attributes to these properties.

34 Crear Configuraciones de Aplicaciones
Modifique las configuraciones de aplicaciones y vinculaciones (“bindings”) utilizando Windows Forms Property Editor. Cree las configuraciones de App utilizando el Designer o por medio de código Using Visual Studio, you can create new application settings and bind them to properties on your form or your form's controls, so that these settings are loaded and saved automatically at run time. In the following procedure, you configure your application settings and bindings using the Windows Forms Property Editor. When you use this editor, Visual Studio generates a wrapper class for you that derives from System.Configuration.ApplicationSettingsBase and exposes all of your settings as properties defined in that wrapper class. In the second procedure, you define this wrapper class manually. Note Visual Studio 2005 users can add settings to their application using the Project Designer by adding a .settings file to their applications. In Visual Basic, this will expose all settings in the My.Settings object; other languages will generate a Settings class which exposes these settings. You can create a .settings file in Visual Studio by using the Settings tab on the Project Designer to create project settings. To create new Application Settings using Visual Studio Select the form or control whose properties you want to bind to the new application setting. In the Property Editor, expand the (Application Settings) item, and then click the ellipsis next to the (PropertyBindings) item underneath it. In the Application Settings dialog box, click the drop-down menu for the property you want to bind and select the New command. Important The Designer will not display properties whose type is defined within the current assembly. This is a known limitation. To bind to such a property, use perform one of the following steps: Move the definition of the property type to another project, build the project, and then add a reference to that new assembly to the current project. The property should then be listed in the Application Settings dialog box. -or- Instead of using the Designer, create the application setting programmatically. In the New Application Setting dialog box, configure the setting by giving it a name and a default value (if applicable) and setting its scope. If you set the scope as Application, the property will be global to all users of the application, but will likely not be alterable at run time. If you set the scope to User, the property will be read/write and its value may differ from user to user. If your setting will contain a connection string, select the Connection String check box on the dialog box. Click OK on both the New Application Setting dialog box and the Application Settings dialog box. You have now successfully created a new application setting and bound it to the specified property. To manipulate individual application settings, access the properties of the My.Settings object in Visual Basic, or the Settings object in other languages. For example, in languages other than Visual Basic, you must explicitly call the System.Configuration.ApplicationSettingsBase.Save method of this wrapper class in order to persist the user settings. This is usually done in the System.Windows.Forms.Form.Closing event handler of the main form. In Visual Basic, the designer will automatically generate code to save the current values of all the user settings during application shutdown. using System.Windows.Forms; using System.Configuration; public class MyUserSettings : ApplicationSettingsBase { ... }

35 El nuevo modelo de Data-Binding
System.Windows.Forms.BindingSource tiene dos propósitos: Simplifica la vinculación (“binding”) de los controles de los formularios a un orígen de datos. Actúa como un orígen de datos “strong typed” The System.Windows.Forms.BindingSource component serves two purposes. First, it simplifies binding controls on a form to data by providing a layer of indirection, providing currency management, change notification and other services This is accomplished by attaching the System.Windows.Forms.BindingSource component to your data source, and then binding the controls on your form to the System.Windows.Forms.BindingSource component. All further interaction with the data, including navigating, sorting, filtering, and updating, is accomplished with calls to the System.Windows.Forms.BindingSource component. Second, the System.Windows.Forms.BindingSource component can act as a strongly typed data source. Typically the type of the underlying data source is fixed through one of the following mechanisms: Use the System.Windows.Forms.BindingSource.Add method to add an item to the System.Windows.Forms.BindingSource component. Set the System.Windows.Forms.BindingSource.DataSource property to a list, single object, or type. Both of these mechanisms create a strongly-typed list. System.Windows.Forms.BindingSource supports both simple and complex data binding as indicated by its System.Windows.Forms.BindingSource.DataSource and System.Windows.Forms.BindingSource.DataMember properties. Note Because a System.Windows.Forms.BindingSource handles both simple and complex data sources, terminology is problematic. Within this class documentation, the term list refers to a data collection within the hosted data source, and item denotes a single element. When discussing functionality associated with complex data sources, the equivalent terms table and row are used. System.Windows.Forms.BindingSource provides members for accessing the underlying data. The current item can be retrieved through the System.Windows.Forms.BindingSource.Current property, and the entire list can be retrieved through the System.Windows.Forms.BindingSource.List property. Editing operations are supported on the current item through System.Windows.Forms.BindingSource.Current and the System.Windows.Forms.BindingSource.RemoveCurrent, System.Windows.Forms.BindingSource.EndEdit, System.Windows.Forms.BindingSource.CancelEdit and System.Windows.Forms.BindingSource.Add and System.Windows.Forms.BindingSource.AddNew methods. Although currency management is handled automatically for all underlying data source types, this class exposes a number of events, such as System.Windows.Forms.BindingSource.CurrentItemChanged and System.Windows.Forms.BindingSource.DataSourceChanged, that allow for customization. Data sources that are bound to a System.Windows.Forms.BindingSource component can also be navigated and managed with the System.Windows.Forms.BindingNavigator class, which provides a VCR-like user interface (UI) for navigating items within a list. Although System.Windows.Forms.BindingNavigator can be bound to any data source, it was designed to integrate with a System.Windows.Forms.BindingSource component through its System.Windows.Forms.BindingNavigator.BindingSource property.

36 Control DataGridView Evolución del control System.Windows.Forms.DataGrid. La vinculación (“binding”) de datos es simple e intuitiva Soporta el modelo estandar WinForm de vinculación (“binding”) de datos. Puede ser utilizado en modo estático desconectado (“unbound”) sin dependencia del origen de datos The System.Windows.Forms.DataGridView control lets you display and edit tabular data from many different kinds of data sources. It is an evolution of the System.Windows.Forms.DataGrid control and it is the preferred Windows Forms control for interacting with tables of data. Binding data to the System.Windows.Forms.DataGridView control is straightforward and intuitive, and in many cases it is as simple as setting the System.Windows.Forms.DataGridView.DataSource property. The System.Windows.Forms.DataGridView control supports the standard Windows Forms data binding model, so it will bind to instances of classes described in the following list: Any class that implements the System.Collections.IList , including one-dimensional arrays. Any class that implements the System.ComponentModel.IListSource interface, such as the System.Data.DataTable and System.Data.DataSet classes. Any class that implements the System.ComponentModel.IBindingList interface, such as the System.ComponentModel.Collections.BindingList<> class. Any class that implements the System.ComponentModel.IBindingListView interface, such as the System.Windows.Forms.BindingSource class. The System.Windows.Forms.DataGridView control supports data binding to the public properties of the objects returned by these interfaces or to the properties collection returned by an System.ComponentModel.ICustomTypeDescriptor interface, if implemented on the returned objects. Typically, you will bind to a System.Windows.Forms.BindingSource component and bind the System.Windows.Forms.BindingSource component to another data source or populate it with business objects. The System.Windows.Forms.BindingSource component is the preferred data source because it can bind to a wide variety of data sources and can resolve many data binding issues automatically. The System.Windows.Forms.DataGridView control can also be used in "unbound" mode, with no underlying data store. The System.Windows.Forms.DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. Any time you need your Windows Forms application to display tabular data, you should consider using the DataGridView control before others (for example, DataGrid). If you are displaying a small grid of read-only values, or if you are allowing a user to edit a table with millions of records, the DataGridView control will provide you with a readily programmable, memory-efficient solution.

37 Control DataGridView The System.Windows.Forms.DataGridView control lets you display and edit tabular data from many different kinds of data sources. It is an evolution of the System.Windows.Forms.DataGrid control and it is the preferred Windows Forms control for interacting with tables of data. Binding data to the System.Windows.Forms.DataGridView control is straightforward and intuitive, and in many cases it is as simple as setting the System.Windows.Forms.DataGridView.DataSource property. The System.Windows.Forms.DataGridView control supports the standard Windows Forms data binding model, so it will bind to instances of classes described in the following list: Any class that implements the System.Collections.IList , including one-dimensional arrays. Any class that implements the System.ComponentModel.IListSource interface, such as the System.Data.DataTable and System.Data.DataSet classes. Any class that implements the System.ComponentModel.IBindingList interface, such as the System.ComponentModel.Collections.BindingList<> class. Any class that implements the System.ComponentModel.IBindingListView interface, such as the System.Windows.Forms.BindingSource class. The System.Windows.Forms.DataGridView control supports data binding to the public properties of the objects returned by these interfaces or to the properties collection returned by an System.ComponentModel.ICustomTypeDescriptor interface, if implemented on the returned objects. Typically, you will bind to a System.Windows.Forms.BindingSource component and bind the System.Windows.Forms.BindingSource component to another data source or populate it with business objects. The System.Windows.Forms.BindingSource component is the preferred data source because it can bind to a wide variety of data sources and can resolve many data binding issues automatically. The System.Windows.Forms.DataGridView control can also be used in "unbound" mode, with no underlying data store. The System.Windows.Forms.DataGridView control is highly configurable and extensible, and it provides many properties, methods, and events to customize its appearance and behavior. Any time you need your Windows Forms application to display tabular data, you should consider using the DataGridView control before others (for example, DataGrid). If you are displaying a small grid of read-only values, or if you are allowing a user to edit a table with millions of records, the DataGridView control will provide you with a readily programmable, memory-efficient solution.

38 Controles Windows DataSet DataGridView BindingSource BindingNavigator
ReportViewer

39 Controles Windows BindingNavigator DataGridView

40 Controles para manejo de Datos…

41 Control MaskedTextBox
Mejora sobre el control TextBoxControl Soporta sintaxis declarada para aceptar o rechazar un ingreso de datos. Se puede especificar sin escribir código: Número de caracteres en un string Caracteres opcionales Caracter espeardo en una máscara Muestra el formato del texto en tiempo de ejecución The MaskedTextBox class is an enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input. Using the System.Windows.Forms.MaskedTextBox.Mask property, you can specify the following input without writing any custom validation logic in your application: The number of required inputs in a string Optional input characters The type of input expected at a given position in the mask; for example, a digit, alphabetic, or alphanumeric character Mask literals, or characters that should appear directly in the System.Windows.Forms.MaskedTextBox;for example, the hyphens (-) in a phone number, or the currency symbol in a price When the MaskedTextBox is displayed at run time, it displays the mask as a series of prompt characters representing user input. You can use the System.Windows.Forms.MaskedTextBox.PromptChar property to specify a custom prompt character. Besides System.Windows.Forms.MaskedTextBox.Mask, System.Windows.Forms.MaskedTextBox exposes a number of properties that you can use to control user input. To prevent prompt characters from being used as input, use the System.Windows.Forms.MaskedTextBox.AllowPromptAsInput property. System.Windows.Forms.MaskedTextBox.HidePromptOnLeave determines if the user sees the prompt characters when the control loses input focus. System.Windows.Forms.MaskedTextBox.AsciiOnly prevents System.Windows.Forms.MaskedTextBox from accepting arbitrary Unicode characters, thereby restricting input to the characters a-z, A-Z, and 0-9. You will generally want to give your users some kind of notification when their input is rejected by the mask. The most basic notification is a system beep, which you can enable or disable using the System.Windows.Forms.MaskedTextBox.BeepOnError property. You can provide your own custom error logic by handing the System.Windows.Forms.MaskedTextBox.MaskInputRejected event. You can use the System.Windows.Forms.MaskedTextBox.MaskFull property to verify whether or not the user has entered all of the required input. Masks do not necessarily guarantee that a user's input will represent a valid value for a given type. You can verify that a user's input represents a valid value by assigning an instance of that value's type to the System.Windows.Forms.MaskedTextBox.ValidatingType property. You can detect whether the user removes focus from System.Windows.Forms.MaskedTextBox when it contains an invalid value by monitoring for the System.Windows.Forms.MaskedTextBox.TypeValidationCompleted event. If type validation succeeds, the object representing the value will be available through the System.Windows.Forms.TypeValidationEventArgs.ReturnValue property of the System.Windows.Forms.TypeValidationEventArgs parameter. System.Windows.Forms.MaskedTextBox exposes multiple properties that control how you retrieve the user's input. The System.Windows.Forms.MaskedTextBox.Text property will always retrieve the user's input formatted according to the value of two other properties: System.Windows.Forms.MaskedTextBox.IncludeLiterals, which specifies whether to include literal characters, such as the "/" in a date mask; and System.Windows.Forms.MaskedTextBox.IncludePrompt, which controls whether System.Windows.Forms.MaskedTextBox.PromptChar is used to represent unfilled positions in the mask. System.Windows.Forms.MaskedTextBox.InputText will always return only those characters input by the user. Users can also copy the control's current value onto the system Clipboard.

42 Control MaskedTextBox
The MaskedTextBox class is an enhanced TextBox control that supports a declarative syntax for accepting or rejecting user input. Using the System.Windows.Forms.MaskedTextBox.Mask property, you can specify the following input without writing any custom validation logic in your application: The number of required inputs in a string Optional input characters The type of input expected at a given position in the mask; for example, a digit, alphabetic, or alphanumeric character Mask literals, or characters that should appear directly in the System.Windows.Forms.MaskedTextBox;for example, the hyphens (-) in a phone number, or the currency symbol in a price When the MaskedTextBox is displayed at run time, it displays the mask as a series of prompt characters representing user input. You can use the System.Windows.Forms.MaskedTextBox.PromptChar property to specify a custom prompt character. Besides System.Windows.Forms.MaskedTextBox.Mask, System.Windows.Forms.MaskedTextBox exposes a number of properties that you can use to control user input. To prevent prompt characters from being used as input, use the System.Windows.Forms.MaskedTextBox.AllowPromptAsInput property. System.Windows.Forms.MaskedTextBox.HidePromptOnLeave determines if the user sees the prompt characters when the control loses input focus. System.Windows.Forms.MaskedTextBox.AsciiOnly prevents System.Windows.Forms.MaskedTextBox from accepting arbitrary Unicode characters, thereby restricting input to the characters a-z, A-Z, and 0-9. You will generally want to give your users some kind of notification when their input is rejected by the mask. The most basic notification is a system beep, which you can enable or disable using the System.Windows.Forms.MaskedTextBox.BeepOnError property. You can provide your own custom error logic by handing the System.Windows.Forms.MaskedTextBox.MaskInputRejected event. You can use the System.Windows.Forms.MaskedTextBox.MaskFull property to verify whether or not the user has entered all of the required input. Masks do not necessarily guarantee that a user's input will represent a valid value for a given type. You can verify that a user's input represents a valid value by assigning an instance of that value's type to the System.Windows.Forms.MaskedTextBox.ValidatingType property. You can detect whether the user removes focus from System.Windows.Forms.MaskedTextBox when it contains an invalid value by monitoring for the System.Windows.Forms.MaskedTextBox.TypeValidationCompleted event. If type validation succeeds, the object representing the value will be available through the System.Windows.Forms.TypeValidationEventArgs.ReturnValue property of the System.Windows.Forms.TypeValidationEventArgs parameter. System.Windows.Forms.MaskedTextBox exposes multiple properties that control how you retrieve the user's input. The System.Windows.Forms.MaskedTextBox.Text property will always retrieve the user's input formatted according to the value of two other properties: System.Windows.Forms.MaskedTextBox.IncludeLiterals, which specifies whether to include literal characters, such as the "/" in a date mask; and System.Windows.Forms.MaskedTextBox.IncludePrompt, which controls whether System.Windows.Forms.MaskedTextBox.PromptChar is used to represent unfilled positions in the mask. System.Windows.Forms.MaskedTextBox.InputText will always return only those characters input by the user. Users can also copy the control's current value onto the system Clipboard.

43 Control MaskedTextBox…

44 Control WebBrowser Proporciona un “wrapper” administrado para el control ActiveX del WebBrowser. Reproduce la navegación de Internet Explorer. Es un visor de documentos HTML. This control provides a managed wrapper for the WebBrowser ActiveX control . The control to duplicates Internet Explorer Web browsing functionality in your application or you can disable default Internet Explorer functionality and use the control as a simple HTML document viewer. Lets you host Web pages in your Windows Forms applications. You can use the WebBrowser control to provide integrated HTML-based Help or Internet Web browsing capabilities in your application. Additionally, you can use the WebBrowser control to convert existing Web applications into client applications that seamlessly integrate DHTML code with the user interface capabilities of Windows Forms.

45 Control WebBrowser This control provides a managed wrapper for the WebBrowser ActiveX control . The control to duplicates Internet Explorer Web browsing functionality in your application or you can disable default Internet Explorer functionality and use the control as a simple HTML document viewer. Lets you host Web pages in your Windows Forms applications. You can use the WebBrowser control to provide integrated HTML-based Help or Internet Web browsing capabilities in your application. Additionally, you can use the WebBrowser control to convert existing Web applications into client applications that seamlessly integrate DHTML code with the user interface capabilities of Windows Forms.

46 Control WebBrowser…

47 Otros Controles Control ListView
El control soporta tres funcionalidades: La funcionalidad “tile view” La funcionalidad “grouping” La funcionalidad “insertion” Componente SoundPlayer Permite incluir de manera fácil sonidos en las aplicaciones. Control SplitContainer Divide un Winform o un área en dos paneles separados. The ListView Control The ListView Control supports three features provided by Windows XP and Windows Server 2003 family: The tile view display items as tiles that balance graphical and textual information. Each tile contains a large icon and several lines of subitems text that normally appear in the columns of the details view. The grouping feature lets you visually group items into related categories. The insertion mark feature lets you provide drag-and-drop item repositioning with visual feedback to indicate drop locations. The SoundPlayer Component The Windows Forms System.Windows.Forms.SoundPlayer component enables you to easily include sounds in your applications. The System.Windows.Forms.SoundPlayer component can play sound files in the .wav format, either from a resource or from UNC or HTTP locations. Additionally, the Sound component enables you to load or play sounds asynchronously. SplitContainer Control The Windows Forms System.Windows.Forms.SplitContainer control can be thought of as a composite; it is two panels separated by a movable bar. When the mouse pointer is over the bar, the cursor changes to show that the bar is movable. Use it to create complex, resizable user interfaces that are most effective for displaying and browsing information. For more information see SplitContainer Control.

48 SplitContainer SmartTags permite al desarrollador acceso a las propiedades más comunes del control simplemente al pasar por arriba del mismo o al seleccionarlo. Por ejemplo en el DataGridView control se puede utilizar SmartTags para modificar las columnas. Document Outline es una vista que permite ver los controles que tiene un container y como se agrupan. SnapLines es una nueva forma de posicionar controles en un container. Mediante líneas guía fácilmente se pueden posicionar los controles manteniendo distancias relativas entre controles hermanos y el contenedor. Todos los controles poseen una propiedad margin que es la distancia entre el control y otro control o el contenedor. Los contenedores poseen una propiedad llamada paddin que permite establecer la distancia de margen entre el contenedor y los controles que posee. Improved Data Support Drag and Drop Data Binding: Es posible utilizar los nuevos wizards para realizar el data binding de un Form ya sea a una base relacional, web services o componentes de negocio. Luego de generado el data source es facil configurar el binding de los controles del form. Soporte para Web Services y objetos de negocio: En tiempo de diseño es posible configurar el data binding utilizando uno de estos dos mecanismos. Mayor flexibilidad en el data binding: es posible definir que los controles devuelvan los valores al backend, en distintos momentos, por ejemplo: al validarse, o al cambiar una propiedad. Además es más flexible formatear valores, por ejemplo el DBNull. Layout FlowLayoutPanel TableLayoutPanel Propiedad AutoSize: los controles se ajustan según su contenido. Ejemplo: un botón o una label Propiedad AutoRelocate: permite reagrupar automáticamente controles que por haber aumentado su tamaño se solapan. SplitContainer reemplazo del Splitter. Este control fue desarrollado para ser mas intuitivo tanto en tiempo de diseño como en ejecución. Consta de dos paneles y el splitter propiamente dicho. Posee las mismas prestaciones que el splitter y tiene eventos tales como SplitterMoving y SplitterMoved

49 SplitContainer…

50 Otros Controles Layout Panels
Permite disponer los contenidos en dirección horizontal o vertical, o en una grilla. Componentes de operaciones en segundo plano Realiza operaciones en segundo plano Programación asincrónica de componentes The FlowLayoutPanel control arranges its contents in a horizontal or vertical flow direction. The TableLayoutPanel control arranges its contents in a grid. Because the layout is performed both at design time and run time, it can change dynamically as the application environment changes. The BackgroundWorker component enables you to perform operations in the background that can take a long time to execute, such as image downloads and database transactions Asynchronous Programming for Components The Asynchronous Pattern for Components is an event-driven model that makes available the advantages of multithreaded applications while hiding many of the complex issues inherent in multithreaded design.

51 Layout Panel

52 Layout Panel…

53 Control ToolStrip Genera barras de herramientas y otros elementos de interfaz de usuario. Los ToolsStrip reemplazan y agregan funcionalidad a los controles de versiones anteriores. Soporta la apariencia y el comportamiento del sistema operativo. Crea controles drop-down y editores de tipos con interfaces de usuario avanzadas. The ToolsStrip and its associated classes enable you to create toolbars and other user interface elements that can have a Microsoft® Windows® XP, Microsoft Office, Microsoft Internet Explorer, or custom appearance and behavior. These elements support overflow and run-time item reordering. ToolsStrip controls offer a rich design-time experience that includes in-place activation and editing, custom layout, and rafting, which is the ability of toolbars to share horizontal or vertical space. Although ToolsStrip replaces and adds functionality to the control in previous versions, ToolBar is retained for both backward compatibility and future use if desired. What You Can Do with the ToolStrip ControlUse the ToolsStrip control to: Create easily customized, commonly employed toolbars that support advanced user interface and layout features, such as docking, rafting, buttons with text and images, drop-down buttons and controls, overflow buttons, and run-time reordering of ToolsStrip items. Support the typical appearance and behavior of the operating system. Handle events consistently for all containers and contained items, in the same way you handle events for other controls. Drag items from one ToolsStrip to another or within a ToolsStrip. Create drop-down controls and user interface type editors with advanced layouts in a System.Windows.Forms.ToolStripDropDown. Use the System.Windows.Forms.ToolStripControlHost class to use other controls on a System.Windows.Forms.ToolStrip and gain System.Windows.Forms.ToolStrip functionality for them. You can extend the functionality and modify the appearance and behavior by using the System.Windows.Forms.ToolStripRenderer, System.Windows.Forms.ToolStripProfessionalRenderer, and System.Windows.Forms.ToolStripManager along with the System.Windows.Forms.ToolStripRenderMode and System.Windows.Forms.ToolStripManagerRenderMode enumerations.

54 Ventajas sobre lo antiguo…
Overflow support Custom layout support Support controls right in menus and toolbars Consistent object model Simpler to mix/match items

55 ToolStripDropDownButton
Terminología MenuStrip ToolStripMenuItem ToolStripDropDownButton ToolStripComboBox ToolStripButton ToolStripDropDown ToolStrip

56 ToolStripSplitButton
Terminología… ToolStripSplitButton ToolStripDropDown ToolStripComboBox ToolStripSeparator ToolStripLabel OverflowButton

57 ToolStripStatusLabel
Terminología… ToolStrip StatusStrip ToolStripStatusLabel ToolStripPanel

58 ToolStripControlHost ToolStripDropDownItem
Modelo Objeto - Ítems ToolStripItem ToolStripControlHost ToolStripDropDownItem ToolStripLabel ToolStripSeparator ToolStripButton ToolStripComboBox ToolStripTextBox ToolStripProgressBar ToolStripDropDownButton ToolStripMenuItem ToolStripSplitButton public class WinBarItem : Component WinBarItem implements text, image, simple layout, painting logic

59 Modelo Objeto - ToolStrip
StatusStrip MenuStrip ContextMenuStrip public class WinBarItem : Component WinBarItem implements text, image, simple layout, painting logic

60 Tipos de Ítems ToolStrip Item UI Elements Has Children? Button
Text and Image, Toggle (sticky) mode No Label Static Text and Image Separator Line DropDown Button Text, Image and Arrow (optional) Yes SplitButton Half Button, Half DropDownButton MenuItem Text, Image, Shortcut, Check, Arrow

61 Containers ToolStrip Similar to ToolBar Supports Overflow MenuStrip
Similar to MainMenu Derives from ToolStrip, but correct defaults / look for menu. Default height, no overflow, flat look ContextMenuStrip Similar to ContextMenu Derives from ToolStripDropDown Familiar menu layout: Check, Image, Text, Shortcut, Flyout StatusStrip Similar to StatusBar Panel, label, progress bar

62 Características de ToolStrip
Construidos con soporte tipo Professional (Office 2003 L&F) System w/o visual styles System XP w/ visual styles Uso de Modelos Docked Hosted in a ToolStripPanel for drag to dock support Fixed position like a control Personalización User AllowItemReorder ToolStripManager.SaveSettings()

63 Layouts Four Layouts StackWithOverflow Default Layout for ToolStrip
Head/Tail Alignment Natural ordering Automatic Overflow Flow Layout Default Layout for Overflow Menu Layout Default Layout for ContextMenuStrip Flow Based Check, Image, Text, Shortcut, Flyout Arrow Table Layout Default Layout for StatusStrip

64 Extensibilidad Colores Profesionales
Provee todos, parte o las extensiones existentes de las tablas de colores ToolStripRenderers Control casi total de la representación Pintado, destacado, presionado Métodos de Rendering que son accesibles ToolStripControlHost Host arbitrary user control ToolStripItem Derivation Deriva deToolStripItem o decendientes Start 45 minutes in DEMO – Custom Renderer

65 Design Time Diseño de Menú basado en
WYSIWYG, mejora la experiencia en cada lugar (What You See Is What You Get) Overflow access Default layouts only Limited hosted controls support DEMO – new Design Time

66 ToolStrip…

67 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

68 Distribución de software “ClickOnce”
Permite actualizaciones automáticas de aplicaciones Windows que pueden ser instaladas con mínima interacción del usuario. Supera tres obstáculos inherentes a la distribución de software: Dificultades en las actualizaciones de las aplicaciones. Impacto en el equipo del usuario. Permisos ClickOnce is a deployment technology that enables self-updating Windows applications that can be installed and run with minimal user interaction. ClickOnce deployment overcomes three major issues inherent in deployment: Difficulties in updating applications - with Windows Installer deployment, any time an application is updated, the user must reinstall the entire application; with ClickOnce deployment, updates can be provided automatically, and only those portions of the application that have changed will be reinstalled. Impact to the user's computer - with Windows Installer deployment, applications often rely on share components with the potential for versioning conflicts; with ClickOnce deployment, each application is self-contained and cannot interfere with other applications. Security permissions - Windows Installer deployment requires administrative permissions; ClickOnce deployment allows non-administrative users to install and grant only those permissions necessary for the application. In the past, these issues sometimes drove the decision to create Web applications rather than Windows applications, sacrificing the rich user interface and responsiveness of Windows Forms for ease of installation. With applications deployed by means of ClickOnce, you can have the best of both worlds.

69 Qué es una aplicación “ClickOnce”?
Cualquier aplicación Windows Form o en modo consola que es publicada a través de la tecnología “ClickOnce” Puede ser publicada en tres modos diferentes: Como una página web Desde la red Desde la media (CD-ROM) Las aplicaciones “ClickOnce” pueden verificar la existencia de nuevas versiones y reemplazar automáticamente los componentes actualizados. Simply stated, a ClickOnce application is any Windows Forms or console application that is published using ClickOnce technologies. A ClickOnce application can be published in three different ways: from a Web page, from a network file share, or from media such as a CD-ROM. A ClickOnce application can be installed on an end user's computer and run locally even when the computer is offline, or it can be run in an online-only mode without permanently installing anything on the end user's computer. ClickOnce applications can be self-updating; they can check for newer versions as they become available and automatically replace any updated files. The developer can specify the update behavior; a network administrator can also control update strategies, for example, marking an update as mandatory. Updates can also be rolled back to a previous version by the end user or by an administrator. ClickOnce applications are inherently isolated; installing or running a ClickOnce application cannot break existing applications. ClickOnce applications are completely self-contained; each ClickOnce application is installed to and run from a secure per-user, per-application cache. By default, ClickOnce applications run in the Internet or Intranet security zones; if necessary, the application can request elevated security permissions

70 ClickOnce Una tecnología para instalar y versionar aplicaciones con el poder del cliente y la simplicidad de la Web Web Click Once Cliente MSI Alcance Instalación “No Touch” Bajo impacto en el sistema Instalar / Correr por usuario Rico / Interactivo Acceso desconectado Integrado con Windows Shell Componentes por máquina Instalación sin restricciones This table summarizes the attributes of the various deployment options you have available. What should stand out immediately is the fact that ClickOnce bridges the gap between Web-based deployment and MSI installations. Also, with respect to installing shared components, as you'll see later in this presentation, you can also incorporate MSI packages into your ClickOnce deployments. This effectively gives you the ability to enjoy the benefits of an MSI installation using ClickOnce.

71 Instalación Web con ClickOnce
Servidor web

72 Instalación de una aplicación ClickOnce…

73 Agenda Introducción Windows Forms como Cliente Inteligente
Ayuda Diseño a Windows Forms Lo Nuevo... Distribución de software (deployment) “ClickOnce” Windows Presentation Fundation – “Avalon”

74 WinFX Desarrollo usando nuevas tecnologías y avances en hardware
Mejor productividad para desarrollo Mejor seguridad, deployment y administración Reuso de capacidades y conocimientos actuales Nuevo modelo de programación sobre Windows, WinFX™ Construído sobre .NET Framework

75 Subsistemas WinFx Windows Communication Foundation “Indigo”
Windows Workflow Foundation Windows Presentation Foundation “Avalon” Tres tecnologías claves para desarrollo de soluciones que vendrán como parte de Windows Vista Disponibles en Windows XP y Windows Server 2003 Disponibles hoy en CTP (Feb) para comenzar a probar

76 Windows Presentation Foundation “Avalon”

77 Windows Presentation Foundation
Unificación de modelos de UI: Formularios, Controles, Media, Documentos Motor Vectorial: Utilizando el poder de gráficos del PC Programación Declarativa: Diseñadores/Autores de UI trabajando con desarrolladores de aplicaiones Deployment Sencillo Despliegue y administración de las apliaciones de forma confiable y segura Context: These are the four goals of Avalon – next few slides drill down further on each of them. Building UI, graphics, documents and media into a single environment: providing a richer experience by unifying these together, allowing them to be integrated in a far deeper way than before, and reducing the number of APIs developers have to track by putting things into a single managed object-orientated interface. Rich graphics processors woefully underused by modern applications. 128MB memory, rich 3D capabilities. Avalon takes advantage of these capabilities using a DirectX-based model. Vector- rather than bitmap-based, supports high-dpi, double buffering. Declarative and procedural programming supported for designers and developers to do what they want to do. Need to make it as easy as “clicking on a link” to deploy an Avalon application: either via a browser or via a standalone app.

78 Windows Presentation Foundation “Avalon”
Estrategia Microsoft con Tecnología UX Una base común para UI, documentos, y medios sobre Windows Vista Windows Presentation Fundation consite en: Uso de un acelerdor del motor de hardware a través de Direct 3D v10 Porgramación basada en el Modelo .NET Framework XAML como lenguaje para describir el contenido y UI

79 Programación declarativa XAML EXtensible Application Markup Language
Markup para Windows Instrucciones simples y declarativas Código y Contenido estan separados Colaboración entre diseñadores y desarrolladores Herramientas para crear y consumir Context: Third Avalon pillar Avalon introduces a new role to the rich client software development team – that of graphical designer. Gone are the days of boring gray buttons and poorly designed applications: with the declarative programming model enabled by XAML, you can split off presentation and logic in the same way as with a web application. XAML is a markup language that is inherently toolable, allowing for designers and developers to use independent tools. From XAML (which stands for "Extensible Application Markup Language") provides an XML-based way to specify declaratively a hierarchy of objects with properties and logic. We're positioning XAML as a user interface design language, because it is ideal for generating the kind of code that traditionally resided in a hidden #region area and was hard to maintain by both developers and tools. If you've ever wanted to edit the auto-generated blocks of code created by Visual Studio but been dissuaded by the warning comments writ large, or you've gone ahead regardless and been burnt badly when your tools refused to load your changes, you'll appreciate XAML. XAML is not Avalon, and Avalon is not XAML. It so happens that they come out of the same team at Microsoft, but they are not intrinsically wedded together. I've been asked before "where can I go to get the XSD for XAML?" and hopefully it's now clear that this question doesn't make much more sense than asking for the C# schema. XAML gets compiled into an object definition. <Button Width="100"> OK <Button.Background> LightBlue </Button.Background> </Button> Button b1 = new Button(); b1.Content = "OK"; b1.Background = new SolidColorBrush(Colors.LightBlue); b1.Width = 100; Dim b1 As New Button b1.Content = "OK" b1.Background = New _ SolidColorBrush(Colors.LightBlue) b1.Width = 100

80 Riqueza vs. Complejidad – Tecnologías de Presentación Microsoft
ASP.NET “Atlas” Alcance Windows Presentation Foundation Riqueza Optimizada & Alcance ASP.NET 2.0 (HTML) Windows Forms 2.0 Productividad Desarrollo Win32 DHTML (AJAX) Direct 3D v10 Riqueza Direct 3D v9 Riqueza en UX Disponible: 1997 2005 2006

81 Windows Presentation Fundation…

82 Más Información MSDN Developer Centers
Visual Studio® Team System Developer Center Introduction to Windows Forms Development WinFX® Developer Center Windows Forms .NET

83 Programas MSDN Novedades MSDN: www.microsoft.com/spanish/msdn/chile
Desarrollador Cinco Estrellas WebCasts en nuestro idioma NET Protector:

84 Muchas gracias por tu asistencia
Tu potencial. Nuestra pasión. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS SUMMARY.


Descargar ppt "Conferencias Técnicas MSDN"

Presentaciones similares


Anuncios Google