Metro UI: A deep diveSession 2
2© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALWhat we’ll cover:ApplicationModelCollaborationbetween appsDevelopmenta...
3© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALRunningNot RunningSuspendedActivating SuspendingTerminatingResumingApp...
4© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALApplication Model | State ManagementLocalStateTransient State Persiste...
5© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIAL// Handle OnLaunched handler of application class and check for previo...
6© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALThings to remember…Save application data when the app isbeing suspende...
7© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALCollaboration between Apps Sharing Search Activation Mechanisms
8© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALCollaboration | Sharing
9© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Manifest Declaration Target Application
10© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Prepare Data in Source Application// Prepare data to share ...
11© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Consume Data in Target Application// Add handler for activa...
12© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Report Complete in Target Application// Call report complet...
13© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALCollaboration| Search
14© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSearch | Manifest Declaration
15© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSearch | In Application Context// In OrderPage.xaml.cs add handler fo...
16© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSearch | Handle Activation Kind// In App.xaml.cs handle OnSearchActiv...
17© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALOther Activation Kinds| Protocol Activation
18© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALProtocol Activation | Manifest Declaration
19© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIAL// Prepare a URI with the name of the protocol and the data to// be p...
20© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALProtocol Activation | Activation in Target App// Handle activated eve...
21© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALThings to remember…Use the standard charms and contracts acrossapps t...
22© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDevelopment and execution modelchanges Visual Studio .Net Profile ...
23© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDevelopment Changes | Visual Studio
24© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDevelopment Changes | .NET ProfileUI stack moved to WinRTWCF changesX...
25© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDeployment & Execution Model ChangesClassCatalogExtensionCatalogDeplo...
26© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing Perspectives Q&A session
Upcoming SlideShare
Loading in...5
×

Redefining Perspectives 4 - Metro ui Session 2 ver 3 5 (5)

