Charles Petzold www.charlespetzold.com Navigation.

Slides:



Advertisements
Similar presentations
Chapter 12 Lists and Iterators. List Its an abstract concept not a vector, array, or linked structure. Those are implementations of a List. A list is a.
Advertisements

Chapter 3 – Web Design Tables & Page Layout
Microsoft Office SharePoint Portal Server 2007 Introduction to InfoPath Forms Services Daryl L. Rudolph.
Charles Petzold Application Lifecycle and State Management.
Understanding Mobile App Development Concepts and Working with APIs Lesson 6.
Dinko Jakovljević Microsoft Student Partner | BambooLab
Programming Based on Events
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
Finding and Debugging Errors
Pocket Brewer On hand tools for the average homebrewer.
ASP.NET Programming with C# and SQL Server First Edition
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Entire article, and much more, is available at By Michael Knopf
Cosc 4730 Android TabActivity and ListView. TabActivity A TabActivity allows for multiple “tabs”. – Each Tab is it’s own activity and the “root” activity.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
Chapter 8: String Manipulation
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
11 Values and References Chapter Objectives You will be able to: Describe and compare value types and reference types. Write programs that use variables.
ANDROID UI – FRAGMENTS. Fragment  An activity is a container for views  When you have a larger screen device than a phone –like a tablet it can look.
CS378 - Mobile Computing Web - WebView and Web Services.
Joe Hummel, PhD Dept of Mathematics and Computer Science Lake Forest College
Reusable Code For Your Appx Processes Presented By: Gary Rogers.
Xcode testing Using XCTest.
Sage SalesLogix What’s New in Sawgrass. Data Safeguarding.
Introduction to Mobile Programming. Slide 2 Overview Fundamentally, it all works the same way You get the SDK for the device (Droid, Windows, Apple) You.
1 Web-Enabled Decision Support Systems Objects and Procedures Don McLaughlin IE 423 Design of Decision Support Systems (304)
CIS 200 Final Review. New Material Data Structures.
An Introduction to Silverlight Matt Harrington Developer Evangelist, Microsoft October 20, 2011.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Typing Application Introducing Keyboard Events, Menus, Dialogs and the Dictionary.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
Charles Petzold Launchers and Choosers.
Getting Started The structure of a simple wxWidgets program, Look at where and how a wxWidgets application starts and ends, how to show the main window,
Tutorial 111 The Visual Studio.NET Environment The major differences between Visual Basic 6.0 and Visual Basic.NET are the latter’s support for true object-oriented.
Getting Started with Caliburn.Micro and Windows Phone 7 Gary Ewan Park Twitter: Blog:
Microsoft SharePoint Server 2010 for the Microsoft ASP.NET Developer Yaroslav Pentsarskyy
Chapter 7 Stacks. © 2004 Pearson Addison-Wesley. All rights reserved 7-2 The Abstract Data Type: Developing an ADT During the Design of a Solution Specifications.
1 Classes and Controls CE-105 Spring 2007 By: Engr. Faisal ur Rehman.
Android – Fragments L. Grewe.
1 Chapter 12 – Web Applications 12.1 Programming for the Web, Part I 12.2 Programming for the Web, Part II 12.3 Using Databases in Web Programs.
Windows Phone MVVM and Unit Testing Step by Step Andy Wigley Windows Phone Development MVP, Mobile Software Consultant APPA Mundi Ltd WPH208.
WaveMaker Visual AJAX Studio 4.0 Training Basics: Building Your First Application Binding Basics.
Chapter Two Creating a First Project in Visual Basic.
+ An Intro To Xcode By Sarah Montroy. + What is Xcode?
Chapter Thirteen Working with Access Databases and LINQ Programming with Microsoft Visual Basic th Edition.
Reference: “ASP.NET 2.0 Illustrated” by Alex Homer and Dave Sussman. -ch3 illustrated book
The Web Wizard’s Guide To JavaScript Chapter 8 Working with Windows and Frames.
>> PHP: Insert Query & Form Processing. Insert Query Step 1: Define Form Variables Step 2: Make DB Connection Step 3: Error Handling Step 4: Define the.
CIS 375—Web App Dev II ASP.NET 3 Working With Server Controls.
The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms.
IBM TSpaces Lab 2 Customizing tuples and fields. Summary Blocking commands Tuple Expiration Extending Tuples (The SubclassableTuple) Reading/writing user.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
04 |Sharing Code Between Windows 8 and Windows Phone 8 in Visual Studio Ben Riga
Chapter 12© copyright Janson Industries Java Server Faces ▮ Explain the JSF framework ▮ SDO (service data objects) ▮ Facelets ▮ Pagecode classes.
WaveMaker Visual AJAX Studio 4.0 Training Java Script Events.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
Presented by Ted Higgins, SQL Server DBA An Introduction to Object – Oriented Programming.
McGraw-Hill © 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 11 Data Files.
private void page2Button_Click(object sender, RoutedEventArgs e) { NavigationService.Navigate(new Uri("/PageTwo.xaml", UriKind.RelativeOrAbsolute));
11 User Controls Beginning ASP.NET in C# and VB Chapter 8.
Creating New Forms Projects can appear more professional when using different windows for different types of information. Select Add Windows Form from.
Programering af mobile enheder Windows Phone Uge 9 Part 1.
Variables and Inheritance Part 1 Alice. Review: Properties A class defines properties for its own kind of object. When an object is created (instantiated),
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
CE-105 Spring 2007 By: Engr. Faisal ur Rehman
CSCI 3333 Data Structures Stacks.
TechEd /26/2018 3:42 AM © 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks.
VISUAL BASIC.
Web Development Using ASP .NET
CIS 199 Final Review.
Ch07 生命週期(Life Cycle).
Presentation transcript:

Charles Petzold Navigation

Agenda Navigation framework Passing data between pages Navigation and state retention Self-referential pages

Navigation framework elements –Pages to host navigable content –Frame to host the pages –Navigation service for moving among pages –Navigation context for passing data between pages Navigation framework benefits –Build multipage applications –Partition content into navigable chunks –Get Back-button support for free Navigation Framework

Navigation Framework Classes ClassDescription PhoneApplicationPage Represents pages in a phone application. Includes key virtual methods OnNavigatedFrom and OnNavigatedTo, and key properties NavigationService and NavigationContext PhoneApplicationFrame Serves as a container for pages and provides space for the system tray and application bar. Also provides methods for navigating backward like the phone's Back button NavigationService Provides methods for navigating to other pages NavigationContext Provides easy-to-use mechanism for retrieving data passed from one page to another via query strings

Phone Application Structure App Derives from System.Windows.Application RootFrame MainPage Other Pages Derives from Microsoft.Phone.- Controls.PhoneApplicationFrame Derives from Microsoft.Phone.- Controls.PhoneApplicationPage

Use Visual Studio's Add New Item command Select one of the phone-page templates Adding a New Page to an App

NavigationService.Navigate goes to another page NavigationService reference exposed through PhoneApplicationPage.NavigationService Navigating to Another Page NavigationService.Navigate(new Uri("/Page2.xaml", UriKind.Relative)); Include leading slash (required)

PhoneApplicationFrame.GoBack goes back –Throws exception if there is no back PhoneApplicationFrame.CanGoBack indicates whether it's safe to call GoBack Going Backward // Go to the previous page if ((Application.Current as App).RootFrame.CanGoBack) (Application.Current as App).RootFrame.GoBack();

PhoneApplicationFrame.GoForward always throws InvalidOperationException –Windows phone has back stack but not forward stack PhoneApplicationFrame.CanGoForward always returns false Going Forward // Don't even try it if ((Application.Current as App).RootFrame.CanGoForward) (Application.Current as App).RootFrame.GoForward();

OnNavigatedTo and OnNavigatedFrom methods are called when page is navigated to or from Use OnNavigatedTo to perform initializations required each time page is displayed PhoneApplicationPage Overrides public MainPage() { // Not guaranteed to be called } protected override void OnNavigatedTo(NavigationEventArgs e) { // Guaranteed to be called }

demo Navigation Applications

Use NavigationContext –Equivalent to using query strings in Web apps –Best for simple data that's small in volume Use application variables –Public fields or properties declared in App class –Handles large amounts of data, simple or complex Or use the application state –Accessed through PhoneApplicationService.State –Limit of ~1.5 MB of data and must be serializable Passing Data Between Pages

Using NavigationContext // Page 1 NavigationService.Navigate(new Uri("/Page2.xaml?ID=foo", UriKind.Relative)); // Page 2 protected override void OnNavigatedTo(NavigationEventArgs e) { if (NavigationContext.QueryString.ContainsKey("ID")) string id = NavigationContext.QueryString["ID"]; }

demo NavigationContext

PhoneApplicationFrame.GoBack activates an existing instance of the previous page –Same is true of phone's Back button Navigation and State Navigate()GoBack()

NavigationService.Navigate creates a new instance of the page being navigated to Navigation and State, Cont. Navigate()

Tombstoning code adds state retention –Retains state between activation events –Retains state between navigation events Use application state, not page state, for latter Navigation and Tombstoning protected override void OnNavigatedFrom(NavigationEventArgs e) { // TODO: Record page state in application state } protected override void OnNavigatedTo(NavigationEventArgs e) { // TODO: Restore page state from application state }

demo Navigation and Tombstoning

Pages that navigate to themselves Can be used to avoid complex tombstoning logic if query strings wholly capture page state Self-Referential Pages

Charles Petzold Questions?