19 – 21 march 2006 riyadh, saudi arabia. smart client development, how to make applications go...
DESCRIPTION
Agenda Smart Clients Tools ToolStrips Custom renderers, colors, items DataGridView Custom painting, formatting, column types BackgroundWorker Cancellation, progress updates, responsive UI TableLayoutPanel Dynamic layout, content ScenariosTRANSCRIPT
19 – 21 MARCH 2006 Riyadh, Saudi Arabia
Smart Client Development, How to make applications go smarter with VS2005
Goksin Bakir
Yage Ltd,
Microsoft Regional Director, MEA
Agenda
Smart Clients
ToolsToolStrips
Custom renderers, colors, items
DataGridViewCustom painting, formatting, column types
BackgroundWorkerCancellation, progress updates, responsive UI
TableLayoutPanelDynamic layout, content
Scenarios
Smart Client
Tough Tough to deployto deploy
HeavyHeavyfootprintfootprint
““DLLDLLHell”Hell”
NetworkNetworkdependencydependency
ReducedReduced User User
ExperienceExperience
Complex toComplex todevelopdevelop
Web servicesWeb servicesand offline/onlineand offline/online
supportsupport
DeviceDeviceadaptabilityadaptability
Broad reachBroad reach
Easy changeEasy changemanagementmanagement
Easy toEasy todeploydeploy
Rich UserRich UserExperienceExperience
High developerHigh developerproductivityproductivity
ResponsiveResponsiveUIUI
Smart Client Features
Local resourcesDirect display and peripheral access
Responsive graphics, printers, digital camera’s, etc.
Use of installed applicationsWord, Excel, VSTO
ConnectedAccess to network resources
Web services, SQL Databases
Smart Client Features
Offline capableCache online data
Update when connected
Datasets in smart documents
Intelligent deployment and updateEasy non-administrator deployment
Automatic updates
Smart document deployment
Rich / easy developer experience
Smart Client Technologies
Visual Studio 2005Rich visual designer support
Integrated ClickOnce testing and deployment
Visual Studio Tools for Office
.NET Framework 2.0Windows Forms 2.0
ClickOnce deployment
Visual Studio 2005
Project templatesGet up and going quickly
Common application types
DesignersSimplifies development of UI and layout
Rich User Control development
Rich support for Custom Controls
What is “smart”
Local resources and user experience
Offline capable
Intelligent deployment and update
Multithreaded
Crash Proof
Visual Studio 2005
DataNew data-bound controls
Schema-based typed-data set designerSupport for iterative maintenance of generated data-code
Partial types for maintainable customizations of auto-generated code
Reduced need for “mapping” or “glue” code
Server explorerIntegrated data manipulation
ClickOnce Deployment
ClickOnce application deployment published on a web or file server
Client follows link to serverhttp://www.tempuri.org/my.application
Application deployed locally in user’s profile directory & executed
Subsequent executions check for updates & execute local install
Server
Client
application filesapplication files
ClickOnce
Smart Client deployment technology
Provides web-deployment simplicityEnd User
Provide web-deployment flexibilityPublisher
Other parallels to web-applicationsApplications are isolated per-userCan be executed with limited local permissions
Locally executed, rich features
ClickOnce Features
Follow a link to install an applicationAutomatic w/minimal or no decision points
web-style deployment
Automatic update of application
Security isolation and optional restricted permissions
Non-administrative installs
ClickOnce & VS 2005
Project Settings Publish tabSet deployment location
Configure data files for deployment
Other settings: version, online-only or online-offline, CD installations and other details
Project Settings Security tabCalculating permissions required by your application to function
Also add permissions using SecurityException at runtime
Setting permissions in the manifest required to run
Partial trust and full trust supported
Application Updates
Auto-update deployment optionsBefore application launch, or
Update check occurs after app-launch
Scheduled update checksWeekly, monthly, etc.
Project Settings Publish tabSettings for update checking
ToolStrips
Replaces MainMenu, ContextMenu, ToolBar and StatusBar
HWNDless architecture
Same OM across all containers
System and professional renderers
ToolStripControlHost
Datagridview
Replaces DataGrid
Extensible and FlexibleBound, Unbound, Virtual, Mixed
Eleventy billion PMEs
Text, Image, Button, Link cells/columns
Cell-based, not Column-basedCell styles (Font, Color, Formatting)
Cell-level eventsMouse, Formatting, Validate, Error, others...
Custom Column Types
High performanceDisplay, scrolling, updates
Backgroundworker
BackgroundWorkerSimplify creating responsive applications
Easier to perform long running tasks without “freezing” the UI
Simplify Thread use in Windows Forms applications
Automatically acquired ThreadPool Thread
no UI updates allowed…
UI Thread
DoWork(){DoWork(){ If (!CancellationPending){If (!CancellationPending){ FindInFiles()FindInFiles() }}}}
StartFindInFiles()StartFindInFiles()
ProgressChanged(){ProgressChanged(){ Update UIUpdate UI}}
RunWorkerCompleted()RunWorkerCompleted()
EndFindInFiles()EndFindInFiles()
RunWorkerAsync()RunWorkerAsync()
ReportProgress()ReportProgress()
Diagram: BackgroundWorker
Tablelayoutpanel
Layout ControlsTableLayoutPanel
Similar to HTML Table control
Address localization scenarios
Facilitate creation of resizable UI
Support data-driven UI (e.g., labels from a DB)
Diagram: Login Dialog
Equal %, preserve Equal %, preserve minimum size, lower minimum size, lower
right alignmentright alignment
Only occupy Only occupy necessary necessary
spacespace
Right aligned, Right aligned, Grow/Shrink to Grow/Shrink to
accommodate label accommodate label lengthlength
AutoScaleAutoScale
RightToLeftRightToLeft
Font ChangesFont Changes
DPI ChangesDPI Changes
DEMO
What Is: Occasionally Connected
Empowering users to leverage their computer, applications, data and files regardless of network availability
Application proactively retrieves necessary data necessary to work offline
As the network comes available, the application will automatically sync their work and log conflicts for the user to resolve
Network operations occur in the background so the user can stay focused on their task
Example: Outlook 2003
Resources Needed Offline
DataA subset of the data from the server(s)
Heterogeneous Sync (SQL Server, Oracle, DB2, …)
FilesNot all data exists within the database
Media files, Office Files, …
Application Messaging (Web Services, WCF, …)Ability to queue outbound messages
Ability to async process inbound messages
Read Only Informational/Reference Data ServicesAbility to pre-fetch data from existing services
Occasionally Connected Smart ClientOccasionally Connected Smart Client
Background Background TasksTasks
Net
wor
k Re
sour
ces
Net
wor
k Re
sour
ces Data SyncData Sync
ServicesServices
Data Access APIData Access API
Data StoreData Store
Message Message QueuingQueuing
Message Message CachingCaching
FilesFiles
File SyncFile SyncServicesServices
Microsoft Windows / Windows MobileMicrosoft Windows / Windows Mobile
Visu
al S
tudi
oVi
sual
Stu
dio
Smart Client Application / UISmart Client Application / UI
Application Application UpdatesUpdates
Canned Canned UI UI
ControlsControls
SalesSalesSmart ClientSmart Client
Background Background TasksTasks
Works CorpWorks Corp
Architecture
Net
wor
k Se
rvic
esN
etw
ork
Serv
ices
SyncSyncServicesServices
Data StoreData Store
WeatherWeatherCachingCaching
Order Order SubmissioSubmission Queuen Queue PromoPromo
VideosVideos
App LogicApp Logic
Desktop Desktop TabletPTabletP
CCPocketPCPocketPC Smart Smart
PhonePhone
DataDataServerServer
Sync
Sync
Serv
icSe
rvic
eses
Ord
erO
rder
Serv
icSe
rvic
eses
WeatheWeatherr
ServiceServicess
•Product Catalog•My Customers•Order Scratchpad•My Inventory
App App UpdatesUpdates
Which Local Data Store?
Microsoft Database Technologies
SQL Server 2005SQL Server Express Edition
SQL Server Mobile Edition
Jet (Access)
Microsoft Visual FoxPro (.dbf)
Excel
XML
WinFS
Something new
SQL Server Express
Great improvements over MSDESimple install from web or local MSI
ClickOnce will BootStrap SSE if not installed
Connect w/File Path Connection StringUser Instance feature for File Path Connecitons
Great for VS Development
Deploying SSE For Occasionally Connected Scenarios
Base Install of SSEClickOnce BootstrapperRequires Admin Rights
Replication w/SSEReplication not supported w/User Instances
Enable SQL Server AuthenticationAdd DBO Privileged AccountScript creation of databaseVerify / Create / Attach database at startup
Deploy SQL Server Replication .Dlls
Occasionally Connected Devices
Servers
Desktops
Laptops
Tablet PC’s
Windows CE
Pocket PC
Smart Phone
??Win 32Win 32 Sweet Sweet
spotspot
Local Database Options
ServerWorkgroup
DesktopLaptop
Tablet PCWindows CE Device
Pocket PCSmart Phone
Win 32Win 32
SQ
L S
erve
rE
xpre
ss
SQ
LS
erve
rM
ulti
Use
rS
ingl
e U
ser S
cena
rios
SQ
L M
obile
S
QL
Mob
ile
Deploying SQL Server Mobile
SQL Server Mobile EngineAdd runtime dlls to project (sqlce*.dll) C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
File size <1.4mb
Set files to Copy to Output Directory = Copy if newer
ADO for SQL Server MobileAdd reference to Microsoft SQL Mobile
Located in: C:\Program Files\Microsoft Visual Studio 8\ _ Common7\IDE\PublicAssemblies\System.Data.SqlServerCE.dll
File Size ~224k
How - To Sync
Roll your ownUltimate in flexibilityHighest cost to develop and maintain
Merge ReplicationMost power, broadest features for different data partitions, spans all devicesNeed DBO/DBA privileges, must “own” server
Remote Data Access (RDA)Easy entry point for well partitioned data, no config to databaseLimited to SQL Server Mobile
Technology Roll your ownMerge
Replication
RemoteData Access
XML - DataSets SQL Server Express SQL Server Mobile
Local App
RDA Sync Architecture
Server Data
SQL ServerMobile
Database Engine
DAL
UI
InInOutOut
IISw / Sync ISAPI dll
RDA Sync Engine
BackgroundTasks / Steps
Runs on a background thread of the application
Executes collection of steps
Start / Stop similar to Windows Services
Executes in a loop based on a Timer
Can be triggered by Network Resources
Marshals progress / completed infoto UI thread
Community Resources
INETA MEA ! www.ineta.org
mea.ineta.org
Smart Client Summary
Rich features easier than ever to implementWindows Forms 2.0 new controls
Windows Forms 2.0 improved data integration
Installation and update easier than everClickOnce web-style simplicity
ClickOnce web-style security
SmartClient rich feature-set
Customers access existing and new application features easily
Customers access your application with or without network connectivity