Thursday, November 17, 2016

Did Microsoft just make Tizen more important than Windows Mobile?

No.
Well, probably not.

Let me back up for a minute.
This week, at their Connect event, Microsoft announced the Visual Studio Tools for Tizen.
If you're not familiar with Tizen that might not mean anything to you. I know there are a lot of Windows fan[boy]s who read my blog and so for you: Tizen is an operating system created by Samsung. It's had a varied history being used on some phones as well as in watches, TVs, and more. It's generally assumed to have been created as a response to Android with a view to allowing Samsung to control the whole experience on their phones but has had limited success on phones. (Launching an entire mobile ecosystem--apps, services, etc.--is hard.)
I seem to recall claims of it having been killed off at least a couple of times but it's still going strong. It's going so strong it claims to be installed on 50 million devices!

Microsoft providing tools to develop apps for this OS makes sense given Satya's (and Microsoft's) aim to provide tooling for:
any app, any OS, any dev
At the event where this was launched, there was no talk of Windows 10 Mobile. Can we read anything into this? Of course, people will read all sorts of things into this but there's no real news about this.

Just because Windows 10 Mobile wasn't mentioned doesn't mean it's gone/going away. It means there's nothing to announce right now.

This announcement enables those already building with C# to more easily create apps for Tizen devices. Or anyone already with a separate codebase for Tizen apps to combine/aggregate their code.

Think of the mobile version of Windows 10 being in a holding pattern right now.
It's just waiting for great things in the future. I suspect that the speed of hardware development is a big (but not the only) issue holding things back in terms of being able to differentiate mobile devices. I saw some early research about the aims of continuum and what it will enable but current hardware costs and capabilities still don't make this possible.
Let's see what (else?) the future brings...


Thursday, November 10, 2016

Using a Surface Dial to scroll through a playing track

So, I'm very impressed with the new Surface Dial. It's smaller than I was expecting but feels really nice to use. Plus it's easy to program!

Official links are here. Or see the sample I put together below.
Instructions on pairing: https://www.microsoft.com/surface/en-us/support/getting-started/meet-surface-studio-surface-dial
Coding instructions: https://msdn.microsoft.com/en-us/windows/uwp/input-and-devices/windows-wheel-interactions
Official sample: https://github.com/Microsoft/Windows-universal-samples/tree/b78d95134ce2d57c848e0a8dc339fc362748fb9c/Samples/RadialController

Yes, it's an ugly app but I wanted to see how easy it would be to use it to skip back and forwards through a playing track. I'll often be listening to podcasts and skip back a little bit to have something repeated. I thought this would be a suitable tool for such a task.

It's a simple app.

  • Pick a track and it starts playing.
  • Tap the dial to toggle pause and playback.
  • Scroll the dial to move forwards and backward through the track.
  • There's also a button to toggle playback and a visualization of how far through the track it is.
Point of note:

  • It's possible to automatically select the (radial) menu item but I couldn't get it to set in the page constructor, OnNavigatedTo event, or the Loaded event. Because it's tied to the window (so different apps can have different menu items selected) I can understand why it needs a window available but I would have thought this possible in the Loaded event. Instead, I set this when a track is picked in my code.

There's lots more that can be done with the dial. Including:

  • Handling velocity of scrolling
  • Haptic feedback
  • Placement on screen (but I'll need a Surface Studio for that)


Code embedded below and at https://gist.github.com/mrlacey/892d178f01e622b82bfb901c836f116b#file-mediadial-xaml



Other SurfaceDial projects to check out:
https://github.com/LanceMcCarthy/DialInVideoEffects

Tuesday, November 08, 2016

Defining DEBUG only content in XAML

For a number of applications I've worked on, I've had content in the UI that should only be included in specific builds. Usually, I do this for the debug build but I've also done this for specific test builds too.
I've added text to make it clear that it's a specific build and I've also used this for accessing test specific content such as secret menus for impacting connectivity or for enabling test datasets.
Previously I've done this by adding named controls in the UI and then using the code-behind on the page to hide or show the content as appropriate. It's not been ideal but it's worked.
I've wanted something that was XAML only but never come up with anything appropriate. I'd looked at adding scripts at build time to control what was included based on properties or extensions in the markup but that wasn't great either.
In looking at how Xamarin.Forms works I came up with another idea.

It lets me have an app that looks like this in release mode
and like this in debug

Amazingly it's all configured in XAML
and changing the build config in VS causes the designer preview to update too.

And it only took a tiny amount of code.
enjoy.

***UPDATE***
But what about performance?

I don't think I use this enough to be concerned about the cost of having a simple extra control in the visual tree, but it's worth a little thought.
It turns out there's a simple way to achieve the same result with less code and without leaving invisible controls on the tree.
It's still not a perfect solution as this still leaves an empty content presenter lying around and does mean a line of code is executed in release builds but I think this is the best that's possible with a single code file.

Sunday, November 06, 2016

Context defined in vowels

Just heard a great way of thinking about apps from a high level that is similar to my idea of context.
Consider these terms for each vowel (A, E, I, O, & U).

Activities
Environment
Interactions
Objects
Users

Very similar to:

  • Who is using the app? (and why?)
  • Where and when is the app used?
  • What device is the app running on?



Wednesday, October 19, 2016

Twitter style launch animation in XAML

All this month, I'm taking some time each day to explore (and document) things that are related to UWP development that I haven't fully investigated or used before. While doing it over lunch each day I'm calling it #UWPLunch.

Ok, so this isn't strictly tied to what's new in UWP but it's been a while since I did some animations and copying the launch animation of the Twitter app (on iOS)

The idea is simple.
An image is shown. It decreases in size briefly before growing to fill the whole screen and eventually being replaced by content.
Like this:


The face image is four paths in a canvas (not shown) and the storyboard acting on it looks like this:

<Storyboard x:Name="Storyboard" Completed="StoryboardCompleted">
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleX)" Storyboard.TargetName="canvas">
        <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.8"/>
        <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="20">
            <EasingDoubleKeyFrame.EasingFunction>
                <CubicEase EasingMode="EaseIn"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.ScaleY)" Storyboard.TargetName="canvas">
        <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0.8"/>
        <EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="20">
            <EasingDoubleKeyFrame.EasingFunction>
                <CubicEase EasingMode="EaseIn"/>
            </EasingDoubleKeyFrame.EasingFunction>
        </EasingDoubleKeyFrame>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

Quite simple really.