SlideShare a Scribd company logo
Windows Store app using XAML and
C#: Enterprise Product Development
What beyond POCs ?!

                       Mahmoud Hamed
                       ITWorx

patterns & practices Symposium 2013
Mahmoud   mahmoud.hamed@itworx.com       @mhamedmahmoud



Hamed
                                     http://eg.linkedin.com/in/mah
            dev.mhamed@gmail.com     moudhamedmahmoud
This presentation is based on a presentation
by p&p team at pattern & practices
symposium 2013 with updates to reflect my
own experience
Tips for building a Windows Store app using
XAML and C#: The Kona project




patterns & practices Symposium 2013
Why I need this session can I live
without it ??????!




patterns & practices Symposium 2013
Agenda

         
The Kona Project
Demo Kona Project
Build and Test a Windows Store App Using Team
Foundation Build
A. Build Windows Store App Using Team Foundation Build
http://msdn.microsoft.com/en-us/library/hh691189.aspx

B. Walkthrough: Creating and Running Unit Tests for Windows Store Apps
http://msdn.microsoft.com/en-us/library/hh440545.aspx

C. Validating an app package in automated builds (Windows Store apps)
Windows Store app certification
http://msdn.microsoft.com/en-us/library/windows/apps/hh994667.aspx

D. TFS 2012 Express (5 user per server)
http://www.microsoft.com/visualstudio/eng/products/visual-studio-team-foundation-
server-express#product-express-tfs-requirements
Demo TFS 2012 and Windows Store
Apps
Windows Phone vs Windows Store app

 Windows Phone apps                       Windows Store apps

 Deactivate/Tombstoned/Reactivate         Suspend/Terminate/Resume

 Microsoft Push Notification Service      Windows Push Notification Service
 (MPN)                                    (WNS)
 Windows Phone Marketplace certification Windows Store app certification &
                                         Application Excellence Review (AER)
 App manifest declares capabilities       App manifest declares capabilities
Push Notification requires Windows Store registration
                        •   Make sure to register your app
                            with the Windows Store to get
                            proper credentials (SID &
                            secret key)
                        •   Purely sideloaded apps won’t
                            be able to receive notifications
                            from Windows Notification
                            Service (WNS)
Globalization



         <ToolTip
             x:Uid=“PreviewCartoonizeAppBarButtonToolTip”
             Content=“Preview Cartoonization”
             … />
Globalization
A. Globalizing your app
http://msdn.microsoft.com/en-us/library/windows/apps/hh465006.aspx

B. How to use the Multilingual App Toolkit
http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj572370.aspx

C. Application resources and localization sample
http://code.msdn.microsoft.com/windowsapps/Application-resources-and-
cd0c6eaa
Demo Windows Store Apps
Globalization
Logging
Logging Sample for Windows Store Apps (ETW Logging in WinRT)
http://code.msdn.microsoft.com/windowsapps/Logging-Sample-for-
Windows-0b9dffd7

MetroLog Overview
MetroLog is a lightweight logging framework designed for Windows Store
and Windows Phone 8 apps
https://github.com/mbrit/MetroLog
Demo Windows Store Apps Logging
async & await are your friends
1: async Task<int> AccessTheWebAsync()
2: {
3:     HttpClient client = new HttpClient();
4:     Task<string> getStringTask = client.GetStringAsync("http://msdn.microsoft.com");
5:     DoIndependentWork();
6:
7:     string urlContents = await getStringTask;
8:     return urlContents.Length;
9: }
Model-View-ViewModel Pattern
From MVC to MVVM


               DataBinding   Commands   Services
                                        Messages




                                          Events
ViewModel  View




                                   Behaviour
                       Binding




Loose coupling, more flexibility
Behavior is highly Blendable
ViewModel  View (Win8)
No behaviors in Windows 8
 Workaround: Use properties and binding
 PropertyChanged event

                     Binding




                   PropertyChanged
Focus on AttachedBehaviors
•   No Blend Behavior<T>
•   No BindingExpressions
•   Break out your
    AttachedBehavior
    experience and
    ROCK ON!
View services

                        ISelectFilesService


            injection
