Subscribe: Method ~ of ~ failed by Tim Heuer
http://feeds.feedburner.com/timheuer
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
build  creator’s update  design system  file  location  new  public double  public  set public  set  string  system  var tagfile  xaml 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Method ~ of ~ failed by Tim Heuer

Tim Heuer's Blog



The web site and blog of Tim Heuer, Program Manager for Microsoft XAML and author of Callisto, a WinRT XAML Toolkit. A resource to learn how to develop software with XAML technologies. This blog provides information on how to get started with XAML, S



Copyright: Tim Heuer
 



Build 2017 UI Recap

Mon, 15 May 2017 17:29:44 GMT

Well that was fun!  It was really exciting to share with the world what our team has been working on in designing and developing over the past few years with regard to Windows UI platform advancements.  Build 2017 was a culmination of a lot of efforts across the company in various areas, but for UI it was the introduction of our evolution of design, the Fluent Design System.  This represents a wave of UI innovations over time, with Build 2017 showing the first views of Wave 1.  There was a lot of great buzz about Fluent, but for a great introduction be sure to check out my colleague Paul Gusmorino’s session introducing the design system: height="540" src="https://channel9.msdn.com/Events/Build/2017/B8066/player" frameborder="0" width="960" allowfullscreen=""> Of course as developers sometimes we wince at the word ‘design’ because we don’t have the skills, maybe don’t understand it, or want to ensure we can achieve it with maximum ROI of our own developer time!  We agree!  In defining the Fluent Design System, we ensured that a lot of these new innovations are ‘default’ in the platform.  Starting now with the Fall Creator’s Update Insider SDKs you can start seeing some of these appear in the common controls.  When you use the common controls as-is, you will get the best of Fluent incorporated into your app.  James Clarke joined Paul later to explain and demonstrate this in practice showing how the new (and some existing) common controls take this design system into account and help you get it by default: height="540" src="https://channel9.msdn.com/Events/Build/2017/B8034/player" frameborder="0" width="960" allowfullscreen=""> In addition to what we are doing *now* we also wanted to share what is on the horizon.  I was able to join Ashish Shetty at Build and talk about what is new in XAML and Composition platform areas for developers.  We shared more of the ‘default’ that is exhibited in the common controls but also explained some of the ‘possible’ in the platform that you can achieve with great improvements to our animation system.  We also shared the vision for the future in this space around semantic animations and vector shape micro-animations.  Check out our session on this area: height="540" src="https://channel9.msdn.com/Events/Build/2017/B8100/player" frameborder="0" width="960" allowfullscreen=""> We had so much to talk about that I wasn’t able to show the simplicity of enabling the pull-to-refresh pattern in the new controls area.  Not wanting you to feel ripped off, I recorded a quick demo of a few of the things we weren’t able to demo.  Take a look here at my impromptu demo insert for you! height="315" src="https://www.youtube.com/embed/xVWhlXY-loU" frameborder="0" width="560" allowfullscreen=""> There is a lot of great new things coming in the Windows UI platform area for UWP: NavigationView ParallaxView RefreshContainer SwipeContainer TreeView ColorPicker RatingsControl Improved text APIs: CharacterRecieved, CharacterCasing, IsTrimmed Improved input APIs like PreviewInput Implicit animations Connected animations improvements for ListViewBase Advanced color and HDR for Image SVG support for Image Keytips support for XAML ContentDialog and MenuFlyout improvements Context menu support everywhere UI analysis and Edit-and-continue in Visual Studio Narrator developer mode and more! It is so great to be a part of this latest release and continue to deliver value (hopefully) to you, our developer customer.  Please be sure to let us know how you are using these new improvements and the Fluent Design System.  Share your creations with us at @windowsui so we can share with others as well! We also announced a vision for defining a common dialect for UI everywhere around XAML.  We call this XAML Standard and are drafting a v1 specification now.  We will want your input on this and have established an open process to encourage community collaboration.  Please join the conversation at http://aka.ms/xamlstandard.  This is at very early stages but with yo[...]



Implementing a type converter in UWP XAML

Wed, 15 Feb 2017 22:04:24 GMT

