SlideShare a Scribd company logo
MvvmQuickCross for Windows Phone
MvvmQuickCross
lightweight cross-platform
Accelerates
code sharing
in control
NuGet GitHub
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
Main View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Main ViewModel
• Properties
• Commands
• INotifyPropertyChanged
SubB ViewModel
• Properties
• Commands
• INotifyPropertyChanged
SubA ViewModel
• Properties
• Commands
• INotifyPropertyChanged
SubB View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
SubA View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Composite ViewModels are also possible:
class MainViewModel : ViewModelBase {
List<ItemViewModel> MyItems /* Data-Bindable property
}
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
public int Count /* One-way data-bindable property
generated with propdb1 snippet …
public string MyProperty /* Two-way data-bindable
property generated with propdb2 snippet …
public string MyProperty2 /* Two-way data-bindable
property that calls custom code in
OnMyProperty2Changed() from setter, generated with
propdb2c snippet …
/* One-way data-bindable property generated with
propdbcol snippet…
public ObservableCollection<string> MyCollection
public bool MyCollectionHasItems
protected void UpdateMyCollectionHasItems()
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
public RelayCommand DoSomethingCommand /* Data-bindable
command that calls DoSomething(), generated with cmd
snippet …
private void DoSomething()
{
// TODO: Implement DoSomething()
throw new NotImplementedException();
}
public RelayCommand EditItemCommand /* Data-bindable
command with parameter that calls EditItem(), generated
with cmdp snippet …
private void EditItem(object parameter)
{
var item = (Item)parameter;
// TODO: Implement EditItem()
throw new NotImplementedException();
}
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
// Design-time data support
#if DEBUG
namespace MyApp.ViewModels.Design
{
public class MyModelDesign : MyViewModel
{
public MyModelDesign()
{
// TODO: Initialize the view model with
hardcoded design-time data
}
}
}
#endif
Note: Design-data can initially also be used at runtime
for fast application prototyping, before any services or
models are implemented.
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
public abstract class ViewModelBase :
INotifyPropertyChanged
{
public event PropertyChangedEventHandler
PropertyChanged;
protected virtual void RaisePropertyChanged(
string propertyName)
{ … }
}
public class RelayCommand : ICommand
{
public RelayCommand(Action handler, …
public RelayCommand(Action<object> handler, …
public bool IsEnabled { … }
}
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
<phone:PhoneApplicationPage
xmlns:vm=
"clr-namespace:MyApp.Shared.ViewModels.Design;
assembly=MyApp.Shared.wp"
d:DataContext="{d:DesignInstance
Type=vm:MyViewModelDesign,
IsDesignTimeCreatable=True }"
<TextBox Text="{Binding Title, Mode=TwoWay}" …
</phone:PhoneApplicationPage>
public partial class MyView : PhoneApplicationPage
{
public MyView()
{
InitializeComponent();
DataContext = MyApplication.Instance.MyViewModel;
}
}
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
public class ClientLotUpdate
{
public decimal CurrentPrice { get; set; }
public int ProgressRemaining { get; set; }
public RemainingTime TimeRemaining { get; set; }
public ClientLotUpdate()
{
TimeRemaining = new RemainingTime();
}
}
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
ServiceAgent
• Service Entities
• Service Events
• Service Methods
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
public class ClientLotUpdate
{
public decimal CurrentPrice { get; set; }
public int ProgressRemaining { get; set; }
public RemainingTime TimeRemaining { get; set; }
public ClientLotUpdate()
{
TimeRemaining = new RemainingTime();
}
}
Note that in simple cases service entities defined in
the service contract can be used directly as the
‘model’.
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
public class LotUpdatedEventArgs : EventArgs
{
public ClientLotUpdate clientLotUpdate { get; set; }
}
public event EventHandler<LotUpdatedEventArgs>
ActiveLotUpdated;
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
public class PlaceBidRequest
{
public int LotId { get; set; }
public decimal Price { get; set; }
}
public Task RaisePlaceBidAsync(PlaceBidRequest
placeBidRequest)
{
return _hubProxy.Invoke(
"PlaceBid",
new object[] { placeBidRequest });
}
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
public class AuctionApplication
{
void ContinueToAuction()
void ContinueToCheckout(Basket basket)
void ContinueToOrderConfirmed()
void ContinueToProductList()
void ContinueToProductPage(ClientLot product)
void UserWantsToSignIn()
bool IsUserLoggedIn()
…
}
The ViewModel only uses the application to initiate
navigation and to obtain relevant application state.
ViewModels do not reference or modify other viewmodels.
Exception: contained view models; e.g. a collection of
ItemViewModel.
ViewModels can pass parameters to the application, which
in turn can use those to initialize other view models.
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
public abstract class ApplicationBase {
public static Task RunOnUIThread(Action action)
public object CurrentNavigationContext { get; set; }
}
class MyApplication : ApplicationBase {
public static MyApplication Instance { get … }
public MyViewModel MyViewModel { get; private set; }
public void ContinueToItem(Item item = null)
{
if (MyViewModel == null)
MyViewModel = new MyViewModel(_itemService);
MyViewModel.Initialize(item);
RunOnUIThread(() => _navigator.NavigateToMyView(
CurrentNavigationContext));
}
}
Application initializes viewmodel and then calls
navigator for platform-specific view navigation.
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
public interface IMyAppNavigator
{
void NavigateToMyView(object navigationContext);
void NavigateToOtherView(object navigationContext);
}
The navigator implementation is platform specific – it
knows what type of object navigationContext is.
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
public partial class App : Application {
public static MyApplication EnsureMyApplication(
Frame navigationContext) {
return MyApplication.Instance ??
new MyApplication(new MyNavigator(),
navigationContext);
}
void Application_Launching(…) {
EnsureMyApplication(RootFrame).ContinueToItemList(
skipNavigation: true);
}
void Application_Activated(…) {
EnsureMyApplication(RootFrame);
}
}
The entry point is platform specific
(navigationContext, here a WP Frame) and creates
platform specific service instances, such as the
Navigator.
ViewModel
• Properties
• Commands
• INotifyPropertyChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
class MyNavigator : IMyNavigator
{
void Navigate(object navigationContext, string uri)
{
((Frame)navigationContext).Navigate(
new Uri(uri, UriKind.Relative));
}
void NavigateToMyView(object navigationContext)
{
Navigate(navigationContext, "/MyView.xaml");
}
…
}
The navigator is platform specific (navigationContext,
here a WP Frame).
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on ViewModel,
for select (groups of) properties (it is not
necessary to bind to each individual property). Also
the commands of the views are invoked from code in an
event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged,
INotifyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on ViewModel,
for select (groups of) properties (it is not
necessary to bind to each individual property). Also
the commands of the views are invoked from code in an
event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
ViewModel
• Properties
• Commands
• INotifyPropertyChanged, INoti
fyCollectionChanged
Model
• Entities (POCO)
ServiceAgent
• Service Entities
• Service Events
• Service Methods
Application
• ViewModels instance
• Navigation context
• Navigation transitions
View
• Markup
• Data binding code
(if not supported in markup)
• UI Manipulation Code
Navigator
• Navigate to view
implementation
Entry
Point
Runtime flow: Application starts with AuctionView, user
places bid and navigates to CheckoutView.
1. Entrypoint is called, creates Navigator and
Application instances.
2. Application ctor creates ServiceAgent and
AuctionViewModel + ProductsViewModel
3. Entry Point calls
MyApplication.Instance.NavigateToAuctionView()
4. Navigator calls platform-specific navigate to
AuctionView
5. View class gets ViewModel from Application.Instance
6. On platforms without data binding, the view
subscribes itself to PropertyChanged on
ViewModel, for select (groups of) properties (it is
not necessary to bind to each individual property).
Also the commands of the views are invoked from code
in an event handler.
7. The viewmodel is updated by events from service and
commands from view. The view updates w data binding.
8. A command on a viewmodel can invoke the ContinueTo…
method on application … continue with step 3.
1
2
3
4
5 6
78
2
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
MvvmQuickCross for Windows Phone
http://nuget.org/packages/mvvmquickcross
http://github.com/MacawNL/MvvmQuickCross/
http://xamarin.com/
http://propertycross.com/
http://twitter.com/vincenth_net http://vincenth.net

More Related Content

What's hot (20)

PPTX
AngularJS
LearningTech
 
PDF
jQuery
Ivano Malavolta
 
PPT
Angular js
Hritesh Saha
 
PPTX
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
PDF
준비하세요 Angular js 2.0
Jeado Ko
 
PPTX
Intoduction to Angularjs
Gaurav Agrawal
 
PPTX
AngularJS in 60ish Minutes
Dan Wahlin
 
PDF
Writing Gadgets with the WSO2 Gadget Server
WSO2
 
PPT
Angular js
yogi_solanki
 
PDF
Overview of the AngularJS framework
Yakov Fain
 
PDF
Databinding and Performance-Tuning in Angular 2
Manfred Steyer
 
PDF
Creating lightweight JS Apps w/ Web Components and lit-html
Ilia Idakiev
 
PDF
WOdka
WO Community
 
PPTX
Introduction to angular with a simple but complete project
Jadson Santos
 
PDF
[FEConf Korea 2017]Angular 컴포넌트 대화법
Jeado Ko
 
PDF
Android DevConference - Android Clean Architecture
iMasters
 
PDF
MVVM with SwiftUI and Combine
Tai Lun Tseng
 
PDF
Wicket Intro
koppenolski
 
PPTX
Practical AngularJS
Wei Ru
 
PDF
AngularJS Framework
Barcamp Saigon
 
AngularJS
LearningTech
 
Angular js
Hritesh Saha
 
Building a TV show with Angular, Bootstrap, and Web Services
David Giard
 
준비하세요 Angular js 2.0
Jeado Ko
 
Intoduction to Angularjs
Gaurav Agrawal
 
AngularJS in 60ish Minutes
Dan Wahlin
 
Writing Gadgets with the WSO2 Gadget Server
WSO2
 
Angular js
yogi_solanki
 
Overview of the AngularJS framework
Yakov Fain
 
Databinding and Performance-Tuning in Angular 2
Manfred Steyer
 
Creating lightweight JS Apps w/ Web Components and lit-html
Ilia Idakiev
 
Introduction to angular with a simple but complete project
Jadson Santos
 
[FEConf Korea 2017]Angular 컴포넌트 대화법
Jeado Ko
 
Android DevConference - Android Clean Architecture
iMasters
 
MVVM with SwiftUI and Combine
Tai Lun Tseng
 
Wicket Intro
koppenolski
 
Practical AngularJS
Wei Ru
 
AngularJS Framework
Barcamp Saigon
 

Similar to MvvmQuickCross for Windows Phone (20)

PPTX
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
PPTX
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
PPTX
MVC 6 - the new unified Web programming model
Alex Thissen
 
PDF
Asp.Net MVC Framework Design Pattern
maddinapudi
 
PPTX
Asp.net mvc 6 with sql server 2014
Fahim Faysal Kabir
 
PDF
The MEAN stack
Nattaya Mairittha
 
PDF
Mini-Training: AngularJS
Betclic Everest Group Tech Team
 
PDF
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
PPTX
Knockout implementing mvvm in java script with knockout
Andoni Arroyo
 
PDF
Do iOS Presentation - Mobile app architectures
David Broža
 
PPTX
Developing ASP.NET Applications Using the Model View Controller Pattern
goodfriday
 
PPTX
Angular patterns
Premkumar M
 
PDF
SE2016 Android Dmytro Zaitsev "Viper make your MVP cleaner"
Inhacking
 
PDF
Dmytro Zaitsev Viper: make your mvp cleaner
Аліна Шепшелей
 
PPTX
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
PPT
ASP .net MVC
Divya Sharma
 
PDF
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
PPTX
MVC Puree - Approaches to MVC with Umbraco
Andy Butland
 
PPTX
Sexy Architecting. VIPER: MVP on steroids
Dmytro Zaitsev
 
ASP.NET MVC 5 - EF 6 - VS2015
Hossein Zahed
 
Hanselman lipton asp_connections_ams304_mvc
denemedeniz
 
MVC 6 - the new unified Web programming model
Alex Thissen
 
Asp.Net MVC Framework Design Pattern
maddinapudi
 
Asp.net mvc 6 with sql server 2014
Fahim Faysal Kabir
 
The MEAN stack
Nattaya Mairittha
 
Mini-Training: AngularJS
Betclic Everest Group Tech Team
 
GDG Addis - An Introduction to Django and App Engine
Yared Ayalew
 
Knockout implementing mvvm in java script with knockout
Andoni Arroyo
 
Do iOS Presentation - Mobile app architectures
David Broža
 
Developing ASP.NET Applications Using the Model View Controller Pattern
goodfriday
 
Angular patterns
Premkumar M
 
SE2016 Android Dmytro Zaitsev "Viper make your MVP cleaner"
Inhacking
 
Dmytro Zaitsev Viper: make your mvp cleaner
Аліна Шепшелей
 
Asp.Net MVC 5 in Arabic
Haitham Shaddad
 
ASP .net MVC
Divya Sharma
 
Angular for Java Enterprise Developers: Oracle Code One 2018
Loiane Groner
 
MVC Puree - Approaches to MVC with Umbraco
Andy Butland
 
Sexy Architecting. VIPER: MVP on steroids
Dmytro Zaitsev
 
Ad

Recently uploaded (20)

PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PDF
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PDF
Per Axbom: The spectacular lies of maps
Nexer Digital
 
PDF
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Build with AI and GDG Cloud Bydgoszcz- ADK .pdf
jaroslawgajewski1
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Per Axbom: The spectacular lies of maps
Nexer Digital
 
Generative AI vs Predictive AI-The Ultimate Comparison Guide
Lily Clark
 
Ad

MvvmQuickCross for Windows Phone

  • 4. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code
  • 5. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point
  • 6. ViewModel • Properties • Commands • INotifyPropertyChanged Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point
  • 14. Main View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Main ViewModel • Properties • Commands • INotifyPropertyChanged SubB ViewModel • Properties • Commands • INotifyPropertyChanged SubA ViewModel • Properties • Commands • INotifyPropertyChanged SubB View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code SubA View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Composite ViewModels are also possible: class MainViewModel : ViewModelBase { List<ItemViewModel> MyItems /* Data-Bindable property }
  • 17. ViewModel • Properties • Commands • INotifyPropertyChanged public int Count /* One-way data-bindable property generated with propdb1 snippet … public string MyProperty /* Two-way data-bindable property generated with propdb2 snippet … public string MyProperty2 /* Two-way data-bindable property that calls custom code in OnMyProperty2Changed() from setter, generated with propdb2c snippet … /* One-way data-bindable property generated with propdbcol snippet… public ObservableCollection<string> MyCollection public bool MyCollectionHasItems protected void UpdateMyCollectionHasItems()
  • 18. ViewModel • Properties • Commands • INotifyPropertyChanged public RelayCommand DoSomethingCommand /* Data-bindable command that calls DoSomething(), generated with cmd snippet … private void DoSomething() { // TODO: Implement DoSomething() throw new NotImplementedException(); } public RelayCommand EditItemCommand /* Data-bindable command with parameter that calls EditItem(), generated with cmdp snippet … private void EditItem(object parameter) { var item = (Item)parameter; // TODO: Implement EditItem() throw new NotImplementedException(); }
  • 19. ViewModel • Properties • Commands • INotifyPropertyChanged // Design-time data support #if DEBUG namespace MyApp.ViewModels.Design { public class MyModelDesign : MyViewModel { public MyModelDesign() { // TODO: Initialize the view model with hardcoded design-time data } } } #endif Note: Design-data can initially also be used at runtime for fast application prototyping, before any services or models are implemented.
  • 20. ViewModel • Properties • Commands • INotifyPropertyChanged public abstract class ViewModelBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected virtual void RaisePropertyChanged( string propertyName) { … } } public class RelayCommand : ICommand { public RelayCommand(Action handler, … public RelayCommand(Action<object> handler, … public bool IsEnabled { … } }
  • 21. ViewModel • Properties • Commands • INotifyPropertyChanged View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code <phone:PhoneApplicationPage xmlns:vm= "clr-namespace:MyApp.Shared.ViewModels.Design; assembly=MyApp.Shared.wp" d:DataContext="{d:DesignInstance Type=vm:MyViewModelDesign, IsDesignTimeCreatable=True }" <TextBox Text="{Binding Title, Mode=TwoWay}" … </phone:PhoneApplicationPage> public partial class MyView : PhoneApplicationPage { public MyView() { InitializeComponent(); DataContext = MyApplication.Instance.MyViewModel; } }
  • 22. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code public class ClientLotUpdate { public decimal CurrentPrice { get; set; } public int ProgressRemaining { get; set; } public RemainingTime TimeRemaining { get; set; } public ClientLotUpdate() { TimeRemaining = new RemainingTime(); } }
  • 23. ViewModel • Properties • Commands • INotifyPropertyChanged ServiceAgent • Service Entities • Service Events • Service Methods View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code public class ClientLotUpdate { public decimal CurrentPrice { get; set; } public int ProgressRemaining { get; set; } public RemainingTime TimeRemaining { get; set; } public ClientLotUpdate() { TimeRemaining = new RemainingTime(); } } Note that in simple cases service entities defined in the service contract can be used directly as the ‘model’.
  • 24. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code public class LotUpdatedEventArgs : EventArgs { public ClientLotUpdate clientLotUpdate { get; set; } } public event EventHandler<LotUpdatedEventArgs> ActiveLotUpdated;
  • 25. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code public class PlaceBidRequest { public int LotId { get; set; } public decimal Price { get; set; } } public Task RaisePlaceBidAsync(PlaceBidRequest placeBidRequest) { return _hubProxy.Invoke( "PlaceBid", new object[] { placeBidRequest }); }
  • 26. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code public class AuctionApplication { void ContinueToAuction() void ContinueToCheckout(Basket basket) void ContinueToOrderConfirmed() void ContinueToProductList() void ContinueToProductPage(ClientLot product) void UserWantsToSignIn() bool IsUserLoggedIn() … } The ViewModel only uses the application to initiate navigation and to obtain relevant application state. ViewModels do not reference or modify other viewmodels. Exception: contained view models; e.g. a collection of ItemViewModel. ViewModels can pass parameters to the application, which in turn can use those to initialize other view models.
  • 27. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code public abstract class ApplicationBase { public static Task RunOnUIThread(Action action) public object CurrentNavigationContext { get; set; } } class MyApplication : ApplicationBase { public static MyApplication Instance { get … } public MyViewModel MyViewModel { get; private set; } public void ContinueToItem(Item item = null) { if (MyViewModel == null) MyViewModel = new MyViewModel(_itemService); MyViewModel.Initialize(item); RunOnUIThread(() => _navigator.NavigateToMyView( CurrentNavigationContext)); } } Application initializes viewmodel and then calls navigator for platform-specific view navigation.
  • 28. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation public interface IMyAppNavigator { void NavigateToMyView(object navigationContext); void NavigateToOtherView(object navigationContext); } The navigator implementation is platform specific – it knows what type of object navigationContext is.
  • 29. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point public partial class App : Application { public static MyApplication EnsureMyApplication( Frame navigationContext) { return MyApplication.Instance ?? new MyApplication(new MyNavigator(), navigationContext); } void Application_Launching(…) { EnsureMyApplication(RootFrame).ContinueToItemList( skipNavigation: true); } void Application_Activated(…) { EnsureMyApplication(RootFrame); } } The entry point is platform specific (navigationContext, here a WP Frame) and creates platform specific service instances, such as the Navigator.
  • 30. ViewModel • Properties • Commands • INotifyPropertyChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point class MyNavigator : IMyNavigator { void Navigate(object navigationContext, string uri) { ((Frame)navigationContext).Navigate( new Uri(uri, UriKind.Relative)); } void NavigateToMyView(object navigationContext) { Navigate(navigationContext, "/MyView.xaml"); } … } The navigator is platform specific (navigationContext, here a WP Frame).
  • 31. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 32. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 33. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 34. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 35. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 36. ViewModel • Properties • Commands • INotifyPropertyChanged, INotifyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 37. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 38. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 39. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2
  • 40. ViewModel • Properties • Commands • INotifyPropertyChanged, INoti fyCollectionChanged Model • Entities (POCO) ServiceAgent • Service Entities • Service Events • Service Methods Application • ViewModels instance • Navigation context • Navigation transitions View • Markup • Data binding code (if not supported in markup) • UI Manipulation Code Navigator • Navigate to view implementation Entry Point Runtime flow: Application starts with AuctionView, user places bid and navigates to CheckoutView. 1. Entrypoint is called, creates Navigator and Application instances. 2. Application ctor creates ServiceAgent and AuctionViewModel + ProductsViewModel 3. Entry Point calls MyApplication.Instance.NavigateToAuctionView() 4. Navigator calls platform-specific navigate to AuctionView 5. View class gets ViewModel from Application.Instance 6. On platforms without data binding, the view subscribes itself to PropertyChanged on ViewModel, for select (groups of) properties (it is not necessary to bind to each individual property). Also the commands of the views are invoked from code in an event handler. 7. The viewmodel is updated by events from service and commands from view. The view updates w data binding. 8. A command on a viewmodel can invoke the ContinueTo… method on application … continue with step 3. 1 2 3 4 5 6 78 2