Top Banner
Under the Hood on Under the Hood on Extending the My Extending the My Namespace Namespace Joe Binder Joe Binder TLN414 TLN414 Program Manager Program Manager Microsoft Corporation Microsoft Corporation
21

Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Dec 13, 2015

Download

Documents

Joanna Goodwin
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Under the Hood on Under the Hood on Extending the My Extending the My NamespaceNamespace

Joe BinderJoe BinderTLN414TLN414Program ManagerProgram ManagerMicrosoft CorporationMicrosoft Corporation

Page 2: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

AgendaAgenda

Design goalsDesign goals

My and the .NET FrameworkMy and the .NET Framework

Extensibility ModelExtensibility Model

Customizing My, Step-by-StepCustomizing My, Step-by-Step

Deploying My Extensions and Deploying My Extensions and CustomizationsCustomizations

QuestionsQuestions

Joseph Binder
Subject to revision
Page 3: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

The My Namespace VisionThe My Namespace Vision

… … To provide a highly To provide a highly approachable, unified runtime approachable, unified runtime environment for Visual Basic environment for Visual Basic developers. developers.

Page 4: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Design PillarsDesign PillarsTask-based APIsTask-based APIs

Default configurations for extensible Default configurations for extensible componentscomponents

Promote best-practice usage patternsPromote best-practice usage patterns

Use .NET Framework constructs Use .NET Framework constructs directlydirectly

Page 5: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Example Interaction ModelExample Interaction ModelMy.Application.LogMy.Application.Log

.NET Framework 2.0 contains powerful .NET Framework 2.0 contains powerful and extensible tracing architectureand extensible tracing architecture

Highly factored designHighly factored design

Enterprise scenarios require extension to Enterprise scenarios require extension to existing servicesexisting services

Configuration is hard!Configuration is hard!

My.Application.Log provides a simple My.Application.Log provides a simple entry point and default configurationentry point and default configuration

Page 6: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

My.Application.LogMy.Application.Log

Page 7: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Inside The My NamespaceInside The My NamespaceExtensibility PointsExtensibility Points

My

Application

Computer

User

Resources

Settings

WebServices

Forms

— Customize application model, events, …

— Add device support, hardware events, …

— Custom authorization and authentication

— Use external store (e.g., settings) for settings

Devices — Add new top-level properties

Joseph Binder
Page 8: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Inside The My NamespaceInside The My NamespaceArchitectural OverviewArchitectural Overview

WindowsApplication1WindowsApplication1Namespace MyNamespace My

ReadOnly Property Application As MyApplicationReadOnly Property Application As MyApplication

......

Class MyApplication Class MyApplication

Inherits ApplicationServices.ApplicationBaseInherits ApplicationServices.ApplicationBase

End ClassEnd Class

End NamespaceEnd Namespace

Microsoft.VisualBasic.dllMicrosoft.VisualBasic.dllNamespace ApplicationServicesNamespace ApplicationServices

Public Class ApplicationBasePublic Class ApplicationBase

ReadOnly Property Log As LogReadOnly Property Log As Log

… …

End ClassEnd Class

End NamespaceEnd Namespace

Page 9: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Extending My at the Root-Extending My at the Root-LevelLevel

Adding My.Devices to the HierarchyAdding My.Devices to the Hierarchy

Page 10: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Application ModelApplication ModelArchitectural OverviewArchitectural OverviewShared Sub Main(ByVal Args As String()) Shared Sub Main(ByVal Args As String())

My.Application.Run(Args) My.Application.Run(Args) End Sub End Sub

Namespace MyNamespace My Partial Friend Class MyApplicationPartial Friend Class MyApplication Inherits WindowsFormsApplicationBaseInherits WindowsFormsApplicationBase End ClassEnd ClassEnd NamespaceEnd Namespace

Namespace Namespace MMicrosoft.VisualBasic.ApplicationServicesicrosoft.VisualBasic.ApplicationServices Class Class WindowsFormsApplicationBaseWindowsFormsApplicationBase Inherits Inherits ConsoleConsoleApplicationBaseApplicationBase End ClassEnd ClassEnd NamespaceEnd Namespace