MVVM Light
Use BindableBase class to provide
INPC
public abstract class BindableBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;

    protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
    {
        if (object.Equals(storage, value)) return false;
        storage = value;
        this.OnPropertyChanged(propertyName);
        return true;
    }
    protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
    {
        var eventHandler = this.PropertyChanged;
        if (eventHandler != null)
        {
            eventHandler(this, new PropertyChangedEventArgs(propertyName));
        }
    }
}
Commanding vs ViewModel Method
Invocation
ICommand:
       void Execute(object)
       bool CanExecute(object)
       event EventHandler CanExecuteChanged
Command Invoker:
       ButtonBase
-----------------------------------------------------
Event -> Action
Use DelegateCommand for controls that
support ICommand
View:
<Button Content=“Go to shopping cart”
 Command="{Binding ShoppingCartNavigationCommand}" />

ViewModel:
ShoppingCartNavigationCommand = new
DelegateCommand(NavigateToShoppingCartPage,
           CanNavigateToShoppingCartPage);

ShoppingCartNavigationCommand.RaiseCanExecuteChanged();
Use AttachedBehaviors and Actions for
the rest
View:
<GridView x:Name="itemGridView“
       ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}"
       ItemTemplate="{StaticResource KonaRI250x250ItemTemplate}"
       SelectionMode="None“ IsItemClickEnabled="True"
       behaviors:ListViewItemClickedToAction.Action=
              "{Binding CategoryNavigationAction}">

ViewModel:
CategoryNavigationAction = NavigateToCategory;
Use the Kona ViewModelLocator
• Convention based lookup
• Ability to override convention with exceptions to
  rule
• Can leverage container to instantiate
  ViewModels.
Decoupled Eventing
            • Hollywood Parent style UI
              Composition (user control)
            • Child control needs to listen
              to events raised by long
              lived services but no way to
              unhook…

            • Ported Prism
              EventAggregator
Use EventAggregator when
necessary
public SubscriberViewModel(IEventAggregator eventAggregator)
{
    eventAggregator.GetEvent<ShoppingCartUpdatedEvent>()
           .Subscribe(s => UpdateItemCountAsync());
}

public PublisherViewModel(IEventAggregator eventAggregator)
{
    _eventAggregator = eventAggregator;
}

_eventAggregator.GetEvent<ShoppingCartUpdatedEvent>()
           .Publish(string.Empty);
Navigation: View or ViewModel First
View First:
this.Frame.Navigate(typeof(ItemDetailPage), itemId);


ViewModel First:
Var itemDetailPageViewModel = new ItemDetailPageViewModel(…)
                            { ItemId = itemId };
navigationService.Navigate(itemDetailPageViewModel);
Pages and Navigation
Use the LayoutAwarePage class to provide
  navigation, state management, and visual state
  management
Navigation support
         protected virtual void GoHome(object sender, RoutedEventArgs e)
         protected virtual void GoBack(object sender, RoutedEventArgs e)
         protected virtual void GoForward(object sender, RoutedEventArgs e)
Visual state switching
         public void StartLayoutUpdates(object sender, RoutedEventArgs e)
         public void StopLayoutUpdates(object sender, RoutedEventArgs e)
Process lifetime management
         protected override void OnNavigatedTo(NavigationEventArgs e)
         protected override void OnNavigatedFrom(NavigationEventArgs e)
         protected virtual void LoadState(Object navigationParameter,
                                                Dictionary<String, Object> pageState)
         protected virtual void SaveState(Dictionary<String, Object> pageState)
Navigation & Visual State Support
XAML:
<Button Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}"
         Style="{StaticResource BackButtonStyle}"/>


<UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates">
LoadState & SaveState: SuspensionManager
protected override void SaveState(System.Collections.Generic.Dictionary<string, object> pageState)
{
    var virtualizingStackPanel =
                      VisualTreeUtilities.GetVisualChild<VirtualizingStackPanel>(itemGridView);
    if (virtualizingStackPanel != null && pageState != null)
    {
        pageState["virtualizingStackPanelHorizontalOffset"] = virtualizingStackPanel.HorizontalOffset;
    }
}


