Martin Suchan – BloQ Random #WPdev stuff

6May/150

tl;dw Build 2015 – Developing Universal Windows Apps in Visual Studio 2015

Another too long; did not watch summary of the Build 2015 session I just watched: Developing Universal Windows Apps in Visual Studio 2015

Developer tools are available now - Visual Studio 2015 RC and Universal Windows App Development Tools

Windows 10 is finally one Universal Windows platform for all device types.

Single project, single package, works across all Windows devices. It's still possible to use separate package for separate platforms, if required.

Supported operating systems for Universal Windows development - Windows 10, Windows 8.1 and Windows 7 too (in VS 2015 RTM, not yet)

Capture

 

Important Windows 10 project properties:

Target Version - highest API version used in the app. Example, if the app uses API from OS version 10.0.10100 and it's known that there is breaking change in this API in Windows 10.0.10250, then this package won't be available on Windows 10.0.10250 and higher until the developer publishes new package for the new API version.

Min Version - min API version required. The package won't be available on Windows with lower OS version than the MinVersion.

Capture

Windows Device Family Extension SDKs - used for accessing platform specific features like phone SIM card features, the vibrator, etc.

Since there is usually only single project and single assembly, it's not possible to use conditional compilation using #if. Solution: Windows.Foundation.Metadata.ApiInformation, reflection-like API for checking if specific type/method/property is available on current device

if (ApiInformation.IsTypePresent("Windows.Phone.UI.HardwareButtons"))
{
    HardwareButtons.BackPressed += HardwareButtons_BackPressed;
}

 

Developers can create custom Extension SDKs. Currently it's possible to reference Windows 8.1 libraries in Windows Universal Apps, either from NuGet o directly. In VS2015 RTM it will be possible to reference Windows Phone 8.1 libraries as well.

App Insights - new analytics framework from Microsoft for monitoring app users, sessions, page views, crashes and real time usage, basically better Flurry Analytics 🙂 It's possible to use custom events for additional telemetry.

How to migrate from Windows/Phone 8.1 to Universal Apps? Typically by creating single new UWP project, using adaptive code for platform specific stuff and platform specific views for different form factors. It's still possible to have one project for tablet and one for phone (or for Xbox, IoT...) and share code using linked files, or using Portable Class Libraries, or using Shared Code project, it's up to developer and the target app.

Windows 10 Samples on GitHub

 

Filed under: WPdev No Comments
5May/150

tl;dw Build 2015 – What’s New in XAML for Universal Windows Apps

Here's my too long; did not watch summary of the Build 2015 session What's New in XAML for Universal Windows Apps that I just seen.

XAML UI is the primary native UI Framework for Windows 10 Apps and Services. Lot of new features were added to it with the same goal  - increase the reach and dev opportunity, reduce the cost to deliver apps and decrease loading time and memory footprint.

When creating new Windows 10 project there is now only one universal Windows project template for all platform or devices.

New Native CalendarView control is now available for developers. Touch Friendly, used in Outlook, Calendar popup when tapping the current date in bottom right corner.

Basic controls were updated to match across all platforms. Context menu is now cascading. On Desktop it can go outside the window, which is nice. When invoked by touch, it's bigger, tailored for the target platform and input type.

When running app on Xbox One overlay rectangles are shown over the active control. It works the way you expect it to work. It runs on Raspberry Pi 2 too, just deployed and it works.

In some controls there were differences between WP and Windows behavior, like in PasswordBox the Show Password icon. In some scenarios both original behaviors were kept with the option to select the right one for your app.

There is both SearchBox and AutoSuggestBox in Windows 10. SearchBox will be likely deprecated in the future.

There is updated Pivot control in Windows 10 that works great on large screens too. Optionally it can work as Tabs too.

New ContentDialog control, like MessageDialog, but you can customize it with your own XAML content.

 

Simplifying Responsive View Development

New SplitView control - basically a navigation affordance, typically used with the Hamburger button in top left corner.

Capture

New AdaptiveTrigger and simplified Setters, no need to use Storyboard + ObjectAnimationUsingKeyFrames + DiscreteObjectKeyFrame just to change single discrete value from A to B.

Capture

RelativePanel - the replacement for common pattern - nested panels. Gives better performance in typical scenarios where nested panels are used in ItemTemplates.

Before, nested Grid and StackPanel.

Capture

After, with RelativePanel

Capture

 

XAML Performance improvements in Windows 10

If you just take your Windows 8.1 app and run it on Windows 10, it runs faster. If you recompile your Windows 8.1 app to Windows 10, it runs even faster!

New Compiled Bindings - {x:Bind} instead of {Binding}, better performance and memory footprint. Compile time property check, support for binding event handlers.

Capture

 

More details about the Bindings improvements in Windows 10: Data Binding: Boost Your Apps' Performance Through New Enhancements to XAML Data Binding

Change notification on all Dependency Properties

PerspectiveTransform3D - Composable 3D Transforms (Effects: 3D Rotations, Parallax)

