Coding4Fun toolkit 2.1.0 released #WinRT #wpdev #windev

c4f

This is the 3rd iteration of toolkit updates I am pushing out. Like the other 2, this one builds on Windows Runtime WinRT app support for Windows Platform development.

This release also brings WinRT support close to what Silverlight version supported and finally drops support for Silverlight apps. The SL version is still available on nuget but it is unlikely to receive any updates.

SuperSlider (ColorSlider + ColorPicker) has a gotcha and its gonna need some clever work. Internally it uses code that monitors movement for updates and movements to prevent scrolling when the control is contained within Pivot, Hub or FlipView containers however lack of Touch class has forced me to use PointerPressed / PointerMoved and PointerReleased for these and in my tests, Pivot does not bubble those events and control doesn’t work correctly. Keep this in mind

Sample apps available in stores will be updated to reflect the changes

258x67_WP_Store_cyan WindowsStore

Control Windows Phone 8.1 Windows 8.1
RoundButton
ToggleButton
OpacityButton
Tile
ImageTile
ChatBubble
ChatBubbleTextBox
ColorHexPicker
ColorPicker
ColorSlider
AboutPrompt ×
InputPrompt ×
MessagePrompt ×
ToastPrompt ×
PasswordInputPrompt ×
MetroFlow
Overlay
SuperSlider
SuperImage

Happy coding

Coding4Fun v2.0.9 released #wpdev #windev #winrt

Coding4Fun toolkit v2.0.9 for Windows Platform dev has been released and packages are available for download from Nuget.

This update builds additional support for Windows Runtime on Windows Phone 8.1 and Windows 8.1. Controls added to this release include

  • MetroFlow control (Windows 8.1 and WP 8.1)
  • Prompts (Toast, User, Message, Input, PasswordInput) for WP 8.1
  • BrushToBrushConverter now allows use of parameter to set output Opacity.

AppBarPrompt requires additional work the port wasn’t successful first time around. For issues there’s codeplex.

Happy coding

Lumia 735 – the affordable windows phone

A month back I really needed a device with Windows Phone Navigation Bar.. talking to @Connects team, they asked if I’d like to do a comparison of say 735 vs 830. I used the device for over 2 weeks and it was great. Aside from the occasional yearning for the 830.

1Shot_20141113_090348 1Shot_20141113_090307 1Shot_20141113_090214 1Shot_20141113_090553

The device closely resembles the first Nokia Windows Phone 7 device – the Lumia 800. Its very light and the one I received was green. This device comes with wireless charging back cover as you can see and despite that its very light. When wireless charging, the circuit does not make noise unlike the 830 which was rather annoying

Like all 2nd gen devices, it takes nano sim and setup took the usual time and I was up and running. The 735 ships with Denim firmware

Lumia 73x specs

  • Snapdragon s400 same as 830
  • 1GB RAM
  • SD Expansion slot
  • Nano SIM
  • 4.7 inch 720p display with navigation bar
  • 6.7 MP rear and 5 MP front camera
  • Collapsible Navigation Bar instead of Back / Home / Search button
  • No Camera button

Spec wise 735 is nearly identical to 830 – the major difference is the camera.. The rear camera is 6.7 MP as opposed to 10MP for 830 however.. front camera is 5MP unlike 1.2 MP for 830

So this rightly comes with the best selfie camera in the entire Lumia range. The device like 830 stays nice and cool.. battery last the entire day.. no complains there.. I took many pictures with this device and occasionally I could see 6.7MP rear camera as a weak point oh. Lack of camera button meant that one hand photography was out of question. Here are some pictures taken using my 1Shot camera app. It does a decent job covering some foggy nights and walks around Cheshunt

1Shot_20141129_222134 1Shot_20141129_155355 1Shot_20141129_150726 1Shot_20141129_150713 1Shot_20141129_144520 1Shot_20141129_144028 1Shot_20141119_152802 1Shot_20141119_135147