910

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
910
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Redefining Perspectives 4 - Metro ui Session 2 ver 3 5 (5)

  1. 1. Metro UI: A deep diveSession 2
  2. 2. 2© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALWhat we’ll cover:ApplicationModelCollaborationbetween appsDevelopmentand executionmodel changesDeep-Dive into developing real world capital market appsusing WinRT & Metro UI
  3. 3. 3© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALRunningNot RunningSuspendedActivating SuspendingTerminatingResumingApplication Model | App LifecycleActivated Suspended Terminated
  4. 4. 4© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALApplication Model | State ManagementLocalStateTransient State PersistenceTempFolderLocal Folder / SettingsCloud
  5. 5. 5© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIAL// Handle OnLaunched handler of application class and check for previous execution stateprotected override void OnLaunched(LaunchActivatedEventArgs args){if(args.PreviousExecutionState == ApplicationExecutionState.Terminated) {foreach (var item in ApplicationData.Current.LocalSettings.Values){AppSettings.Instance.Settings[item.Key] = item.Value;} }}State Management | Implementationpublic App(){//Add application suspending handler.this.Suspending += OnSuspending;}// Handler for suspending eventvoid OnSuspending(object sender, SuspendingEventArgs e){foreach (var item in AppSettings.Instance.Settings){ApplicationData.Current.LocalSettings.Values[item.Key] = item.Value;}}
  6. 6. 6© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALThings to remember…Save application data when the app isbeing suspendedRelease exclusive resources and filehandles when the app is beingsuspendedSave less data (only as much as yourequire) and save as you go
  7. 7. 7© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALCollaboration between Apps Sharing Search Activation Mechanisms
  8. 8. 8© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALCollaboration | Sharing
  9. 9. 9© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Manifest Declaration Target Application
  10. 10. 10© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Prepare Data in Source Application// Prepare data to share in DataRequested handlervoid DataRequested(DataTransferManager sender, DataRequestedEventArgs e){// Set context information about sharing.e.Request.Data.Properties.Title = "Orders Manager";e.Request.Data.Properties.Description = "Order Details for " + orderCount.ToString() + "order(s)";// Specify the format and set actual data to be shared with another application.e.Request.Data.SetData(StandardDataFormats.Html,OrderItemCollection.ToHTML(_data));}// Add handler to Data Requested event of DataTransferManager class.public OrdersPage(){DataTransferManager datatransferManager = DataTransferManager.GetForCurrentView();// Add handler that gets invoked when sharing starts.datatransferManager.DataRequested += new TypedEventHandler<DataTransferManager,DataRequestedEventArgs>(this.DataRequested);}
  11. 11. 11© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Consume Data in Target Application// Add handler for activated event in javascript file.WinJS.Application.addEventListener("activated",activatedHandler, false);// Handle share activation kind, extract data and draw graphs.function activatedHandler(args) {if (args.detail.kind ==Windows.ApplicationModel.Activation.ActivationKind.shareTarget){// Check for Html data format and extract dataif(args.detail.data.contains(Windows.ApplicationModel.DataTransfer.StandardDataFormats.html)) {eventArgs.detail.data.getHtmlFormatAsync().then(function (htmlFormat){ //Draw the charts using the collection } }}
  12. 12. 12© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing | Report Complete in Target Application// Call report completed on click of close button to report thecompleteness of share operation.function reportCompleted(){shareOperation.reportCompleted();}
  13. 13. 13© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALCollaboration| Search
  14. 14. 14© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSearch | Manifest Declaration
  15. 15. 15© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSearch | In Application Context// In OrderPage.xaml.cs add handler for QuerySubmitted event of CurrentView’s SearchPane.public void OrderPage (){// In QuerySubmitted handler navigate user to search result page.Windows.ApplicationModel.Search.SearchPane.GetCurrentView().QuerySubmitted +=(sender, queryArgs) =>PMWorkbench.SearchResultsPage1.Activate(queryArgs.QueryText);}// Handle visibility change of search page and add context information about search criteria.public OrdersPage(){// Get search pane for current view and add handler to visibility change.var searchPane = SearchPane.GetForCurrentView();searchPane.VisibilityChanged += (sender, args) =>{if (args.Visible)sender.PlaceholderText = "Deal ID /Symbol /Counterparty";}}
  16. 16. 16© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSearch | Handle Activation Kind// In App.xaml.cs handle OnSearchActivated method of// application class. This gets invoked by system.protected override voidOnSearchActivated(Windows.ApplicationModel.Activation.SearchActivatedEventArgs args){// Navigate user to Search result page with search context.PMWorkbench.SearchResultsPage1.Activate(args.Query Text);}
  17. 17. 17© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALOther Activation Kinds| Protocol Activation
  18. 18. 18© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALProtocol Activation | Manifest Declaration
  19. 19. 19© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIAL// Prepare a URI with the name of the protocol and the data to// be passed to the app to be launchedOrder Managerprivate async void btnAddToWatch_Click(object sender,RoutedEventArgs e){Uri uri = new Uri(@"watch://" + orderItem.Security);// Launch the URIWindows.System.Launcher.LaunchUriAsync(uri);}Protocol Activation | Prepare URI in Source App
  20. 20. 20© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALProtocol Activation | Activation in Target App// Handle activated event and check for kind = protocol// Parse data passed along with the protocolWatch listprotected override void OnActivated(IActivatedEventArgs args){if (args.Kind == ActivationKind.Protocol){var protocolActivatedEventArgs = args asProtocolActivatedEventArgs;if (protocolActivatedEventArgs != null)OnProtocolActivated(protocolActivatedEventArgs.Uri.ToString());}}
  21. 21. 21© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALThings to remember…Use the standard charms and contracts acrossapps to provide consistent user experienceProvide contextual information while usingSearch and Share charmsUse various application activation mechanismsto create powerful mash-ups
  22. 22. 22© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDevelopment and execution modelchanges Visual Studio .Net Profile Application Deployment & Execution Model
  23. 23. 23© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDevelopment Changes | Visual Studio
  24. 24. 24© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDevelopment Changes | .NET ProfileUI stack moved to WinRTWCF changesXMLHTTPWCFSerializationBCL.NET for Metro Apps.Net Framework4.5WindowsPhone 7.1.Net for MetroappsSilverlight 5
  25. 25. 25© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALDeployment & Execution Model ChangesClassCatalogExtensionCatalogDeploymentEngine<Applications><ApplicationId="App"StartPage="default.html"><VisualElementsDisplayName="Hello World"Logo="imageslogo.png"Description="Hello_World"....xCopy Deployment will not workAppContainers - New security modelCapabilities - To access system resources
  26. 26. 26© COPYRIGHT 2012 SAPIENT CORPORATION | CONFIDENTIALSharing Perspectives Q&A session
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×