Windowing - Custom chrome, branding, sizing. Used heavily in the Edge browser, you can use it too.

Ink Canvas - Palm rejection, smoothing, high fidelity

Drag and Drop from Desktop to Store apps

Visual Tree Inspector of a running app

Filed under: WPdev No Comments
4May/150

tl;dw Build 2015 – Design: UX Patterns for Universal Windows Apps

Another too long; did not watch summary of the Build 2015 session I just watched: Design: UX Patterns and Responsive Techniques for Universal Windows Apps

The goal when controls for Windows 10 apps were designed - single API across all types of devices, screen sizes, input options. But each platform should also get tailored UI experience.

Example - specific Context Menu based on input method mouse vs touch:

context

 

Effective pixels - screen sizes are measured in effective pixels that are based on physical screen size, screen resolution and expected distance from the user, keeping the same visual size of elements on all platforms.

effective pixels

 

Breakpoints - when designing your app there are typically three breakpoints when app layout should change from one to another:
320 epx, the minimum default view -> 720 epx, first breakpoint-> 1024 epx, another breakpoint. This is only example, it's up to you how you design your app.

size

 

Example: Mail app

mail

Universal app patterns - each app screen usually consists of three parts: Content, Navigation buttons and Command buttons

Most common navigation patterns, how content/navigation/commands are placed on a screen, observed in real world apps, not just in Windows Store:

Pivot - typically Contacts app. Useful when navigation between set of pages is common task. Avoid controls with horizontal interaction - Map, ToggleButton. No more than 6 pivot items should be used. In Windows 10 it's possible to layout all Pivot items next to each other, useful on large screens.

Tabs - typically Twitter app. Variant of pivots with fixed order tabs on top of the screen. Muscle memory for easy content switching. No more than 5 tabs should be used.

Hub - typically Xbox hub. useful for displaying complex pages, lot of content at the same time. Good for content consumption, not for creation. Works good with touch and gamepad.

Master-detail - typically contact detail. Clear hierarchy of list and master content

Hamburger - typically Office or Mail apps. used for infrequent navigated items, allows more content to be displayed. On large screen could be expanded by default. Hamburger symbol very common and well known among users. Works best when placed top left  according to usability testing.

 

6 R's of responsive content when switching between small and large screen sizes

Resize - when screen gets wider, the content is simply expanded, typically TextBlock

Reflow - similar to Resize, but more columns are added when the screen is wide enough. Easier for large text reading.

Reposition - when screen gets more wide than narrow, content shown previously under the main block is placed on the right of the main block. Great use case for the new RelativePanel control.

Reveal - when the screen is wide enough, additional content block is shown, that was previously hidden or available only on-demand.

Re-architect - similar to Reveal, but panel order is changed when screen is large enough.

Replace - more complex UI change, when the screen get wide enough some controls collapse and some new controls are shown that better suit the new window size.

Filed under: WPdev No Comments
4May/150

tl;dw Build 2015 – Introducing the Windows 10 App Model

After watching the session, here's my too long; did not watch summary of the Build 2015 session Introducing the Windows 10 App Model

What is the Windows App Model? It's a specification of all processes in the app, how it's downloaded from Store, deployed, started, communication with the OS, how the app lifetime works, how the app capabilities and access rights are managed, how the app contracts, data roaming, device usage work, and also how the uninstallation process is handled.

Windows 10 app model is same across all supported platforms: IOT->Mobile->PC->Xbox->Hololens.

It also defines new App Model for Classic Windows Apps installed from Store - this is a new thing in Windows 10. It solves problem with registry growth/fragmentation, clean install and uninstall. WinRT virtualizes registry/disk access and enforces App Model Policy - Denied access to Drivers, NT services, Admin elevation, Shell extension. Allowed access to Full API and desktop app lifecycle.

App installation - never regret installing an app. Possible to install apps on removable storage. Opt out for disabling it. Encrypted app data.

Developer unlock for sideloading apps - now in Settings, can be disabled via Domain politics. Limit 20 apps on mobile, unlimited on PC.

Multitasking - It's about battery and memory. Turn by turn navigation and Always running app now possible.

App resume politics - now always resume. Old resume policy for old WP7-8 apps. When app is resumed devs need to handle navigation to home screen.

App to App API - URL based activation, communication. Foreground to Foreground communication. Foreground to Background Task (App service) communication with sending data and receiving data in response.

Adaptive Tile Templates - same Tile size but different content based on actual tile size.

Action Center - same look and feel shared across all platforms. Alarms and Reminders working again, can be viewed in Action Center. Action Center Change Trigger for updating Live Tiles when notification is removed.

Universal Data Store - global API for Contacts, Calendar, Email, Messaging. Some limited for selected developers right now.

Summary - reliable app installation and uninstallation, more flexible multitasking, unified navigation model, URI based activation/communication, richer tiles and Action Center

 