I missed the hardware camera button. The capacitive buttons not being around was actually kinda nice.. seriously though put in a 10MP rear camera module and a physical camera button and its a winner.

Oh did I mention that its about £100 cheaper when you compare it to 830 ?

WinRT and application view wide Pointer event monitoring #wpdev #windev

It seems like every year I go through same technical difficulties. Last year I blogged about WinRT and pointer manipulation #win8dev #winrtdev

One of the underlying classes detects manipulation by user by means of Touch class. This class never made it to WinRT XAML and I have been messing around for a few days now… until something finally sunk in..

CoreWindow exposes following events

PointerEntered Occurs when a pointer moves into the bounding box of the Windows Store app.
PointerExited Occurs when the pointer moves outside the bounding box of the Windows Store app.
PointerMoved Occurs when a pointer moves within the bounding box of the Windows Store app.
PointerPressed Occurs when a mouse button is clicked, or a touch or pen contact is detected, within the bounding rectangle of the Windows Store app.
PointerReleased Occurs when a mouse button is released, or a touch or pen contact is lifted, within the bounding rectangle of the Windows Store app.

These events work exactly like Touch.TouchFrameReported and get bubbled up no matter which UIElement is tapped.

Time to continue porting

Coding4Fun v2.0.8 released on Nuget #wpdev #win8dev

Earlier this week I mentioned that I was working on a release of Coding4Fun toolkit. It has now achieved parity with Windows 8.1 version (which was somehow never released).

As of now, a stable release v2.0.8 is now available. The changes include

  • Support for Windows 8.1
  • Support for Windows Phone 8.1 (WinRT app not SL8.1)
  • WP8 Silverlight continues to be supported as before
  • Dropped WP7 and Windows 8

In addition to Coding4Fun.Toolkit.Audio and Coding4Fun.Toolkit.Storage which is supported in both Win8.1 and WP8.1, the Coding4Fun.Toolkit.Control has the following controls

  • Tile
  • SuperImage
  • ImageTile
  • ColorHexagonPicker
  • ChatBubble
  • ChatBubbleTextBox
  • RoundButton
  • RoundToggleButton
  • OpacityToggleButton

The source as usual is on http://coding4fun.codeplex.com, packages are on Nuget

Support for Windows Phone 8.1 WinRT for Coding4Fun

Earlier this year, I took the responsibility of ensuring that  Coding4Fun toolkit supported Windows Runtime apps on Windows Phone 8.1. I spent a good part of March / April porting major chunks of code without porting XAML.

Occasionally I was reminded of the pending work by both Clint Rutkas and others, namely Glenn Versweyveld. After another round this week, I decided to take advantage of the quiet time I am having to push this through.

I have created a fork of coding4fun repo on codeplex and so far this is what i have done

  • Coding4Fun.Toolkit updated to support universal apps (Win8.1 and WP8.1)
  • Coding4Fun.Toolkit.Audio updated to support universal apps (Win8.1 and WP8.1)
  • Coding4Fun.Toolkit.Storage updated to support universal apps.
  • Created Coding4Fun.Toolkit.Controls project to explicitly support WP8.1
  • Added Tile, ImageTile, SuperImage, ColorHexagonPicker, BubbleChat & BubbleChatTextBox controls

Once parity with existing Win8.1 lib has been achieved, the next version of toolkit will be released on Nuget.

WindowsPhone 8.1, NavigationBar and Silverlight apps #wpdev

With Windows Phone 8.1 Microsoft drastically changed on of the basic chassis requirements in Windows Phone since day 0. The hardware buttons at the bottom of the phone. There were many reasons and one of them was the ability to use same chassis for both Android and Windows Phone devices. This many cited was very important smaller OEMs that recently signed up to Windows Phone ecosystem.

WP7 resolutions:

  • 800 x 480

WP8 resolutions (and scaling factors as reported  by Silverlight apps):

  • 800 x 480     (1.0)
  • 1280 x 720   (1.5)
  • 1280 x 768   (1.6)
  • 1920 x 1080 (2.25)