StartupStartup

NetStatusChangedNetStatusChanged

……

Page 11: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Extending the Application Extending the Application ModelModel

Page 12: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

My.Settings My.Settings Architectural OverviewArchitectural Overview

SettingsBaseSettingsBase

ApplicationSettingsBaseApplicationSettingsBase

My.SettingsMy.SettingsProperty FavoriteColor As ColorProperty FavoriteColor As ColorProperty LastLoggedIn As DateProperty LastLoggedIn As Date……

SettingsProviderSettingsProvider

LocalFileSettingsProviderLocalFileSettingsProvider<userSettings><userSettings> <WindowsApplication1.My.MySettings><WindowsApplication1.My.MySettings> <setting name="FavoriteColor"><setting name="FavoriteColor"> <value>0, 192, 0</value><value>0, 192, 0</value> </setting></setting> </WindowsApplication1.My.MySettings></WindowsApplication1.My.MySettings></userSettings></userSettings>

Page 13: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Implementing a Custom Implementing a Custom Settings ProviderSettings Provider

Page 14: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Customizing My.UserCustomizing My.User

Thin wrapper atop IPrincipal/IIdentityThin wrapper atop IPrincipal/IIdentity

WindowsPrincipal used as defaultWindowsPrincipal used as default

Custom Authentication and Custom Authentication and Authorization are wired in through Authorization are wired in through IPrincipal/IIdentityIPrincipal/IIdentity

My.UserMy.User

IPrincipalIPrincipal

IIdentityIIdentity

WindowsPrincipalWindowsPrincipal

WindowsIdentityWindowsIdentity

Page 15: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Customizing My.UserCustomizing My.User

Leveraging ASP.NET Personalization Leveraging ASP.NET Personalization in Windows Formsin Windows Forms

Page 16: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Extending the My Extending the My NamespaceNamespaceDesign GuidelinesDesign GuidelinesStateless APIs when appropriateStateless APIs when appropriate

Global Instances.Global Instances.

Simple Parameter TypesSimple Parameter Types

Factory MethodsFactory Methods

Thread-safeThread-safe

.NET Framework Guidelines still .NET Framework Guidelines still apply!apply!

Page 17: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Extending the My Extending the My NamespaceNamespaceDeploymentDeploymentClass libraries factored into Class libraries factored into

standalone assembliesstandalone assemblies

Extensibility code factored into Visual Extensibility code factored into Visual Studio TemplateStudio Template

All components packaged and All components packaged and deployed as .VSIdeployed as .VSI

CustomTypes.dllCustomTypes.dll

MyAppExtension.vbMyAppExtension.vb

.vstemplate.vstemplate .vsi.vsi

Page 18: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Where to go from here?Where to go from here?

Attend HOL TLN023!Attend HOL TLN023!

Stop by Tools & Language Track Stop by Tools & Language Track Lounge!Lounge!

Additional resources:Additional resources:http://msdn.microsoft.com/msdnmag/isshttp://msdn.microsoft.com/msdnmag/issues/05/07/My/default.aspxues/05/07/My/default.aspx

http://msdn.microsoft.com/vbasic/defaulthttp://msdn.microsoft.com/vbasic/default.aspx?pull=/library/en-us/dnvs05/html/vb.aspx?pull=/library/en-us/dnvs05/html/vbmy.aspmy.asp

Page 19: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

QuestionsQuestions

Email: Email: [email protected]@microsoft.com

Page 20: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

Two ways to access Online Evaluation Forms:Two ways to access Online Evaluation Forms:

1.1. CommNet stations located throughout conference CommNet stations located throughout conference venuesvenues

2.2. From any wired or wireless connection to: From any wired or wireless connection to: http://www.MyTechReady.comhttp://www.MyTechReady.com

For more information please refer to your Pocket For more information please refer to your Pocket Guide Guide

Please Complete An Evaluation Please Complete An Evaluation FormFormYour Input Is Important!Your Input Is Important!

Page 21: Under the Hood on Extending the My Namespace Joe Binder TLN414 Program Manager Microsoft Corporation.

© 2005 Microsoft Corporation. All rights reserved.This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.