Filed under: WPdev No Comments
3Apr/150

New API in Windows Phone 8.1 Update 2

Windows Phone 8.1 Update 2 v 8.10.15127 finally arrived as the default OS version on new Microsoft Lumia 640 and 640 XL, and again, there is a new hidden API in it, so let's take a look, if there is anything interesting that we, developers, can use in our apps.

tl;dr The API diff between WP8.1 Update 1 and WP8.1 Update 2 is here on GitHub. Only added/updated Windows.Phone.Notification.Management API - nothing we can use in our apps without special Accessory extension SDK, + new property in PhoneApplicationPage,

29Mar/150

How to fix missing Extension SDKs in Windows 10 Universal Apps

When tools for developing Windows 10 Universal Apps were released couple of days ago I started porting one of my apps to find out, what are the changes and possible issues.
First issue I ran into was that I was unable to add Behaviors SDK to my project - the list of Extension SDKs was almost empty:

In Windows/Phone 8.1 project:

sdk.8.1

In Windows 10 UAP project:

sdk.10

Luckily, there is a workaround, according to Release Notes for the first version of Windows 10 Tools it's necessary to copy the extension SDKs from the Windows 8.1 Extension SDK location to the universal apps location—that is:

From:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs
To:
C:\Program Files (x86)\Microsoft SDKs\UAP\v0.8.0.0\ExtensionSDKs

After restarting Visual Studio 2015 the copied SDKs are then available in the list and you can add it just like before. Done.

22Mar/150

#WPdev Quick tip – API for accessing Windows Store from your app

Following the previous WPdev quick tip how to initiate Email Compose from your app, here is another API that developer often need:

  • Navigate to Rate and Review dialog for the current app - if you want to initiate app rating from the current user
  • Navigate to Windows/Phone Store to the currently running app - if you want the user to purchase full version of current app or upgrade to a new version
  • Navigate to Windows/Phone Store to all apps published by the current developer - if you want to encourage the user to download other of your apps

Unfortunately all these tasks require different type of API in Windows Phone 7.5/8/8.1 Silverlight apps, in Windows 8.1 apps and another one in Windows Phone 8.1 WinRT apps and since I needed all these methods in my recent Windows Universal App NASA TV Live, I decided to put it all into short article for future use, so here it is:

10Mar/150

#WPdev Quick tip – API for sending emails from your app

When developing Windows Phone or Windows Store app it's often useful to give your user option to send you feedback email or feature request. In this short #WPdev article I'll cover all three different approaches you could use in all current Windows Store platforms.

Windows Phone 7, 7.5, 8 and 8.1 (Silverlight)

Sending emails from original Windows Phone 7+ Silverlight apps is done using the EmailComposeTask:

string to = "my@email.cz";
string subject = "Idea for your app";
string body = "Hi, here's an idea for your cool app...";
EmailComposeTask emailTask = new EmailComposeTask
{
 To = to, Subject = subject, Body = body,
 //Cc = , Bcc = , CodePage = ,
};
emailTask.Show();

When the Show method is called the system dialog appears where you can choose the mail account that will be used for sending the email.

As you can see the usage is really simple, one class and one method is all you need. Note there is no way how to send emails with attachments using this API.
Another problem also is that this API is no longer available when developing Windows 8/8.1 or Windows Phone 8.1 WinRT apps. So what is the alternative?

5Jan/150

Windows Phone 8.1 SDK, 9 month later, what’s new

The Windows Phone 8.1 SDK was released with a bang at the beginning of April 2014 and the OS update arrived later that year. It brought lot of new to the Windows Phone ecosystem, but also caused a noticeable disarray to the Windows Phone community and to the community of developers as well. Some features in WP8.1 are definitely great and improving, some are just worrisome, and some features in WP8.1 SDK are simply missing, even though they were in WP8.

Let's take a look on the WP8.1 SDK nine months after the original release, what improvements it brought and also what's still not there.

In this dev article about Windows Phone 8.1 SDK, 9 month later I'll summarize in few bullet points the most interesting features of this OS update and especially what's new for developers.

17Oct/1416

How to deploy your own NuGet server on Azure Website in 15 minutes

Let's imagine this typical scenario: You are an indie developer or a company developing apps in Visual Studio. You have already developed and use several own useful libraries across various projects. Right now you are maintaining each of these libraries in separate Git/TFS repository and adding these libraries as submodules to your projects. Because these libraries are hierarchically dependent one on another, it's quite hard to maintain the dependencies and changes properly. You've thought about packaging these libraries as separate NuGet packages, but adding them to public nuget.org gallery is not an option since these libraries contain private knowhow.

In this article I'll demonstrate, how to deploy your own NuGet Server on free instance of Azure Website, secure it with Basic HTTP Authentication, setup this new server so it can be used from Visual Studio, easily create automatic PowerShell scripts for deploying these libraries as NuGet packages to your server, use these NuGet packages in your projects and also how to achieve all this in just couple of minutes!