Verbose XAML, we all love it right?  What?!  You don’t like writing massive amounts of angle brackets to get to define certain properties?  I mean who doesn’t love something like this: 47.669444 -122.123889 What’s not to love there?  Oh I suppose you prefer something like this? In the XAML dialect this is what we refer to as a ‘type converter’ or more affectionately at times ‘string to thing’ as the declarative markup is just a string representation of some structure.  In WPF and Silverlight this was implemented through requiring to use the System.ComponentModel.TypeConverter class model where you would attribute your class with a pointer to an implementation of TypeConverter that would override the common things you need, most of the time ConvertFrom capabilities. In UWP where we currently could not rely on the exact same implementation of System.ComponentModel.TypeConverter as it is not a part of the API exposure to UWP apps at this time as well as being a .NET concept which wouldn’t be available to other WinRT developers.  In looking at ways to achieve the same primary scenario, we can now look at the Creator’s Update to deliver the functionality for us.  In the markup compiler for Creator’s Update we now leverage the metadata CreateFromString attribute in WinRT to generate the correct metdata to do the conversion.  The responsibility lies in the owner of the class (looking at you ISVs as you update) to add this metadata capabilities. NOTE: To enable this capability, the consuming app must currently have minimum target to the Creator’s Update. Let’s use an example following my pseudo map control I used above.  Here is my class definition for my MyMap control using Windows.UI.Xaml.Controls; namespace CustomControlWithType { public class MyMap : Control { public MyMap() { this.DefaultStyleKey = typeof(MyMap); } public string MapTitle { get; set; } public Location CenterPoint { get; set; } } } Notice it has a Location type.  Here’s the definition of that type: using System; namespace CustomControlWithType { public class Location { public double Latitude { get; set; } public double Longitude { get; set; } public double Altitude { get; set; } } } Now without a type converter I can’t use the ‘string to thing’ concept in markup…I would have to use verbose markup.  Let’s change that and add an attribute to my Location class, and implement the conversion function: using System; namespace CustomControlWithType { [Windows.Foundation.Metadata.CreateFromString(MethodName = "CustomControlWithType.Location.ConvertToLatLong")] public class Location { public double Latitude { get; set; } public double Longitude { get; set; } public double Altitude { get; set; } public static Location ConvertToLatLong(string rawString) { string[] coords = rawString.Split(','); var position = new Location(); position.Latitude = Convert.ToDouble(coords[0]); position.Longitude = Convert.ToDouble(coords[1]); if (coords.Length > 2) { position.Altitude = Convert.ToDouble(coords[2]); } return position; } } } As you can see in the highlighted lines, I added two things.  First I added an attribute to my class to let it know that I have a CreateFromString method and then provided the fully qualified name to that method.  The second obvious thing is to implement that method.  It has to be a public static method and you can see my simple example here. Now when using the MyMap control I can specify the simpler markup: And the result wou[...]



Write your Amazon Alexa Skill using C# on AWS Lambda services

Sat, 24 May 2014 04:51:21 GMT

After a sick day a few weeks ago and writing my first Alexa Skill I’ve been pretty engaged with understanding this voice UI world with Amazon Echo, Google Home and others.  It’s pretty fun to use and as ‘new tech’ it is pretty fun to play around with.  Almost immediately after my skill was certified, I saw this come across my Twitter stream: You can now write your AWS Lambda functions in C#! #reInvent https://t.co/LDOK0S1VwF pic.twitter.com/FpRUODgucv— Amazon Web Services (@awscloud) December 1, 2016 I chuckled but I also knew that David and others were going to be the key to helping me find the fastest path here.  I started emails with the PCL team, including David and Daniel, who are incredibly knowledgeable and responsive.  I finally got most working and then my colleague and I started chatting about my frustrations.  He worked on XLinq for a bit and basically told me to suck it up and do the conversions and that it wasn’t that bad.  We walked through a few of the scenarios and indeed it really ended up all being isolated into one area that I could quickly scan through.  I could now remove my dependency on XmlDocument and have no other dependencies for this portable library. Hooray for helpful people!  Even when you vent, the good peeps will still help out! Changes to TagLib# for portability After the full conversion, a few things remain.  Right now I have #ifdef’d out come of the interfaces and attributes that weren’t working.  Once I get to a point of porting all the tests over, I’ll decide if they are even needed.  Perhaps the biggest change though for users of this lib will be the removal of the default string path of file access.  In discussing with some folks, I could have tried to make a portable storage layer work, but it started to make less sense quickly to do that in the library and leave that simple task to the app developer.  This provides flexibility for the app to do what they want without the library trying to work around how different platforms do their file IO routines.  What that means is that the default way of reading a file’s tags changes from: var tagFile = File.Create("ironlionzion.mp3"); var tags = tagFile.GetTag(TagTypes.Id3v2); string album = tags.Album; to ' file is a StorageFile var fileStream = await file.OpenStreamForReadAsync(); var tagFile = File.Create(new StreamFileAbstraction(file.Name, fileStream, fileStream)); var tags = tagFile.GetTag(TagTypes.Id3v2); string album = tags.Album; in a simple case.  Yes, you as the app author have to write a bit more code, but it puts you in control of ensuring the file location you are reading.  You can see here that I did add my StreamFileAbstraction class to my fork by default, which was the key in the Silverlight port and is actually the key for WinRT as well.  Any app developer can create their own IFileAbstraction implementation and substitute it in the ctor of the create functions and be ready to read.  I actually did this in the test project to re-implement a LocalFileAbstraction for test purposes and used the System.IO.File classes to achieve that, which are available when running VS unit tests. Summary What started out as a frustrating exercise turned out to be helpful for me to better understand PCLs and hopefully add value to those who have been asking for this.  As mentioned, this isn’t fully tested and still a ways to go, so if you use it please log bugs (and help fix them) to complete the implementation.  I won’t be working on this full time of course, but do hope to get the test suite ported over as well.  Here are some relevant links: TagLib.Portable – source code repository for my fork TagLib.Portable NuGet Package Hope this helps! tags: taglib, id3, pcl, winrt, wpdev, silverlight, mp3This work is licensed under a Creative Commons Attribution By license.[...]