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
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
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)
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
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
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);
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