windows runtime apps

49
Windows Runtime Apps Jaliya Udagedara MVP (Visual C#)

Upload: jaliya-udagedara

Post on 09-Jul-2015

548 views

Category:

Technology


1 download

DESCRIPTION

Windows Runtime Apps at National Institute of Business Management (NIBM) - Sri Lanka

TRANSCRIPT

Page 1: Windows Runtime Apps

Windows Runtime Apps

Jaliya UdagedaraMVP (Visual C#)

Page 2: Windows Runtime Apps
Page 3: Windows Runtime Apps
Page 4: Windows Runtime Apps
Page 5: Windows Runtime Apps
Page 6: Windows Runtime Apps
Page 7: Windows Runtime Apps

Windows Store App

Windows Phone Store App

Page 8: Windows Runtime Apps

Windows Runtime Apps

Page 9: Windows Runtime Apps
Page 10: Windows Runtime Apps

Windows Runtime contains more than 90% of Windows

Phone Runtime

Page 11: Windows Runtime Apps
Page 12: Windows Runtime Apps
Page 13: Windows Runtime Apps
Page 14: Windows Runtime Apps
Page 15: Windows Runtime Apps
Page 16: Windows Runtime Apps
Page 17: Windows Runtime Apps
Page 18: Windows Runtime Apps
Page 19: Windows Runtime Apps

protected override async void OnLaunched(LaunchActivatedEventArgs e){

ApplicationExecutionState state = e.PreviousExecutionState;

ActivationKind kind = e.Kind;

///...}

Page 20: Windows Runtime Apps

• App is suspended

• All code stopped

• No timers tick

• No events fire

• Process still alive and in memory

• Code has a chance to respond (next slide)

Page 21: Windows Runtime Apps

private async void OnSuspending(object sender, SuspendingEventArgs e){

var deferral = e.SuspendingOperation.GetDeferral();

await SuspensionManager.SaveAsync(); deferral.Complete();

}

Page 22: Windows Runtime Apps

• Same app is resumed

• Same process, same memory so values of variables are intact

• All code runs

• Code has a chance to respond.

Launch Switcher

Page 23: Windows Runtime Apps

public App() {

this.InitializeComponent();this.Suspending += this.OnSuspending;this.Resuming += App_Resuming;

}

void App_Resuming(object sender, object e){

// TODO: whatever you need to do to resume your app}

Page 24: Windows Runtime Apps

http://bit.ly/w8Resuming

Page 25: Windows Runtime Apps
Page 26: Windows Runtime Apps
Page 27: Windows Runtime Apps
Page 28: Windows Runtime Apps

Window

Frame

PageWindow

Page 29: Windows Runtime Apps

protected override void OnLaunched(LaunchActivatedEventArgs e){

Frame rootFrame = Window.Current.Content as Frame;

// Do not repeat app initialization when the Window already has// content, just ensure that the window is activeif (rootFrame == null){

// Create a Frame to act as the navigation context and navigate// to the first pagerootFrame = new Frame();

...

// Place the frame in the current WindowWindow.Current.Content = rootFrame;

}

if (rootFrame.Content == null){

// Navigate to the first pagerootFrame.Navigate(typeof(MainPage), e.Arguments);

}// Ensure the current window is activeWindow.Current.Activate();

}

Page 30: Windows Runtime Apps

private void itemListView_ItemClick(object sender, ItemClickEventArgs e)

{

// Navigate to the appropriate destination page, configuring the new page

// by passing required information as a navigation parameter

var itemId = ((MyListViewItem)e.ClickedItem).UniqueId;

Frame.Navigate(typeof(MyDetailPage), itemId);

}

Page 31: Windows Runtime Apps

private void btnGoBack_Click(object sender, RoutedEventArgs e)

{if (this.Frame.CanGoBack)

this.Frame.GoBack();}

Page 32: Windows Runtime Apps
Page 33: Windows Runtime Apps
Page 34: Windows Runtime Apps

public sealed partial class SecondPage : Page{

...

protected override void OnNavigatedTo(NavigationEventArgs e){

Windows.Phone.UI.Input.HardwareButtons.BackPressed += HardwareButtons_BackPressed;}

protected override void OnNavigatedFrom(NavigationEventArgs e){

Windows.Phone.UI.Input.HardwareButtons.BackPressed -= HardwareButtons_BackPressed;}

async void HardwareButtons_BackPressed(object sender, Windows.Phone.UI.Input.BackPressedEventArgs e){

e.Handled = true; // We've handled this button press

if (SecondaryUI.Visibility == Visibility.Visible ) // If the secondary UI is visible, hide it{

FadeOutSecondaryStoryboard.Begin();}else{

if (Frame.CanGoBack)Frame.GoBack();

}}

Page 35: Windows Runtime Apps
Page 36: Windows Runtime Apps
Page 37: Windows Runtime Apps
Page 38: Windows Runtime Apps
Page 39: Windows Runtime Apps
Page 40: Windows Runtime Apps

Add Windows Phone 8.1 or Windows 8.1

Page 41: Windows Runtime Apps

Context Switcher in the Editor

Page 42: Windows Runtime Apps

Context Switcher in the XAML Editor

Page 43: Windows Runtime Apps

Better IntelliSense

Page 44: Windows Runtime Apps

Devices Window

Page 45: Windows Runtime Apps

Switching Startup Projects

Page 46: Windows Runtime Apps
Page 47: Windows Runtime Apps
Page 48: Windows Runtime Apps

• Universal App

Page 49: Windows Runtime Apps

Thank You!http://www.jaliyaudagedara.blogspot.com/