protected override void LoadState(object navigationParameter,
                                       System.Collections.Generic.Dictionary<string, object> pageState)
{
    if (pageState != null && pageState.ContainsKey("virtualizingStackPanelHorizontalOffset"))
    {
        double.TryParse(pageState["virtualizingStackPanelHorizontalOffset"].ToString(),
                        out virtualizingStackPanelHorizontalOffset);
    }
}
Support visual state for landscape, portrait, fill, and
snap
<VisualStateManager.VisualStateGroups>
   <VisualStateGroup x:Name="ApplicationViewStates">
       <VisualState x:Name="FullScreenLandscape"/>
       <VisualState x:Name="Filled"/>
       <VisualState x:Name="FullScreenPortrait">
            <Storyboard>   ...   </Storyboard>
        </VisualState>
        <VisualState x:Name="Snapped">
            <Storyboard>   ...   </Storyboard>
        </VisualState>
    </VisualStateGroup>
</VisualStateManager.VisualStateGroups>
Typical Validation in
    WPF/Silverlight
•   Implement INotifyDataErrorInfo
•   UI controls bind to errors dictionary if
    NotifyOnValidationError=True

<TextBox Text="{Binding Id, Mode=TwoWay, ValidatesOnExceptions=True,
NotifyOnValidationError=True}"/>
Use Kona BindableValidator
View:
<TextBox
       Text="{Binding Address.FirstName, Mode=TwoWay}"
       behaviors:HighlightFormFieldOnErrors.PropertyErrors="{Binding
Errors[FirstName]}" />


ViewModel:
_bindableValidator = new BindableValidator(_address);


public BindableValidator Errors
{
    get { return _bindableValidator; }
}
Suspend, Resume, and Terminate
15. Use Kona RestorableStateAttribute and MVVM
framework
public class MyViewModel : ViewModel, INavigationAware
{
        private string _name;

       [RestorableState]
         public string Name
       {
           get { return _name; }
           set { SetProperty(ref _name, value); }
       }
}


       Symposium 2013
Unit Testing nicely integrated into VS2012
WP7: Jeff Wilcox's Silverlight Unit Test Framework
• Tests run in emulator or device

Unit Test Library (Windows Store apps)
• Run and debug from IDE
• Can run tests from command line and export as trx format.

<ItemGroup>
      <TestAppPackages Include="$(MSBuildProjectDirectory)..Source***.appx" />
</ItemGroup>

<Target Name="Test">
      <Exec ContinueOnError="true" Command="vstest.console.exe /InIsolation /logger:trx
%(TestAppPackages.Identity)" />
</Target>
File System

 Local Data (SQLite)

 Roaming Data

 Hi Priority Roaming Data

 Password Vault

       Symposium 2013
Final Tips
 Read Windows 8 SDK
   http://msdn.microsoft.com/library/windows/apps/
 Watch Some videos
   Channel 9: Windows Camps
       http://channel9.msdn.com/Events/Windows-Camp
   Channel 9: Windows tag
       http://channel9.msdn.com/Tags/windows+8
   Pluralsight windows 8 series
       http://www.pluralsight.com/training/Courses#windows-8


      Symposium 2013
Thanks!


 http://konaguidance.codeplex.com




      Symposium 2013

More Related Content

What's hot

Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limitsDroidcon Berlin
 
MVVM & Data Binding Library
MVVM & Data Binding Library MVVM & Data Binding Library
MVVM & Data Binding Library
10Clouds
 
AngularJS in 60ish Minutes
AngularJS in 60ish MinutesAngularJS in 60ish Minutes
AngularJS in 60ish Minutes
Dan Wahlin
 
Deep dive into Android Data Binding
Deep dive into Android Data BindingDeep dive into Android Data Binding
Deep dive into Android Data Binding
Radek Piekarz
 
Data Binding in Action using MVVM pattern
Data Binding in Action using MVVM patternData Binding in Action using MVVM pattern
Data Binding in Action using MVVM pattern
Fabio Collini
 
Fixing Magento Core for Better Performance - Ivan Chepurnyi
Fixing Magento Core for Better Performance - Ivan ChepurnyiFixing Magento Core for Better Performance - Ivan Chepurnyi
Fixing Magento Core for Better Performance - Ivan Chepurnyi
Meet Magento Spain
 
ASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 Validation
Eyal Vardi
 
Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8
Peter Lehto
 
GWT integration with Vaadin
GWT integration with VaadinGWT integration with Vaadin
GWT integration with Vaadin
Peter Lehto
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
Ivan Chepurnyi
 
Techlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with VaadinTechlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with Vaadin
Peter Lehto
 
Android 3
Android 3Android 3
Android 3
Robert Cooper
 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todaygerbille
 
Gdg san diego android 11 meetups what's new in android - ui and dev tools
Gdg san diego android 11 meetups  what's new in android  - ui and dev toolsGdg san diego android 11 meetups  what's new in android  - ui and dev tools
Gdg san diego android 11 meetups what's new in android - ui and dev tools
Svetlin Stanchev
 
Best Practices for Magento Debugging
Best Practices for Magento Debugging Best Practices for Magento Debugging
Best Practices for Magento Debugging
varien
 
Building Testable Reactive Apps with MVI
Building Testable Reactive Apps with MVIBuilding Testable Reactive Apps with MVI
Building Testable Reactive Apps with MVI
James Shvarts
 
Application Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The UglyApplication Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The Ugly
Richard Lord
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
TrevorBurnham
 
ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013
Mathias Seguy
 

What's hot (20)

droidparts
droidpartsdroidparts
droidparts
 
Android programming -_pushing_the_limits
Android programming -_pushing_the_limitsAndroid programming -_pushing_the_limits
Android programming -_pushing_the_limits
 
MVVM & Data Binding Library
MVVM & Data Binding Library MVVM & Data Binding Library
MVVM & Data Binding Library
 
AngularJS in 60ish Minutes
AngularJS in 60ish MinutesAngularJS in 60ish Minutes
AngularJS in 60ish Minutes
 
Deep dive into Android Data Binding
Deep dive into Android Data BindingDeep dive into Android Data Binding
Deep dive into Android Data Binding
 
Data Binding in Action using MVVM pattern
Data Binding in Action using MVVM patternData Binding in Action using MVVM pattern
Data Binding in Action using MVVM pattern
 
Fixing Magento Core for Better Performance - Ivan Chepurnyi
Fixing Magento Core for Better Performance - Ivan ChepurnyiFixing Magento Core for Better Performance - Ivan Chepurnyi
Fixing Magento Core for Better Performance - Ivan Chepurnyi
 
ASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 ValidationASP.NET MVC 3.0 Validation
ASP.NET MVC 3.0 Validation
 
Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8Vaadin DevDay 2017 - Data Binding in Vaadin 8
Vaadin DevDay 2017 - Data Binding in Vaadin 8
 
GWT integration with Vaadin
GWT integration with VaadinGWT integration with Vaadin
GWT integration with Vaadin
 
Magento Indexes
Magento IndexesMagento Indexes
Magento Indexes
 
Techlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with VaadinTechlunch - Dependency Injection with Vaadin
Techlunch - Dependency Injection with Vaadin
 
Android 3
Android 3Android 3
Android 3
 
Creating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of todayCreating the interfaces of the future with the APIs of today
Creating the interfaces of the future with the APIs of today
 
Gdg san diego android 11 meetups what's new in android - ui and dev tools
Gdg san diego android 11 meetups  what's new in android  - ui and dev toolsGdg san diego android 11 meetups  what's new in android  - ui and dev tools
Gdg san diego android 11 meetups what's new in android - ui and dev tools
 
Best Practices for Magento Debugging
Best Practices for Magento Debugging Best Practices for Magento Debugging
Best Practices for Magento Debugging
 
Building Testable Reactive Apps with MVI
Building Testable Reactive Apps with MVIBuilding Testable Reactive Apps with MVI
Building Testable Reactive Apps with MVI
 
Application Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The UglyApplication Frameworks - The Good, The Bad & The Ugly
Application Frameworks - The Good, The Bad & The Ugly
 
Sane Async Patterns
Sane Async PatternsSane Async Patterns
Sane Async Patterns
 
ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013ProTips DroidCon Paris 2013
ProTips DroidCon Paris 2013
 

Similar to Windows Store app using XAML and C#: Enterprise Product Development

Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
IMC Institute
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
Software Park Thailand
 
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter LehtoJavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
HUJAK - Hrvatska udruga Java korisnika / Croatian Java User Association
 
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Barry Gervin
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
Sami Ekblad
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
goodfriday
 
