Compiled Experience Windows Platform Development http://compiledexperience.com en Fri, 20 Jan 2017 09:35:50 +0000 Fri, 20 Jan 2017 09:35:50 +0000 Customising Pluralisation in Caliburn.Micro <p>Caliburn.Micro uses pluralisation in it’s conventions. It’s what turns an <code class="highlighter-rouge">x:Name</code> of <code class="highlighter-rouge">Products</code> into bindings of the <code class="highlighter-rouge">Products</code> and <code class="highlighter-rouge">SelectedProduct</code> properties.</p> <p>To be more accurate Caliburn.Micro uses Singularisation, and it’s implementation is rather naive that certainly don’t cope with the variety the english language provides, let alone other languages.</p> <p>It’s current implementation is:</p> <div class="language-csharp highlighter-rouge"><pre class="highlight"><code><span class="k">public</span> <span class="k">static</span> <span class="n">Func</span><span class="p">&lt;</span><span class="kt">string</span><span class="p">,</span> <span class="kt">string</span><span class="p">&gt;</span> <span class="n">Singularize</span> <span class="p">=</span> <span class="n">original</span> <span class="p">=&gt;</span> <span class="p">{</span> <span class="k">return</span> <span class="n">original</span><span class="p">.</span><span class="nf">EndsWith</span><span class="p">(</span><span class="s">"ies"</span><span class="p">)</span> <span class="p">?</span> <span class="n">original</span><span class="p">.</span><span class="nf">TrimEnd</span><span class="p">(</span><span class="sc">'s'</span><span class="p">).</span><span class="nf">TrimEnd</span><span class="p">(</span><span class="sc">'e'</span><span class="p">).</span><span class="nf">TrimEnd</span><span class="p">(</span><span class="sc">'i'</span><span class="p">)</span> <span class="p">+</span> <span class="s">"y"</span> <span class="p">:</span> <span class="n">original</span><span class="p">.</span><span class="nf">TrimEnd</span><span class="p">(</span><span class="sc">'s'</span><span class="p">);</span> <span class="p">};</span> </code></pre> </div> <p>There are however some fanstasic libraries out there to deal with manipulating language in this way, and Caliburn.Micro can be updated to use them. I’m talking in particular about the library <a href="https://github.com/Humanizr/Humanizer">Humanizer</a>.</p> <p>Having the following in our application configure code switches the framework to use Humanizer for it’s conventions and be able to deal with all the property names it couldn’t deal with before.</p> <div class="language-csharp highlighter-rouge"><pre class="highlight"><code><span class="n">ConventionManager</span><span class="p">.</span><span class="n">Singularize</span> <span class="p">=</span> <span class="n">original</span> <span class="p">=&gt;</span> <span class="n">original</span><span class="p">.</span><span class="nf">Singularize</span><span class="p">(</span><span class="n">inputIsKnownToBePlural</span><span class="p">:</span> <span class="k">false</span><span class="p">);</span> </code></pre> </div> Fri, 20 Jan 2017 00:00:00 +0000 http://compiledexperience.com/blog/posts/customising-pluralisation http://compiledexperience.com/blog/posts/customising-pluralisation nigel.sampson@compiledexperience.com (Nigel Sampson) NDC Sydney Video <p>Forgot to post about it at the time, but the video for talk <a href="https://www.youtube.com/watch?v=x266Vy4tfT0">Cross Platform Mobile with XAML and MVVM</a> from NDC Sydney is available online..</p> <p>All the demos for this talk can be found on <a href="https://github.com/nigel-sampson/talks/tree/master/ndc-sydney">GitHub</a>.</p> Tue, 10 Jan 2017 00:00:00 +0000 http://compiledexperience.com/blog/posts/NDC-Sydney-Video http://compiledexperience.com/blog/posts/NDC-Sydney-Video nigel.sampson@compiledexperience.com (Nigel Sampson) MVP renewed for 2017 <p>Pleased to say that I’ve had my Microsoft MVP renewed for the fourth year.</p> <p>Last year was a reasonably quiet year in terms of activity and I’m certainly looking to step it up this year.</p> <p>Although according to some TED talks announcing goals increase the likelihood of failure, so you’ll just have to wait and see.</p> Mon, 09 Jan 2017 00:00:00 +0000 http://compiledexperience.com/blog/posts/2017-MVP http://compiledexperience.com/blog/posts/2017-MVP nigel.sampson@compiledexperience.com (Nigel Sampson) My new cross platform setup <p>These days I’m doing more cross platform mobile work at home and decided to try a new approach.</p> <p>I’m using a Mac Mini for iOS / Xamarin work but having a dedicated monitor for it felt wasteful since it wasn’t used that often (it mostly functioned as a built server).</p> <p>I’ve been hearing people lately raving about ultra wide screen monitors and thought I’d give it a go.</p> <p>I picked up a <a href="http://accessories.ap.dell.com/sna/productdetail.aspx?c=hk&amp;l=en&amp;s=bsd&amp;cs=hkbsd1&amp;sku=210-AEBV">Dell U3415W</a> and so far am in love with it. While doing Windows &amp; Android development I can give the full screen real estate to Windows, the Dell Display Manager that comes with the monitor lets me set up custom snap points for my windows. So far the one I like the best is two thirds for Visual Studio, then divide the rest of the horizontal space in two vertically for things like Powershell, emulators and the like. The total available resolution is 3440 x 1440.</p> <p>Where it really steps up is doing iOS / Xamarin development, I can switch on Picture by Picture mode giving half the screen to the Windows machine and half to the Mac. The Windows machine is using HDMI and the Mac Display Port. This gives each device 1720 x 1440 to play with which is plenty.</p> <p><a href="/content/images/posts/cross-platform-setup.jpg"><img width="600" src="/content/images/posts/cross-platform-setup.jpg" /></a></p> <p>Installing <a href="http://symless.com/">Synergy</a> on both machines means I can use the same mouse and keyboard for both including copy &amp; pasting. The whole thing is so seamless I occasionally find myself trying to drag windows from one side to the other.</p> <p>It’s only been a few weeks so far but at the moment I can highly recommend it.</p> Sat, 28 May 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/cross-platform-setup http://compiledexperience.com/blog/posts/cross-platform-setup nigel.sampson@compiledexperience.com (Nigel Sampson) Speaking at NDC Sydney <p>Blown away to say that I’ll be speaking this upcoming August at <a href="http://ndcsydney.com/">NDC Sydney</a> on <a href="http://ndcsydney.com/speaker/nigel-sampson/">Cross Platform Mobile with XAML and MVVM</a>. There’s an awesome <a href="http://ndcsydney.com/speakers/">speakers list</a> so I’m very excited to attend and see a lot of them speak for the first time. Getting this many great speakers in the same event in this part of the world is a rare feat so I’d recommend taking advantage of it and getting <a href="http://ndcsydney.com/page/tickets">your ticket</a> soon!</p> Tue, 17 May 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/ndc-announcement http://compiledexperience.com/blog/posts/ndc-announcement nigel.sampson@compiledexperience.com (Nigel Sampson) Auckland Azure Meetup Slides <p>Last month I did a talk at the <a href="http://www.meetup.com/Auckland-Azure-Lunchtime-Meetup/events/229742916/">Auckland Azure Lunchtime meetup</a>, it covered using Azure Mobile Apps (formerly Mobile Services) to build a cross platform application using Xamarin.</p> <p>You can view the <a href="https://onedrive.live.com/redir?resid=D28A1F0AF33100D0!275407&amp;authkey=!ANlM8bnryckcXig&amp;ithint=file%2cpptx">slides</a> and the <a href="https://github.com/nigel-sampson/talks/tree/master/mobile-services">demos</a> respectively. Building the demos I was pleasantly surprised how easy it was to fit the SDK into my normal MVVM patterns. Often these “backend as a service” SDK’s can be very invasive, but with some well defined interfaces all was well.</p> Fri, 06 May 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/azure-meetup http://compiledexperience.com/blog/posts/azure-meetup nigel.sampson@compiledexperience.com (Nigel Sampson) Xamarin acquisition thoughts <p>Last week it was <a href="https://weblogs.asp.net/scottgu/welcoming-the-xamarin-team-to-microsoft">announced</a> that Microsoft would be acquiring <a href="https://xamarin.com/">Xamarin</a>, the popular toolset for building cross platform mobile apps with C#.</p> <p>I presented a number of talks last year on <a href="http://compiledexperience.com/blog/posts/latest-talks">building cross platforms mobile apps with Xamarin</a> that you can view online.</p> <p>It’s certainly an interesting piece of news, most people expected this to be announced at last year’s Build (or even the year before). Back then there was a school of though that it was better to keep Xamarin as a close partner rather than acquiring them. The belief was that this would better enable Xamarin to work with other <em>“competitors</em>” such as Apple, Google and IBM.</p> <p>I think now in 2016 it makes a lot of sense, the developer pick up of UWP is slow (IMO because there’s currently on one platform with the desktop) and Microsoft need ways to drive more apps to the UWP platform.</p> <p>Last year most of the announcements were around the application bridges, Astora, Centennial, Islandwood and Windsor (Android, Classic Windows, iOS and Web) as a way to bring more apps into the store (and hopefully the platform as well). Since the Astoria has been cancelled, we haven’t see much of Centennial but Islandwood is looking really good.</p> <p>This strategy didn’t make themselves popular with a lot of Windows developers who thought these technologies would render them obsolete (a line of thought I didn’t wholly agree with).</p> <p>Microsoft appears to be positioning themselves quite nicely in the cross platform cloud and developer tools space (I think it’s telling that announcement was on Scott Guthrie’s blog). By having a tool-set where it isn’t about migrating old apps but creating new cross platform apps I think they can better push Windows as a third platform as well as Android and iOS.</p> <p>My thoughts on what may change over the next year or so.</p> <ul> <li>Xamarin subscription to be rolled into MSDN.</li> <li>Test Cloud to be part of Azure.</li> <li>Some people think Xamarin Studio may merge with Visual Studio Code, I doubt that. We may see the end of Xamarin Studio with efforts focussed on Visual Studio.</li> <li>Android Player to be deprecated in favour of Visual Studio Android Emulator.</li> <li>Hopefully better support for the Windows platforms in Xamarin.Forms, the default renderers are terrible.</li> <li>Xamarin Insights to be merged with Application Insights / HockeyApp.</li> </ul> <p>Looking forward to what will be announced at Build, sadly will be missing this year though.</p> Tue, 01 Mar 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/xamarin-acquisition http://compiledexperience.com/blog/posts/xamarin-acquisition nigel.sampson@compiledexperience.com (Nigel Sampson) Caliburn.Micro 3.0.0 <p>After a <strong>prolonged</strong> period in beta <a href="http://caliburnmicro.com/announcements/3.0.0">Caliburn.Micro 3.0.0</a> has just been pushed to nuget.</p> <p>This release stuck around in beta a lot longer than I wanted, mostly due to a series of overlapping circumstances. Some issue comes up where it wouldn’t make sense to release till it has been resolved, by that time another has cropped up. This is pretty normal for most projects but when only some of the issues are under your control it becomes very frustrating.</p> <p>I’m really glad <a href="https://xamarin.com/forms">Xamarin.Forms</a> made it into this release, it’s not fully featured without programmatic access to <code class="highlighter-rouge">x:Name</code> but it’s still a great story. The idea we can have a view model that is able to be used across all mobile platforms and even older desktop platforms such as WPF at the same time is really compelling.</p> <p>Check out the full <a href="http://caliburnmicro.com/announcements/3.0.0">announcement</a> for the full details for the release.</p> Tue, 01 Mar 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/caliburn.micro-3.0.0 http://compiledexperience.com/blog/posts/caliburn.micro-3.0.0 nigel.sampson@compiledexperience.com (Nigel Sampson) Why won't my Jekyll post appear? <p>On February 2nd GitHub Pages (which hosts this website) announced they were <a href="https://github.com/blog/2100-github-pages-now-faster-and-simpler-with-jekyll-3-0">now running with Jekyll 3.0.0</a> and there were a few changes required mostly around the standardisation on the <a href="http://kramdown.gettalong.org/">kramdown</a> Markdown engine.</p> <p>This morning writing the <a href="http://compiledexperience.com/blog/posts/behaviors-1.1.0">UWP XAML Behaviors 1.1.0 released</a> post I ran into a problem where no matter what I did the post wouldn’t show. Other changes to the site were being generated correctly and I wasn’t receiving an error email from GitHub so I was reasonably stumped.</p> <p>Whenever I write a post I tend to date it with local time which depending on the time of day could be a day ahead of the server which hasn’t been a problem till now.</p> <p>In Jekyll 2.x future posts would be published by default, in 3.x they will not, this is outlined in the <a href="http://jekyllrb.com/docs/upgrading/2-to-3/#future-posts">Upgrading from 2.x to 3.x</a> documentation.</p> <p>In the end I solved this by adding the following to <code class="highlighter-rouge">_config.yml</code>.</p> <div class="highlighter-rouge"><pre class="highlight"><code>future: true </code></pre> </div> <p>I could have also solved this by setting the timezone in configuration as well.</p> <p>Hope this helps someone.</p> Wed, 24 Feb 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/jekyll-future-posts http://compiledexperience.com/blog/posts/jekyll-future-posts nigel.sampson@compiledexperience.com (Nigel Sampson) UWP XAML Behaviors 1.1.0 released <p>Last year I had the privledge of being invited onto the project committee for <a href="https://blogs.windows.com/buildingapps/2015/11/30/xaml-behaviors-open-source-and-on-uwp/">newly open sourced XAML behaviors</a> project.</p> <p>Yesterday the <code class="highlighter-rouge">1.1.0</code> version of the package was released to <a href="https://www.nuget.org/packages/Microsoft.Xaml.Behaviors.Uwp.Managed/">nuget</a>. This fixed a <a href="https://github.com/Microsoft/XamlBehaviors/issues/55">nasty bug</a> in <code class="highlighter-rouge">EventTriggerBehavior</code> that was causing it to not correctly unsubscribe from the event on detach.</p> <p>This bug was holding up <code class="highlighter-rouge">3.0.0</code> final of Caliburn.Micro so I’m now looking at rolling out a release soon.</p> <p>If you’re looking to contribute to UWP XAML Behaviors the project is located on <a href="https://github.com/Microsoft/XamlBehaviors">Github</a>.</p> Wed, 24 Feb 2016 00:00:00 +0000 http://compiledexperience.com/blog/posts/behaviors-1.1.0 http://compiledexperience.com/blog/posts/behaviors-1.1.0 nigel.sampson@compiledexperience.com (Nigel Sampson)