For Silverlight Windows Phone app (most of the apps that is) the resolution defaults to 800 x 480. This fits nicely with Scaling factor 1.6 which was used by many early Nokia devices. The scaling factor 1.5 however gave 853 x 480. This primarily affected HTC 8 S/X devices and Samsung ATIV S devices only. Later when Lumia 1520 came out, it uses 1020 and that used 2.25 and that also had 853 x 480 res.

What this meant was that WP7 and any WP8 apps that fix their resolution would leave 53 px gap. With my 1Shot camera app, I have a complicated control structure and I ended up fixing many heights and widths.. Not only that I also move certain objects on OrientationChanged using specific values of TranslateX and TranslateY. Last week after a user complaint, I added code to detect 720p and 1080p resolutions and to stretch those by additional 53px. However I never tested this on newer 720p devices that no longer have hardware buttons.

What Windows Phone Dev team did was added another system control like ApplicationBar called NavigationBar. Unlike ApplicationBar, NavigationBar isn’t accessible from within application. Playing with emulator set to show NavigationBar did not show any change in size reported by

double width = Application.Current.Host.Content.ActualWidth;
double height = Application.Current.Host.Content.ActualHeight;

After much complaining around twitter I came across windows phone 8.1 hide NavigationBar post on MSDN Forums. One of the suggestions was using PhoneApplicationFrame.FullScreen. Setting it to true or false made no difference.. none at all. After another round of complains, I came across this post Layout and the Windows Phone navigation bar.. it suggest that SizeChanged event should take care of it and ActualWidth and ActualHeight properties will sort it out.

Being not particularly clever, I thought that Page’s SizeChanged would be fired.. sure it was firing but ActualWidth and ActualHeight were 0.0. Width and Height were NaN so that was useless. Thinking that I could do better than that, I tried using SizeChanged exposed by Application.Current.Host.Content.. nope no difference.. it wasn’t a particularly bright idea.. Yesterday I spent time deliberating whether I should use hardcoded lists to indicate NavigationBar availability or not.. I already do so for high resolution sensors.. nah too much hassle

So today I said.. surely there must be something… on SizeChanged event handler of page, I scanned App.RootFrame.. I found something.. a private field called _visibleRegion correctly showed that 53 px at the botton were not available on 720p emulator when NavigationBar was visible. I think I am clever than most…

private Thickness GetMargin()
{
    Thickness t = new Thickness();

    var field = App.RootFrame.GetType().GetField("_visibleRegion", BindingFlags.Instance | BindingFlags.NonPublic);

    if (field != null)
    {
        object visibleRegion = field.GetValue(App.RootFrame);

        if (visibleRegion != null && visibleRegion is Thickness)
        {
            t = (Thickness)visibleRegion;
        }
    }

    return t;
}

This would get me the right margin and I could just just correct a few bits and bingo.. hahah yah right.. FieldAccessExpcetion eat that you clever git.. Apps don’t run under full trust on phone and I couldn’t reflect to this level. Sigh.. This was hard.. why had Windows Phone team gone way out of their way to piss developers off ?? Having almost lost all hope, I thought, let me try subscribe to Page’s LayoutRoot grid’s SizeChanged event… had a look there.. event handler exposed NewValue and they showed the correct values!!! yay

double gridWidth = e.NewSize.Width > e.NewSize.Height ? e.NewSize.Width : e.NewSize.Height;
double gridHeight = e.NewSize.Width > e.NewSize.Height ? e.NewSize.Height : e.NewSize.Width;

double w = Application.Current.Host.Content.ActualWidth;
double h = Application.Current.Host.Content.ActualHeight;
double hostWidth = w > h ? w : h;
double hostHeight = w > h ? h : w;

bool hasSoftButtons = hostWidth > gridWidth;

Just for your sanity.. I always want Landscape mode so width is always greater than height based on supported resolutions.. so there you have it.. subscribe to LayoutRoot’s SizeChanged and get the right size.. OnResize, the dimensions reflect 800 x 480 resolution and not 853 x 480.

Finally!