The WebView Role in Hybrid Applications
The WebView Role in Hybrid ApplicationsThe WebView Role in Hybrid Applications
The WebView Role in Hybrid Applications
Haim Michael
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
IMC Institute
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
mharkus
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDK
Brendan Lim
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
Nataliya Patsovska
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWAREFIWARE
 
Asp.Net MVC Framework Design Pattern
Asp.Net MVC Framework Design PatternAsp.Net MVC Framework Design Pattern
Asp.Net MVC Framework Design Pattern
maddinapudi
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QA
Ted Drake
 
Dialogs in Android MVVM (14.11.2019)
Dialogs in Android MVVM (14.11.2019)Dialogs in Android MVVM (14.11.2019)
Dialogs in Android MVVM (14.11.2019)
Vladislav Ermolin
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMohammad Shaker
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015
Pushkar Chivate
 
Windows Store apps - Lessons Learned
Windows Store apps - Lessons LearnedWindows Store apps - Lessons Learned
Windows Store apps - Lessons Learned
chribben
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
Walid Ashraf
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WAREFermin Galan
 

Similar to Windows Store app using XAML and C#: Enterprise Product Development (20)

Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web ToolkitJava Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
Java Web Programming on Google Cloud Platform [3/3] : Google Web Toolkit
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter LehtoJavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
JavaCro'14 - Building interactive web applications with Vaadin – Peter Lehto
 
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Developing ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller PatternDeveloping ASP.NET Applications Using the Model View Controller Pattern
Developing ASP.NET Applications Using the Model View Controller Pattern
 
The WebView Role in Hybrid Applications
The WebView Role in Hybrid ApplicationsThe WebView Role in Hybrid Applications
The WebView Role in Hybrid Applications
 
Java Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAXJava Web Programming [8/9] : JSF and AJAX
Java Web Programming [8/9] : JSF and AJAX
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
Introduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDKIntroduction to Palm's Mojo SDK
Introduction to Palm's Mojo SDK
 
Declarative presentations UIKonf
Declarative presentations UIKonfDeclarative presentations UIKonf
Declarative presentations UIKonf
 
Developing your first application using FIWARE
Developing your first application using FIWAREDeveloping your first application using FIWARE
Developing your first application using FIWARE
 
Asp.Net MVC Framework Design Pattern
Asp.Net MVC Framework Design PatternAsp.Net MVC Framework Design Pattern
Asp.Net MVC Framework Design Pattern
 
Android accessibility for developers and QA
Android accessibility for developers and QAAndroid accessibility for developers and QA
Android accessibility for developers and QA
 
Dialogs in Android MVVM (14.11.2019)
Dialogs in Android MVVM (14.11.2019)Dialogs in Android MVVM (14.11.2019)
Dialogs in Android MVVM (14.11.2019)
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 
SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015SharePoint Saturday Atlanta 2015
SharePoint Saturday Atlanta 2015
 
Windows Store apps - Lessons Learned
Windows Store apps - Lessons LearnedWindows Store apps - Lessons Learned
Windows Store apps - Lessons Learned
 
Lab #2: Introduction to Javascript
Lab #2: Introduction to JavascriptLab #2: Introduction to Javascript
Lab #2: Introduction to Javascript
 
Developing your first application using FI-WARE
Developing your first application using FI-WAREDeveloping your first application using FI-WARE
Developing your first application using FI-WARE
 

More from Mahmoud Hamed Mahmoud

Build & Ignite Cloud Notes
Build & Ignite Cloud NotesBuild & Ignite Cloud Notes
Build & Ignite Cloud Notes
Mahmoud Hamed Mahmoud
 
Office 365 Development Overview
Office 365 Development OverviewOffice 365 Development Overview
Office 365 Development Overview
Mahmoud Hamed Mahmoud
 
SharePoint and .NET Advanced Troubleshooting and Debugging
SharePoint and .NET Advanced Troubleshooting and DebuggingSharePoint and .NET Advanced Troubleshooting and Debugging
SharePoint and .NET Advanced Troubleshooting and Debugging
Mahmoud Hamed Mahmoud
 
Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...
Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...
Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...
Mahmoud Hamed Mahmoud
 
Windows azure infrastructure services and share point 2013 farm case study
Windows azure infrastructure services and share point 2013 farm case studyWindows azure infrastructure services and share point 2013 farm case study
Windows azure infrastructure services and share point 2013 farm case study
Mahmoud Hamed Mahmoud
 
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Mahmoud Hamed Mahmoud
 
What's new in SharePoint Server 2013 (End user - Admin – Developer)
What's new in SharePoint Server 2013 (End user - Admin – Developer)What's new in SharePoint Server 2013 (End user - Admin – Developer)
What's new in SharePoint Server 2013 (End user - Admin – Developer)
Mahmoud Hamed Mahmoud
 

More from Mahmoud Hamed Mahmoud (7)

Build & Ignite Cloud Notes
Build & Ignite Cloud NotesBuild & Ignite Cloud Notes
Build & Ignite Cloud Notes
 
Office 365 Development Overview
Office 365 Development OverviewOffice 365 Development Overview
Office 365 Development Overview
 
SharePoint and .NET Advanced Troubleshooting and Debugging
SharePoint and .NET Advanced Troubleshooting and DebuggingSharePoint and .NET Advanced Troubleshooting and Debugging
SharePoint and .NET Advanced Troubleshooting and Debugging
 
Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...
Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...
Exam 70-489 Developing Microsoft SharePoint Server 2013 Advanced Solutions Le...
 
Windows azure infrastructure services and share point 2013 farm case study
Windows azure infrastructure services and share point 2013 farm case studyWindows azure infrastructure services and share point 2013 farm case study
Windows azure infrastructure services and share point 2013 farm case study
 
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
Exam 70-488 Developing Microsoft SharePoint Server 2013 Core Solutions Learni...
 
What's new in SharePoint Server 2013 (End user - Admin – Developer)
What's new in SharePoint Server 2013 (End user - Admin – Developer)What's new in SharePoint Server 2013 (End user - Admin – Developer)
What's new in SharePoint Server 2013 (End user - Admin – Developer)
 

Recently uploaded

Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Tobias Schneck
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 

Recently uploaded (20)

Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 

Windows Store app using XAML and C#: Enterprise Product Development

  • 1. Windows Store app using XAML and C#: Enterprise Product Development What beyond POCs ?! Mahmoud Hamed ITWorx patterns & practices Symposium 2013
  • 2. Mahmoud mahmoud.hamed@itworx.com @mhamedmahmoud Hamed http://eg.linkedin.com/in/mah dev.mhamed@gmail.com moudhamedmahmoud
  • 3. This presentation is based on a presentation by p&p team at pattern & practices symposium 2013 with updates to reflect my own experience Tips for building a Windows Store app using XAML and C#: The Kona project patterns & practices Symposium 2013
  • 4. Why I need this session can I live without it ??????! patterns & practices Symposium 2013
  • 5. Agenda
  • 8.
  • 9.
  • 10. Build and Test a Windows Store App Using Team Foundation Build A. Build Windows Store App Using Team Foundation Build http://msdn.microsoft.com/en-us/library/hh691189.aspx B. Walkthrough: Creating and Running Unit Tests for Windows Store Apps http://msdn.microsoft.com/en-us/library/hh440545.aspx C. Validating an app package in automated builds (Windows Store apps) Windows Store app certification http://msdn.microsoft.com/en-us/library/windows/apps/hh994667.aspx D. TFS 2012 Express (5 user per server) http://www.microsoft.com/visualstudio/eng/products/visual-studio-team-foundation- server-express#product-express-tfs-requirements
  • 11. Demo TFS 2012 and Windows Store Apps
  • 12. Windows Phone vs Windows Store app Windows Phone apps Windows Store apps Deactivate/Tombstoned/Reactivate Suspend/Terminate/Resume Microsoft Push Notification Service Windows Push Notification Service (MPN) (WNS) Windows Phone Marketplace certification Windows Store app certification & Application Excellence Review (AER) App manifest declares capabilities App manifest declares capabilities
  • 13. Push Notification requires Windows Store registration • Make sure to register your app with the Windows Store to get proper credentials (SID & secret key) • Purely sideloaded apps won’t be able to receive notifications from Windows Notification Service (WNS)
  • 14. Globalization <ToolTip x:Uid=“PreviewCartoonizeAppBarButtonToolTip” Content=“Preview Cartoonization” … />
  • 15. Globalization A. Globalizing your app http://msdn.microsoft.com/en-us/library/windows/apps/hh465006.aspx B. How to use the Multilingual App Toolkit http://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj572370.aspx C. Application resources and localization sample http://code.msdn.microsoft.com/windowsapps/Application-resources-and- cd0c6eaa
  • 16. Demo Windows Store Apps Globalization
  • 17. Logging Logging Sample for Windows Store Apps (ETW Logging in WinRT) http://code.msdn.microsoft.com/windowsapps/Logging-Sample-for- Windows-0b9dffd7 MetroLog Overview MetroLog is a lightweight logging framework designed for Windows Store and Windows Phone 8 apps https://github.com/mbrit/MetroLog
  • 18. Demo Windows Store Apps Logging
  • 19. async & await are your friends 1: async Task<int> AccessTheWebAsync() 2: { 3: HttpClient client = new HttpClient(); 4: Task<string> getStringTask = client.GetStringAsync("http://msdn.microsoft.com"); 5: DoIndependentWork(); 6: 7: string urlContents = await getStringTask; 8: return urlContents.Length; 9: }
  • 21. From MVC to MVVM DataBinding Commands Services Messages Events
  • 22. ViewModel  View Behaviour Binding Loose coupling, more flexibility Behavior is highly Blendable
  • 23. ViewModel  View (Win8) No behaviors in Windows 8  Workaround: Use properties and binding  PropertyChanged event Binding PropertyChanged
  • 24. Focus on AttachedBehaviors • No Blend Behavior<T> • No BindingExpressions • Break out your AttachedBehavior experience and ROCK ON!
  • 25. View services ISelectFilesService injection
  • 27.
  • 28. Use BindableBase class to provide INPC public abstract class BindableBase : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null) { if (object.Equals(storage, value)) return false; storage = value; this.OnPropertyChanged(propertyName); return true; } protected void OnPropertyChanged([CallerMemberName] string propertyName = null) { var eventHandler = this.PropertyChanged; if (eventHandler != null) { eventHandler(this, new PropertyChangedEventArgs(propertyName)); } } }
  • 29. Commanding vs ViewModel Method Invocation ICommand: void Execute(object) bool CanExecute(object) event EventHandler CanExecuteChanged Command Invoker: ButtonBase ----------------------------------------------------- Event -> Action
  • 30. Use DelegateCommand for controls that support ICommand View: <Button Content=“Go to shopping cart” Command="{Binding ShoppingCartNavigationCommand}" /> ViewModel: ShoppingCartNavigationCommand = new DelegateCommand(NavigateToShoppingCartPage, CanNavigateToShoppingCartPage); ShoppingCartNavigationCommand.RaiseCanExecuteChanged();
  • 31. Use AttachedBehaviors and Actions for the rest View: <GridView x:Name="itemGridView“ ItemsSource="{Binding Source={StaticResource groupedItemsViewSource}}" ItemTemplate="{StaticResource KonaRI250x250ItemTemplate}" SelectionMode="None“ IsItemClickEnabled="True" behaviors:ListViewItemClickedToAction.Action= "{Binding CategoryNavigationAction}"> ViewModel: CategoryNavigationAction = NavigateToCategory;
  • 32. Use the Kona ViewModelLocator • Convention based lookup • Ability to override convention with exceptions to rule • Can leverage container to instantiate ViewModels.
  • 33. Decoupled Eventing • Hollywood Parent style UI Composition (user control) • Child control needs to listen to events raised by long lived services but no way to unhook… • Ported Prism EventAggregator
  • 34. Use EventAggregator when necessary public SubscriberViewModel(IEventAggregator eventAggregator) { eventAggregator.GetEvent<ShoppingCartUpdatedEvent>() .Subscribe(s => UpdateItemCountAsync()); } public PublisherViewModel(IEventAggregator eventAggregator) { _eventAggregator = eventAggregator; } _eventAggregator.GetEvent<ShoppingCartUpdatedEvent>() .Publish(string.Empty);
  • 35. Navigation: View or ViewModel First View First: this.Frame.Navigate(typeof(ItemDetailPage), itemId); ViewModel First: Var itemDetailPageViewModel = new ItemDetailPageViewModel(…) { ItemId = itemId }; navigationService.Navigate(itemDetailPageViewModel);
  • 36.
  • 38. Use the LayoutAwarePage class to provide navigation, state management, and visual state management Navigation support protected virtual void GoHome(object sender, RoutedEventArgs e) protected virtual void GoBack(object sender, RoutedEventArgs e) protected virtual void GoForward(object sender, RoutedEventArgs e) Visual state switching public void StartLayoutUpdates(object sender, RoutedEventArgs e) public void StopLayoutUpdates(object sender, RoutedEventArgs e) Process lifetime management protected override void OnNavigatedTo(NavigationEventArgs e) protected override void OnNavigatedFrom(NavigationEventArgs e) protected virtual void LoadState(Object navigationParameter, Dictionary<String, Object> pageState) protected virtual void SaveState(Dictionary<String, Object> pageState)
  • 39. Navigation & Visual State Support XAML: <Button Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/> <UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates">
  • 40. LoadState & SaveState: SuspensionManager protected override void SaveState(System.Collections.Generic.Dictionary<string, object> pageState) { var virtualizingStackPanel = VisualTreeUtilities.GetVisualChild<VirtualizingStackPanel>(itemGridView); if (virtualizingStackPanel != null && pageState != null) { pageState["virtualizingStackPanelHorizontalOffset"] = virtualizingStackPanel.HorizontalOffset; } } protected override void LoadState(object navigationParameter, System.Collections.Generic.Dictionary<string, object> pageState) { if (pageState != null && pageState.ContainsKey("virtualizingStackPanelHorizontalOffset")) { double.TryParse(pageState["virtualizingStackPanelHorizontalOffset"].ToString(), out virtualizingStackPanelHorizontalOffset); } }
  • 41. Support visual state for landscape, portrait, fill, and snap <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="ApplicationViewStates"> <VisualState x:Name="FullScreenLandscape"/> <VisualState x:Name="Filled"/> <VisualState x:Name="FullScreenPortrait"> <Storyboard> ... </Storyboard> </VisualState> <VisualState x:Name="Snapped"> <Storyboard> ... </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups>
  • 42. Typical Validation in WPF/Silverlight • Implement INotifyDataErrorInfo • UI controls bind to errors dictionary if NotifyOnValidationError=True <TextBox Text="{Binding Id, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>
  • 43. Use Kona BindableValidator View: <TextBox Text="{Binding Address.FirstName, Mode=TwoWay}" behaviors:HighlightFormFieldOnErrors.PropertyErrors="{Binding Errors[FirstName]}" /> ViewModel: _bindableValidator = new BindableValidator(_address); public BindableValidator Errors { get { return _bindableValidator; } }
  • 44. Suspend, Resume, and Terminate
  • 45. 15. Use Kona RestorableStateAttribute and MVVM framework public class MyViewModel : ViewModel, INavigationAware { private string _name; [RestorableState] public string Name { get { return _name; } set { SetProperty(ref _name, value); } } } Symposium 2013
  • 46. Unit Testing nicely integrated into VS2012 WP7: Jeff Wilcox's Silverlight Unit Test Framework • Tests run in emulator or device Unit Test Library (Windows Store apps) • Run and debug from IDE • Can run tests from command line and export as trx format. <ItemGroup> <TestAppPackages Include="$(MSBuildProjectDirectory)..Source***.appx" /> </ItemGroup> <Target Name="Test"> <Exec ContinueOnError="true" Command="vstest.console.exe /InIsolation /logger:trx %(TestAppPackages.Identity)" /> </Target>
  • 47. File System  Local Data (SQLite)  Roaming Data  Hi Priority Roaming Data  Password Vault Symposium 2013
  • 48. Final Tips  Read Windows 8 SDK  http://msdn.microsoft.com/library/windows/apps/  Watch Some videos  Channel 9: Windows Camps  http://channel9.msdn.com/Events/Windows-Camp  Channel 9: Windows tag  http://channel9.msdn.com/Tags/windows+8  Pluralsight windows 8 series  http://www.pluralsight.com/training/Courses#windows-8 Symposium 2013

Editor's Notes

  1. Line of Business emphasis…
  2. ExplainSideLoaded
  3. Don’t need command enablement….