<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Invoke IT Limited</title>
	<atom:link href="http://invokeit.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://invokeit.wordpress.com</link>
	<description>Invoke IT Blog</description>
	<lastBuildDate>Tue, 11 Jun 2013 18:19:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='invokeit.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/94405917fe5d92f414dc8d7ba83ce117?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Invoke IT Limited</title>
		<link>http://invokeit.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://invokeit.wordpress.com/osd.xml" title="Invoke IT Limited" />
	<atom:link rel='hub' href='http://invokeit.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Semantic zoom &#8211; beyond the stock behaviour &#8211; #windev #winrt</title>
		<link>http://invokeit.wordpress.com/2013/05/15/semantic-zoom-beyond-the-stock-behaviour-windev-winrt/</link>
		<comments>http://invokeit.wordpress.com/2013/05/15/semantic-zoom-beyond-the-stock-behaviour-windev-winrt/#comments</comments>
		<pubDate>Wed, 15 May 2013 07:55:12 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Metro]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[#win8dev]]></category>
		<category><![CDATA[#winrt]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=947</guid>
		<description><![CDATA[Update: Download a sample implementation from skydrive Last year I was working on Cineworld app for Windows 8. Having use LongListSelector I wanted to ensure that I can transfer the look and feel. However I was fighting multiple battles &#8211; the first one is that while LongListSelector is a single control, SemanticZoom control itself contains [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=947&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Update: <a href="http://sdrv.ms/11de2LG" target="_blank">Download a sample implementation from skydrive</a></p>
<p>Last year I was working on Cineworld app for Windows 8. Having use LongListSelector I wanted to ensure that I can transfer the look and feel. However I was fighting multiple battles &#8211; the first one is that while LongListSelector is a single control, SemanticZoom control itself contains ZoomInView and ZoomedOutView. These are independent of each other and most examples then to show settings data to zoomed in view and then zoomed out view referring to zoomed in view. It gets messy &#8211; maybe I am just slow but it was not intuitive and took me ages.</p>
<p>While mucking around, <a href="http://www.nogginbox.co.uk/blog/gridview-with-inline-group-headers" target="_blank">I came across this post</a> and from there, kept trying till I got what I wanted.</p>
<p><a href="http://invokeit.files.wordpress.com/2013/05/lls1.png"><img class="alignnone size-medium wp-image-949" alt="LLS1" src="http://invokeit.files.wordpress.com/2013/05/lls1.png?w=180&#038;h=300" width="180" height="300" /></a><a href="http://invokeit.files.wordpress.com/2013/05/lls.png"><img class="alignnone size-medium wp-image-948" alt="LLS" src="http://invokeit.files.wordpress.com/2013/05/lls.png?w=180&#038;h=300" width="180" height="300" /></a>  </p>
<p><a href="http://invokeit.files.wordpress.com/2013/05/screenshot-220.png"><img class="alignnone size-medium wp-image-950" alt="Screenshot (220)" src="http://invokeit.files.wordpress.com/2013/05/screenshot-220.png?w=300&#038;h=187" width="300" height="187" /></a> </p>
<p><a href="http://invokeit.files.wordpress.com/2013/05/screenshot-221.png"><img class="alignnone size-medium wp-image-951" alt="Screenshot (221)" src="http://invokeit.files.wordpress.com/2013/05/screenshot-221.png?w=300&#038;h=187" width="300" height="187" /></a></p>
<p>&nbsp;</p>
<pre class="brush: xml; title: ; notranslate">
&lt;Page.Resources&gt;
    &lt;CollectionViewSource x:Name=&quot;cvsFilms&quot; IsSourceGrouped=&quot;true&quot; /&gt;

    &lt;!-- Zoomed out templates and selectors --&gt;
    &lt;DataTemplate x:Key=&quot;GroupTemplate&quot;&gt;
        &lt;Border Margin=&quot;6&quot; Width=&quot;75&quot; Height=&quot;75&quot; Background=&quot;Black&quot; &gt;
            &lt;TextBlock Text=&quot;{Binding Name}&quot; Foreground=&quot;White&quot; FontSize=&quot;32&quot; FontWeight=&quot;Bold&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Center&quot; /&gt;
        &lt;/Border&gt;
    &lt;/DataTemplate&gt;
    &lt;DataTemplate x:Key=&quot;EmptyGroupTemplate&quot;&gt;
        &lt;Border Margin=&quot;6&quot; Width=&quot;75&quot; Height=&quot;75&quot; BorderBrush=&quot;Black&quot; BorderThickness=&quot;1&quot; Background=&quot;LightGray&quot;&gt;
            &lt;TextBlock Text=&quot;{Binding Name}&quot; Foreground=&quot;Black&quot; FontSize=&quot;32&quot; FontWeight=&quot;Bold&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Center&quot; /&gt;
        &lt;/Border&gt;
    &lt;/DataTemplate&gt;
    &lt;local:EmptyOrFullSelector
            x:Key=&quot;FilmGroupEmptyOrFullSelector&quot;
            Empty=&quot;{StaticResource EmptyGroupTemplate}&quot;
            Full=&quot;{StaticResource GroupTemplate}&quot; /&gt;
    &lt;DataTemplate x:Key=&quot;GroupHeaderTemplate&quot;&gt;
        &lt;Border Margin=&quot;20, 20, 0, 0&quot; Width=&quot;75&quot; Height=&quot;75&quot; Background=&quot;Black&quot; Tapped=&quot;Grid_Tapped&quot;&gt;
            &lt;TextBlock Text=&quot;{Binding Key}&quot; Foreground=&quot;White&quot; FontSize=&quot;32&quot; FontWeight=&quot;Bold&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Center&quot; /&gt;
        &lt;/Border&gt;
    &lt;/DataTemplate&gt;
    &lt;DataTemplate x:Key=&quot;GroupItemTemplate&quot;&gt;
        &lt;Border Margin=&quot;14, 20, 0, 0&quot;&gt;
            &lt;Grid Height=&quot;350&quot; Width=&quot;185&quot; Margin=&quot;0&quot;&gt;
                &lt;Grid.RowDefinitions&gt;
                    &lt;RowDefinition Height=&quot;Auto&quot; /&gt;
                    &lt;RowDefinition Height=&quot;*&quot; /&gt;
                &lt;/Grid.RowDefinitions&gt;
                &lt;Image  Source=&quot;{Binding PosterUrl}&quot; Height=&quot;278&quot; Width=&quot;185&quot; VerticalAlignment=&quot;Top&quot; HorizontalAlignment=&quot;Left&quot; Stretch=&quot;UniformToFill&quot;/&gt;
                &lt;TextBlock Grid.Row=&quot;1&quot; TextWrapping=&quot;Wrap&quot; VerticalAlignment=&quot;Top&quot; Text=&quot;{Binding Title}&quot; HorizontalAlignment=&quot;Center&quot; FontFamily=&quot;Segoe UI&quot; /&gt;
            &lt;/Grid&gt;
        &lt;/Border&gt;
    &lt;/DataTemplate&gt;
&lt;/Page.Resources&gt;

&lt;SemanticZoom x:Name=&quot;semanticZoom&quot; Background=&quot;White&quot; HorizontalAlignment=&quot;Stretch&quot; Grid.Row=&quot;1&quot; VerticalAlignment=&quot;Stretch&quot;&gt;
    &lt;SemanticZoom.ZoomedOutView&gt;
        &lt;GridView ScrollViewer.IsHorizontalScrollChainingEnabled=&quot;False&quot; HorizontalAlignment=&quot;Center&quot; ItemTemplateSelector=&quot;{StaticResource FilmGroupEmptyOrFullSelector}&quot; &gt;
            &lt;GridView.ItemsPanel&gt;
                &lt;ItemsPanelTemplate&gt;
                    &lt;WrapGrid Background=&quot;LightGray&quot; MaximumRowsOrColumns=&quot;9&quot; VerticalChildrenAlignment=&quot;Center&quot; Orientation=&quot;Horizontal&quot;/&gt;
                &lt;/ItemsPanelTemplate&gt;
            &lt;/GridView.ItemsPanel&gt;
        &lt;/GridView&gt;
    &lt;/SemanticZoom.ZoomedOutView&gt;
    &lt;SemanticZoom.ZoomedInView&gt;
        &lt;GridView x:Name=&quot;gvZoomedInFilms&quot; ItemsSource=&quot;{Binding Source={StaticResource cvsFilms}}&quot; IsSwipeEnabled=&quot;True&quot; ScrollViewer.IsHorizontalScrollChainingEnabled=&quot;False&quot; ItemTemplate=&quot;{StaticResource GroupItemTemplate}&quot;&gt;
            &lt;GridView.ItemsPanel&gt;
                &lt;ItemsPanelTemplate&gt;
                    &lt;VirtualizingStackPanel Orientation=&quot;Horizontal&quot;/&gt;
                &lt;/ItemsPanelTemplate&gt;
            &lt;/GridView.ItemsPanel&gt;
            &lt;GridView.GroupStyle&gt;
                &lt;GroupStyle HeaderTemplate=&quot;{StaticResource GroupHeaderTemplate}&quot;&gt;
                    &lt;GroupStyle.Panel&gt;
                        &lt;ItemsPanelTemplate&gt;
                            &lt;VariableSizedWrapGrid Orientation=&quot;Vertical&quot; Margin=&quot;0,0,50,0&quot;/&gt;
                        &lt;/ItemsPanelTemplate&gt;
                    &lt;/GroupStyle.Panel&gt;
                &lt;/GroupStyle&gt;
            &lt;/GridView.GroupStyle&gt;
        &lt;/GridView&gt;
    &lt;/SemanticZoom.ZoomedInView&gt;
&lt;/SemanticZoom&gt;
</pre>
<pre class="brush: csharp; title: ; notranslate">
List&lt;GroupInfoList&lt;object&gt;&gt; dataLetter = null;

public ListFilms()
{
    this.InitializeComponent();

    FilmData cd = new FilmData(App.Films);

    dataLetter = cd.GroupsByLetter; 
    cvsFilms.Source = dataLetter;
    gvZoomedInFilms.SelectionChanged -= gvZoomedIn_SelectionChanged;
    gvZoomedInFilms.SelectedItem = null;
    (semanticZoom.ZoomedOutView as ListViewBase).ItemsSource = cd.FilmHeaders;     gvZoomedInFilms.SelectionChanged += gvZoomedIn_SelectionChanged;

    semanticZoom.ViewChangeStarted -= semanticZoom_ViewChangeStarted;
    semanticZoom.ViewChangeStarted += semanticZoom_ViewChangeStarted;
}

void semanticZoom_ViewChangeStarted(object sender, SemanticZoomViewChangedEventArgs e)
{
    if (e.SourceItem == null)
        return;

    if (e.SourceItem.Item.GetType() == typeof(HeaderItem))
    {
        HeaderItem hi = (HeaderItem)e.SourceItem.Item;

        var group = dataLetter.Find(d =&gt; ((char)d.Key) == hi.Name);
        if (group != null)
            e.DestinationItem = new SemanticZoomLocation() { Item = group };
    }
}

// FilmData looks like this
private List&lt;GroupInfoList&lt;object&gt;&gt; groupsByLetter = null;

public List&lt;GroupInfoList&lt;object&gt;&gt; GroupsByLetter
{
    get
    {
        if (groupsByLetter == null)
        {
            groupsByLetter = new List&lt;GroupInfoList&lt;object&gt;&gt;();

            var query = from item in Collection
                        orderby ((FilmInfo)item).Title
                        group item by ((FilmInfo)item).HeaderChar into g
                        select new { GroupName = g.Key, Items = g };

            foreach (var g in query)
            {
                GroupInfoList&lt;object&gt; info = new GroupInfoList&lt;object&gt;();
                info.Key = g.GroupName;
                foreach (var item in g.Items)
                {
                    info.Add(item);
                }
                groupsByLetter.Add(info);
            }
        }

        return groupsByLetter;
    }
}

List&lt;HeaderItem&gt; filmHeaders = null;
public List&lt;HeaderItem&gt; FilmHeaders
{
    get
    {
        if (filmHeaders == null)
        {
            filmHeaders = new List&lt;HeaderItem&gt;();

            char c = '#';

            filmHeaders.Add(new HeaderItem() { Name = '#', IsEnabled = this.GroupsByLetter.Exists(k =&gt; ((char)k.Key) == c) });
                    
            for (int i = 65; i &lt;= 90; i++)
            {
                c = (char)i;

                if (this.GroupsByLetter.Exists(k =&gt; ((char)k.Key) == c))
                    filmHeaders.Add(new HeaderItem() { Name = c, IsEnabled = true });
                else
                    filmHeaders.Add(new HeaderItem() { Name = c, IsEnabled = false });
            }                    
         }

        return filmHeaders;
    }
}
</pre>
<p>I think that&#8217;s about it. Its been 6 months now and I think I am going to change how it looks <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  some stuff will remain as it is, others will have to change</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/947/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/947/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=947&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/05/15/semantic-zoom-beyond-the-stock-behaviour-windev-winrt/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/05/lls1.png?w=180" medium="image">
			<media:title type="html">LLS1</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/05/lls.png?w=180" medium="image">
			<media:title type="html">LLS</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/05/screenshot-220.png?w=300" medium="image">
			<media:title type="html">Screenshot (220)</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/05/screenshot-221.png?w=300" medium="image">
			<media:title type="html">Screenshot (221)</media:title>
		</media:content>
	</item>
		<item>
		<title>FlipTile, CycleTile and various iterations of #wpdev sdks</title>
		<link>http://invokeit.wordpress.com/2013/05/09/fliptile-cycletile-and-various-iterations-of-wpdev-sdks/</link>
		<comments>http://invokeit.wordpress.com/2013/05/09/fliptile-cycletile-and-various-iterations-of-wpdev-sdks/#comments</comments>
		<pubDate>Thu, 09 May 2013 13:53:12 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=939</guid>
		<description><![CDATA[As you might have realised, the last few weeks, cineworld app has been my obsession. I started work on WP8 port and then back-ported some changes to WP7 version of the app (its the only one that&#8217;s live at the moment so makes sense). So what did I do so far on it (WP7 version) [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=939&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As you might have realised, the last few weeks, cineworld app has been my obsession. I started work on WP8 port and then back-ported some changes to WP7 version of the app (its the only one that&#8217;s live at the moment so makes sense). So what did I do so far on it (WP7 version) ?</p>
<p>1) Moved to using 50% space when displaying film posters, moved film little on top of the posters, removed the button style that caused me many xaml exceptions on WP8<br />
2) Moved to using good quality images only for ImageTile control.<br />
3) Added background task to download data files and to set Tile images</p>
<p>This is live as we speak and a few people emailed me saying it looks great. Now I am not going to create yet another background task for WP8 version (since I wanted to use <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207036(v=vs.105).aspx" target="_blank">Cycle Tile Template</a> for WP8 version of the app.<br />
Microsoft&#8217;s own tile related pages <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj720574(v=vs.105).aspx" target="_blank">show how to support newer tiles for WP7.8 and WP8 even though the app itself is built on WP 7.1</a> (Mango) sdk</p>
<p>So far I stayed away from temptation of managing image repository on the device. you can see that it gets messy eventually and you have to clean up and what not.. however after implementing basic solution, it started throwing exceptions.. files used for tiles cannot be remote. Bugger.. more work</p>
<p><strong>Step 1)</strong>: Download image files locally. I have been using <code>AsyncWebClient</code> (Custom wrapper with <code>TaskCompletionSource</code>) exposing awaitable <code>DownloadFile</code> method. Plug that in and download all the files. Its background tasks, I am not really fussed about parallel execution.. just manageable execution (read sync like)</p>
<p><strong>Step 2)</strong>: For Uri array using relative path and ??? still nothing. More work, a quick search about the net found me a couple of posts for &#8220;live tile isolated storage image WP7&#8243; <a href="http://social.msdn.microsoft.com/forums/en-us/wpdevelop/thread/5c1167f8-a134-4e16-8b22-49efc044700c" target="_blank">File Path in Isolated File Storage</a> is the one that I first opened and a quick scan reminded me of &#8220;isostore&#8221; based Uri</p>
<p><strong>Step 3)</strong>: Save all the images to <code>Shell\SharedContent</code> and switch all Uri to use <code>isotore:/Shell/SharedContent/Filename.jpg</code></p>
<p>The code below will help you create live tiles with new tile templates from WP7.1 (Mango) sdk based project. I will be using the same code for WP8 in coming days since its the same background task</p>
<p><strong>A word to the wise</strong>:<br />
* You cannot determine if the template used by Tile is Standard or a new one.<br />
* What I now do is Create a CycleTileData template when user wants to pin (if WP7.8 or WP8) else StandardTileData<br />
* When iterating tiles, I try CycleTileData template and failing that try StandardTileData for update</p>
<p><strong>Code snippets that might help:</strong></p>
<p>Add AppExtra above App element in WMAppManifest.xml file (works for both WP7.8 and WP8)</p>
<pre class="brush: xml; title: ; notranslate">
&lt;AppExtra xmlns=&quot;&quot; AppPlatformVersion=&quot;8.0&quot;&gt;
  &lt;Extra Name=&quot;Tiles&quot;/&gt;
&lt;/AppExtra&gt;
</pre>
<pre class="brush: csharp; title: ; notranslate">
public async Task DownloadFileAsync(string url, string filename, string folder = null)
{
    // create a web client for downloading the string
    var wc = new WebClient();

    try
    {
        IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication();

        string file = (folder == null ? filename : String.Format(&quot;{0}/{1}&quot;, folder, filename));
                
        using (Stream s = await wc.OpenReadTaskAsync(url))
        {
            using (Stream slocal = isf.OpenFile(file, FileMode.Create))
            {
                s.CopyTo(slocal);
            }
        }
    }
    catch (Exception ex)
    {
        if (1 == 1) // just to check exceptions during debugging. do whatever pleases you
        {
        }
    }
}

//works for both WP7.8 and WP8
private static Version TargetedVersion = new Version(7, 10, 8858);
public static bool IsTargetedVersion { get { return Environment.OSVersion.Version &gt;= TargetedVersion; } }

private static void SetTileBackground(string[] filesToShow, string folder, Random random, ShellTile currentTile)
{
    bool tryFlip = false;

    if (Config.IsTargetedVersion)
    {
        try
        {
            Uri smallimage = new Uri(&quot;Images/CycleSmall.png&quot;, UriKind.Relative);
            Uri mediumimage = new Uri(&quot;Images/CycleMedium.png&quot;, UriKind.Relative);

            UpdateCycleTile(smallimage, mediumimage, folder, filesToShow, random, currentTile);
        }
        catch
        {
            tryFlip = true;
        }
    }
    else
        tryFlip = true;
            
    if(tryFlip)
    {
        int rand = random.Next(0, filesToShow.Length);

        StandardTileData NewTileData = new StandardTileData
        {
            BackBackgroundImage = new Uri(String.Format(&quot;isostore:{0}/{1}&quot;, folder, filesToShow[rand]), UriKind.Absolute)
        };

        currentTile.Update(NewTileData);
    }
}

public static void UpdateCycleTile(
    Uri smallBackgroundImage, Uri backgroundImage,
    string folder, string[] filesToShow, Random random, ShellTile currentTile)
{
    // Get the new cycleTileData type.
    Type cycleTileDataType = Type.GetType(&quot;Microsoft.Phone.Shell.CycleTileData, Microsoft.Phone&quot;);

    // Get the ShellTile type so we can call the new version of &quot;Update&quot; that takes the new Tile templates.
    Type shellTileType = Type.GetType(&quot;Microsoft.Phone.Shell.ShellTile, Microsoft.Phone&quot;);

    // Get the constructor for the new FlipTileData class and assign it to our variable to hold the Tile properties.
    var UpdateTileData = cycleTileDataType.GetConstructor(new Type[] { }).Invoke(null);

    // Set the properties. 
    SetProperty(UpdateTileData, &quot;SmallBackgroundImage&quot;, smallBackgroundImage);

    Uri[] mediumImages = new Uri[9];

    mediumImages[0] = backgroundImage;
    for (int i = 1; i &lt; 9; i++)
    {
        int rand = random.Next(filesToShow.Length);

        mediumImages[i] = new Uri(String.Format(&quot;isostore:{0}/{1}&quot;, folder, filesToShow[rand]), UriKind.Absolute);
    }

    SetProperty(UpdateTileData, &quot;CycleImages&quot;, mediumImages);

    SetProperty(UpdateTileData, &quot;Title&quot;, &quot;my cineworld&quot;);
            
    // Invoke the new version of ShellTile.Update.
    shellTileType.GetMethod(&quot;Update&quot;).Invoke(currentTile, new Object[] { UpdateTileData });
}

private static void SetProperty(object instance, string name, object value)
{
    var setMethod = instance.GetType().GetProperty(name).GetSetMethod();
    setMethod.Invoke(instance, new object[] { value });
}

</pre>
<p>This by no means is fine / perfect code. Please treat it as a PoC and do whatever you do normally</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/939/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/939/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=939&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/05/09/fliptile-cycletile-and-various-iterations-of-wpdev-sdks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>
	</item>
		<item>
		<title>Geolocator and MovementThreshold #wpdev #win8dev</title>
		<link>http://invokeit.wordpress.com/2013/05/01/geolocator-and-movementthreshold-wpdev-win8dev/</link>
		<comments>http://invokeit.wordpress.com/2013/05/01/geolocator-and-movementthreshold-wpdev-win8dev/#comments</comments>
		<pubDate>Wed, 01 May 2013 22:37:00 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Windows8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=934</guid>
		<description><![CDATA[Last few months, I have had too much on my plate. Been doing lot to Windows 8 and Phone development. Surprisingly Microsoft UK is keeping tabs on phone developers who aren&#8217;t adapting to #WP8 and seemingly, I was invited to a dev event targeting the likes of me Sure I am going and in anticipation [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=934&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Last few months, I have had too much on my plate. Been doing lot to Windows 8 and Phone development. Surprisingly Microsoft UK is keeping tabs on phone developers who aren&#8217;t adapting to #WP8 and seemingly, I was invited to a dev event targeting the likes of me <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Sure I am going and in anticipation of the event, I decided to port Cineworld app to WP8. Its been a challenging task. Reworking a few bits of LongListSelector, Visual Studio / Blend disliking all the xaml and of course a button style causing xaml exception. If that wasn&#8217;t enough:</p>
<p>Having used <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.devices.geolocation.geolocator.aspx">Geolocator</a> in Windows 8 app, I decided to use the same for WP8 as its usually a lot faster than <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/system.device.location.geocoordinatewatcher(v=vs.105).aspx">GeoCoordinateWatcher</a>. I moved the code to be more like Win8 and noticed that the location detection was flaky at best. Now I did the stupid thing and like in WP7 version, I decided to set both <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.devices.geolocation.geolocator.desiredaccuracy.aspx">DesiredAccuracy</a> to High and <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.devices.geolocation.geolocator.movementthreshold.aspx">MovementThreshold</a> to 0 thinking absolutely nothing.</p>
<p>Of course that didn&#8217;t help it, it made matters worse, instead of flaky behaviour, it decided to call it quits.</p>
<pre class="brush: csharp; title: ; notranslate">
var pos = await locator.GetGeopositionAsync(TimeSpan.FromMinutes(5), TimeSpan.FromSeconds(2));
</pre>
<p>instead of timing out, it started to hang. In desperation, I started looking at other events exposed by this class and tried hooking into <a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/windows.devices.geolocation.geolocator.statuschanged.aspx">StatusChanged</a> event. Now things were bad, I noticed that it was getting operation aborted exception and decided that something was seriously wrong and that I should take a nap instead <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Of course the problem was still there when I woke up the next day <img src='http://s2.wp.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  its only later that I decided to search on Geolocation and operation aborted and realised that I wasn&#8217;t the only one and it was all my fault &#8211; causality of me setting the MovementThreshold to 0. I set it to 10 instead and bingo.. it all works.</p>
<p>While I didn&#8217;t find it, I hope this post helps people like an <a href="http://benjaminbaldacci.com/blog/?p=249">earlier post</a> helped me.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/934/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/934/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=934&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/05/01/geolocator-and-movementthreshold-wpdev-win8dev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>
	</item>
		<item>
		<title>What&#8217;s wrong with Windows 8</title>
		<link>http://invokeit.wordpress.com/2013/03/13/whats-wrong-wih-windows-8/</link>
		<comments>http://invokeit.wordpress.com/2013/03/13/whats-wrong-wih-windows-8/#comments</comments>
		<pubDate>Wed, 13 Mar 2013 13:34:48 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[Off Topic]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=857</guid>
		<description><![CDATA[Everyone&#8217;s doing it and why should I not do the same ? Yeah yeah everyone&#8217;s been bad mouthing how horrible windows 8 and thought, why should I be left behind. So here&#8217;s my 2p on the subject. I remember being one of the first to get a laptop with XP.. having used Windows 95 / [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=857&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Everyone&#8217;s doing it and why should I not do the same ? Yeah yeah everyone&#8217;s been bad mouthing how horrible windows 8 and thought, why should I be left behind. So here&#8217;s my 2p on the subject.</p>
<p>I remember being one of the first to get a laptop with XP.. having used Windows 95 / 98 and ME plus Windows NT, Windows 2000, I was looking forward to it. I was young, naïve and stupid (actually last two don&#8217;t have an expiration date). I loved it yet in tons of places I kept reading that the changes were too far and users need to educate themselves yet again.</p>
<p>Just read this one.. it&#8217;s not that bad.. if you really want me to dig some, I will try</p>
<p><a href="http://reviews.cnet.com/windows/microsoft-windows-xp-home/4505-3672_7-6534881.html">http://reviews.cnet.com/windows/microsoft-windows-xp-home/4505-3672_7-6534881.html</a></p>
<p>Of course we know how that went, XP did eventually coerce people into converting.. XP however wasn&#8217;t all that hyped..</p>
<p>Next up, we had the long anticipated Longhorn.. I was still relatively young (naïve and stupid) and what did I do, I installed the leaked alpha on my PC and played with it. Was a little disappointed not to see .NET integration into the system but oh well it was only an alpha.. things dragged on and we had Vista.</p>
<p>Vista was great, it did everything XP did and even more. There was only one drawback and that was a new shiny driver model. Crap Microsoft gave the OEMs just over a year to prepare drivers&#8230; Of course what happened, Vista was slated because of UAC and being buggy as hell (thank you OEMs.. my personal favourite was NVidia.. their drivers were worse than stock shipped by Vista).</p>
<p>&#8220;you can put <strong>lipstick</strong> on <strong>a pig</strong>, but it <strong>is still</strong> <strong>a pig</strong>&#8220;</p>
<p>All Microsoft did was to release rebranded Vista as Windows 7. Sure there were a few changes like toning down the UAC tiny bit but the main thing was that drivers had already matured in this time and bingo.. people loved Windows 7 like they loved XP..</p>
<p>Of course around that time, iPhones came and iPads came and Droids started running riot.. Microsoft was under pressure to deliver and they were working on Windows 8. The Metro UX plus a tiled interface was their answer. And they took away the start button. Just look at the two screen and tell me what you think of those !!</p>
<p><a href="http://invokeit.files.wordpress.com/2013/03/messy-desktop5.jpg"><img class="alignnone size-full wp-image-922" alt="Messy-Desktop" src="http://invokeit.files.wordpress.com/2013/03/messy-desktop5.jpg?w=869"   /></a></p>
<p><a href="http://invokeit.files.wordpress.com/2013/03/screenshot-2.png"><img id="i-900" alt="Image" src="http://invokeit.files.wordpress.com/2013/03/screenshot-2.png?w=710" /></a></p>
<p>Most PCs after a few months of usage and installation crap-ware look like Picture 1. Is Windows 8 Metro UI that bad ? It looks cleaner and simpler, the icons are larger. Users can choose to pin / unpin what Start Screen shows. I keep hearing that power users hate Metro UI. What exactly is a power user ? My personal take is someone who has become adapt at clicking the icons on the desktop like in Picture 1. By that definition, I was never really a power user. Neither is my wife nor is my daughter, in fact they don&#8217;t even care about desktop forget the start menu </p>
<p>So if this is not a criticism of the larger easily clickable icons, what is it about ? You know it.. it&#8217;s the little blue orb that was called the Start Button. That thing that has been usually in the bottom left corner. This is about &#8220;Who moved my cheese?&#8221;<br />
All would have been fine, if Microsoft had just left that in place and used that to toggle visibility of Metro UI / Start Screen.</p>
<p>Oh Microsoft what have you done !!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/857/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/857/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=857&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/03/13/whats-wrong-wih-windows-8/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/03/messy-desktop5.jpg" medium="image">
			<media:title type="html">Messy-Desktop</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/03/screenshot-2.png?w=710" medium="image">
			<media:title type="html">Image</media:title>
		</media:content>
	</item>
		<item>
		<title>MVVM and me &#8211; Part 4</title>
		<link>http://invokeit.wordpress.com/2013/03/11/mvvm-and-me-part-4/</link>
		<comments>http://invokeit.wordpress.com/2013/03/11/mvvm-and-me-part-4/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 09:37:00 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[#wpdev #mvvm #xaml]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=838</guid>
		<description><![CDATA[Its taken me ages to get things done. I am now at the last xaml screen and I am so tired. Last week I spent a bit of time going through AppBar. I keep whining that Microsoft built this great Binding and Command mechanism in XAML however it was only a half hearted attempt and [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=838&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Its taken me ages to get things done. I am now at the last xaml screen and I am so tired. Last week I spent a bit of time going through AppBar.</p>
<p>I keep whining that Microsoft built this great Binding and Command mechanism in XAML however it was only a half hearted attempt and that they don&#8217;t really care whether you use MVVM or not.</p>
<p>AppBar is the perfect example of that. It does not support either.  So the MVVM and XAML community (actually a few developers) have taken the task to themselves. They have created custom AppBar controls that support  Binding and Commanding infrastructure.</p>
<p>So what controls did I find ? there&#8217;s</p>
<ol>
<li><a href="http://appbarutils.codeplex.com/">http://appbarutils.codeplex.com/</a></li>
<li><a href="https://github.com/PedroLamas/Cimbalino-Phone-Toolkit">https://github.com/PedroLamas/Cimbalino-Phone-Toolkit</a></li>
<li><a href="http://bindableapplicationb.codeplex.com/">http://bindableapplicationb.codeplex.com/</a></li>
</ol>
<p>&nbsp;<br />
So what is the experience using them. The first two require you to set the appbar within Behaviours. The 3rd one is the closest to the native AppBar in terms of XAML and simplicity. </p>
<p>The stock WP7 xaml AppBar needs to be set list this.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;phone:PhoneApplicationPage.ApplicationBar&gt;
    &lt;shell:ApplicationBar&gt;
        &lt;shell:ApplicationBarIconButton x:Name=&quot;btnLast&quot; IconUri=&quot;/Images/appbar.image.png&quot; Text=&quot;test&quot; Click=&quot;btbTest_Click&quot;&gt;&lt;/shell:ApplicationBarIconButton&gt;
    &lt;/shell:ApplicationBar&gt;
&lt;/phone:PhoneApplicationPage.ApplicationBar&gt;
</pre>
<p>AppBarUtils and Cimbalino require something like this</p>
<pre class="brush: xml; title: ; notranslate">
&lt;i:Interaction.Behaviors&gt;
    &lt;cimbalinoBehaviors:MultiApplicationBarBehavior SelectedIndex=&quot;{Binding ApplicationBarSelectedIndex}&quot;&gt;
        &lt;cimbalinoBehaviors:ApplicationBar&gt;
            &lt;cimbalinoBehaviors:ApplicationBarIconButton Command=&quot;{Binding AddItemCommand, Mode=OneTime}&quot; IconUri=&quot;/Images/appbar.add.rest.png&quot; Text=&quot;add&quot; /&gt;
        &lt;/cimbalinoBehaviors:ApplicationBar&gt;
    &lt;/cimbalinoBehaviors:MultiApplicationBarBehavior&gt;
&lt;/i:Interaction.Behaviors&gt;
</pre>
<p>The Bindable AppBar</p>
<pre class="brush: xml; title: ; notranslate">
&lt;bar:Bindable.ApplicationBar&gt;
    &lt;bar:BindableApplicationBar IsVisible=&quot;{Binding BarIsVisible}&quot;
        &lt;bar:BindableApplicationBarButton Text=&quot;{Binding IconButtonText}&quot; IconUri=&quot;{Binding IconUri, FallbackValue=/Icons/Dark/appbar.add.rest.png}&quot; IsEnabled=&quot;{Binding ButtonIsEnabled}&quot; /&gt;
    &lt;/bar:BindableApplicationBar&gt;
&lt;/bar:Bindable.ApplicationBar&gt;
</pre>
<p>The biggest downside is that they do not render at design time. The single biggest advantage of MVVM goes out of the window. You need to use standard appbar in design more and them once you are happy with it, comment it out and replace it with Bindable / Commandable AppBar of your choice.</p>
<p>The whole experience has been such joy that instead of coding till the middle of the night, I switch the laptop off after about 30 &#8211; 45 mins of mucking about.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/838/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/838/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=838&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/03/11/mvvm-and-me-part-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>
	</item>
		<item>
		<title>MVVM and me – Part 3</title>
		<link>http://invokeit.wordpress.com/2013/03/07/mvvm-and-me-part-3/</link>
		<comments>http://invokeit.wordpress.com/2013/03/07/mvvm-and-me-part-3/#comments</comments>
		<pubDate>Thu, 07 Mar 2013 17:34:00 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=829</guid>
		<description><![CDATA[Today is continuation of yesterday&#8217;s post. Yesterday my goal was to find out how one goes about setting static page strings in MVVM. There are many ways. Hard code it directly in xaml Define resources in App.xaml Use Resource Dictionary I have used ResourceDictionary a lot in past when dealing with Localization and I think [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=829&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Today is continuation of yesterday&#8217;s post.</p>
<p>Yesterday my goal was to find out how one goes about setting static page strings in MVVM. There are many ways.</p>
<ol>
<li>Hard code it directly in xaml</li>
<li>Define resources in App.xaml</li>
<li>Use Resource Dictionary</li>
</ol>
<p>I have used ResourceDictionary a lot in past when dealing with Localization and I think that is the only right way to set xaml strings. That takes care of present and future need without being too bulky</p>
<p>By default my WP8 project added support for Localisation, It created Resource folder with AppResources.resx, LocalizedString class that exposes the resources and finally set it as a resource in App.xaml.</p>
<p><a href="http://invokeit.files.wordpress.com/2013/03/proj-localization.png"><img class="alignnone size-full wp-image-830" alt="proj-localization" src="http://invokeit.files.wordpress.com/2013/03/proj-localization.png?w=869"   /></a><br />
<a href="http://invokeit.files.wordpress.com/2013/03/appresources.png"><img class="alignnone size-full wp-image-831" alt="AppResources" src="http://invokeit.files.wordpress.com/2013/03/appresources.png?w=869"   /></a></p>
<p>All you then do is set the strings like this</p>
<pre class="brush: xml; title: ; notranslate">
&lt;TextBlock Text=&quot;{Binding LocalizedResources.MainViewChoiceText, Source={StaticResource LocalizedStrings}}&quot; Margin=&quot;12, 0&quot;/&gt;
</pre>
<p>All sorted. And in case you decide to localise your apps, all you need to do is add more resx files.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/829/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/829/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=829&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/03/07/mvvm-and-me-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/03/proj-localization.png" medium="image">
			<media:title type="html">proj-localization</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/03/appresources.png" medium="image">
			<media:title type="html">AppResources</media:title>
		</media:content>
	</item>
		<item>
		<title>MVVM and me – Part 2</title>
		<link>http://invokeit.wordpress.com/2013/03/06/mvvm-and-me-part-2/</link>
		<comments>http://invokeit.wordpress.com/2013/03/06/mvvm-and-me-part-2/#comments</comments>
		<pubDate>Wed, 06 Mar 2013 22:11:33 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=823</guid>
		<description><![CDATA[I could have done this post yesterday but that would have been a long essay. Today we are going to look at displaying static data on XAML pages. In C# when you have data that does not change, one tends to use const or static readonly. const causes compiler to replace all occurrences of variable [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=823&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I could have done this post yesterday but that would have been a long essay. Today we are going to look at displaying static data on XAML pages.</p>
<p>In C# when you have data that does not change, one tends to use <code>const</code> or <code>static readonly</code>. <code>const</code> causes compiler to replace all occurrences of variable usage with the actual data at compile time. That means you assemblies has no lookups at run-time. Static read-only is a static variable that can also be set in constructor &#8211; is read-only otherwise.</p>
<p>Now based on my previous experience doing WinForms and Webforms, normally I tend to set those directly in XAML. Say you want to content of a button or a textblock text (label). So the ideal way would be.</p>
<ol>
<li>Take View Model</li>
<li>Define consts</li>
<li>Set bindings to consts</li>
<li>Compile and reload</li>
</ol>
<p>Eureka.. there&#8217;s nothing..</p>
<p>Well XAML bindings make a big fuss of INotifyPropertyChanged interface. From sample I know that it works with properties so could it be that ?</p>
<p>Lets start:</p>
<ol>
<li>Take View Model</li>
<li>Define consts</li>
<li>Define properties</li>
<li>Set property in the constructor to consts</li>
<li>Set bindings to properties</li>
<li>Compile and reload</li>
</ol>
<p>There.. much better..</p>
<p>Lesson, const and compiler time optimisations are no good.. you need to define properties and additionally call PropertyChanged events and what not including set the properties at VM Creation in order to display data the proper MVVM way. A Single task of setting a text to a textblock or a button is translated into a handful tasks..</p>
<p>Update 1:<br />
My friend @Scottisafool &#8230; suggested an alternative approach that he tends to use</p>
<ol>
<li>Define resources in App.xaml</li>
<li>Set bindings to resources</li>
<li>Compile and reload</li>
</ol>
<p>This also works.. sure it means that all your strings are in one place but that&#8217;s still not MVVM<br />
So it turns out there is not right way but there is a wrong way!! Everything else but code-behind as the last resource is the pukka MVVM way. Wrap up for today I think.</p>
<p>Update 2:<br />
More messages suggesting that the mechanism to declare labels is to either hard code those or use Resources. That&#8217;s all fine.. I could use ResourceDictionary just in case the future me might want to localise the app.</p>
<p>That however still leaves the need to support of real consts impossible. There isn&#8217;t any support for those in bindings wrt View Model</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/823/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/823/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=823&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/03/06/mvvm-and-me-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>
	</item>
		<item>
		<title>MVVM and me &#8211; Part 1</title>
		<link>http://invokeit.wordpress.com/2013/03/05/mvvm-and-me-part-1/</link>
		<comments>http://invokeit.wordpress.com/2013/03/05/mvvm-and-me-part-1/#comments</comments>
		<pubDate>Tue, 05 Mar 2013 22:35:59 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[WP7]]></category>
		<category><![CDATA[#wpdev]]></category>
		<category><![CDATA[#mvvm]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=818</guid>
		<description><![CDATA[As you know I recently joined a big name in Mobile Money business as a Senior Windows Developer. Part of that job involves working with others and not just doing WP Dev as a hobbyist (which I still do). Most WP Devs are inherently XAML devs and they are well versed in MVVM (Model-View-View Model [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=818&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As you know I recently joined a big name in Mobile Money business as a Senior Windows Developer. Part of that job involves working with others and not just doing WP Dev as a hobbyist (which I still do).</p>
<p>Most WP Devs are inherently XAML devs and they are well versed in MVVM (Model-View-View Model not necessarily in that order). MVVM itself is an extension of MVP (Model View Presenter) which to an extent has similarities to MVC (Model View Controller). Microsoft in .NET 2.0 started extensive work (crusade) against code behind. The idea that has been propagated has been to write less code &#8211; its more declarative and less code driven. (Use the system generated code since you are no good at it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> )</p>
<p>Personally I have never been a fan of declarative code. I do like XAML but only the extensible nature of it. how I just about use / contain and create controls with ease. Historically I am a middle-tier / server-side developer who loves not worrying about UI BS. I have spend years making code lean and that means adding layers that do little isn&#8217;t my cuppa tea.</p>
<p>However I am developing my next hobbyist app using MVVM. The next few blogs are doing to deal with my experiences moving from code driven to MVVM driven app development.</p>
<p>Before we get started just want to mention the fact that if I wasn&#8217;t doing the app in MVVM, I would have already finished it. Right now I am still doing XAML screens and battling myself almost constantly. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/818/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/818/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=818&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/03/05/mvvm-and-me-part-1/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>
	</item>
		<item>
		<title>Background Audio #win8dev #winrt</title>
		<link>http://invokeit.wordpress.com/2013/02/22/background-audio-win8dev-winrt/</link>
		<comments>http://invokeit.wordpress.com/2013/02/22/background-audio-win8dev-winrt/#comments</comments>
		<pubDate>Fri, 22 Feb 2013 11:01:21 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSharp]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[Metro]]></category>
		<category><![CDATA[Windows 8]]></category>
		<category><![CDATA[WinRT]]></category>
		<category><![CDATA[#win8dev]]></category>
		<category><![CDATA[#winrt]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=811</guid>
		<description><![CDATA[In this post I am going to detail some of the work I have been doing on Background Audio. But before I get onto it, let me say that the last few months have been crazy / busy, not highly motivational for personal dev etc. I have done a few updates over the last few [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=811&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>In this post I am going to detail some of the work I have been doing on Background Audio. But before I get onto it, let me say that the last few months have been crazy / busy, not highly motivational for personal dev etc. I have done a few updates over the last few months but no new development until this month.</p>
<p>About 2 weeks back I started work on Porting Slydr code to WPF control and that was a breeze. Infact last night I saw something about a simple app being tested.. makes me think on whether I should beat them to it <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  or not.</p>
<p>Now back to Background Audio. With Windows Phone, one had to create a Background Audio Player which the app and system would then communicate with. The app could kick the Background Audio Player off and then exit and the audio would keep on playing. I have talked about this before and will saying it again. WPDev 7x provided many ways of playing audio. With Windows 8 and #WinRT your options are restricted. I have gotten used to giving <code>MediaElement</code> more usage and credit for what it does.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;MediaElement x:Name=&quot;mePlayer&quot; /&gt;
</pre>
<p>All you need to do is set the <code>Source</code> property and then call <code>Play()</code>. The audio starts playing. If the app gets suspended, the music stops playing. To enable background audio there are a number of things you need to do.<br />
* Firstly set <code>MediaElement</code>&#8216;s <code>AudioCategory</code> to <code>BackgroundCapableMedia</code>. This still doesn&#8217;t activate the Background Audio as its only the first step</p>
<p>* Now open package.appmanifest file. Open the Declarations tab and add Background Tasks. While you are there set the Supported task types property to Audio and Control Channel. You will also need to set the Start page in App settings. Of course now that you have done this, you will have to create a Badge logo before you can save the changes to appmanifest.<br />
<a href="http://invokeit.files.wordpress.com/2013/02/appmanifest.png"><img src="http://invokeit.files.wordpress.com/2013/02/appmanifest.png?w=869" alt="appManifest"   class="alignnone size-full wp-image-813" /></a></p>
<p>* Now back to codebehind of your page and add event handlers for <code>MediaControl</code>&#8216;s <code>PlayPressed</code>, <code>PausePressed</code>, <code>StopPressed</code> and <code>PlayPauseTogglePressed</code> events</p>
<p>In my app I also support Previous Track / Next Track so I additionally added support for <code>PreviousTrackPressed</code> and <code>NextTrackPressed</code> events.</p>
<pre class="brush: csharp; title: ; notranslate">
MediaControl.PlayPressed += MediaControl_PlayPressed;
MediaControl.PausePressed += MediaControl_StopPressed;
MediaControl.StopPressed += MediaControl_StopPressed;
MediaControl.PlayPauseTogglePressed += MediaControl_PlayPauseTogglePressed;
MediaControl.NextTrackPressed += MediaControl_NextTrackPressed;
MediaControl.PreviousTrackPressed += MediaControl_PreviousTrackPressed;
</pre>
<p>and </p>
<pre class="brush: csharp; title: ; notranslate">
void MediaControl_PreviousTrackPressed(object sender, object e)
{
    this.Previous();
}

void MediaControl_NextTrackPressed(object sender, object e)
{
    this.Next();
}

void MediaControl_PlayPauseTogglePressed(object sender, object e)
{
    if (MediaControl.IsPlaying)
        this.Stop();
    else
        this.Play();
}

void MediaControl_StopPressed(object sender, object e)
{
    this.Stop();
}

void MediaControl_PlayPressed(object sender, object e)
{
    this.Play();
}
</pre>
<p>Now when you run the app, initiate the audio playback and navigate away from the app.. Bingo. the audio is still playing.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/811/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/811/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=811&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/02/22/background-audio-win8dev-winrt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>

		<media:content url="http://invokeit.files.wordpress.com/2013/02/appmanifest.png" medium="image">
			<media:title type="html">appManifest</media:title>
		</media:content>
	</item>
		<item>
		<title>Enthasiasts beware</title>
		<link>http://invokeit.wordpress.com/2013/02/11/enthasiasts-beware/</link>
		<comments>http://invokeit.wordpress.com/2013/02/11/enthasiasts-beware/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 22:37:34 +0000</pubDate>
		<dc:creator>Hermit Dave</dc:creator>
				<category><![CDATA[Off Topic]]></category>

		<guid isPermaLink="false">http://invokeit.wordpress.com/?p=807</guid>
		<description><![CDATA[I have been a keen buyer of unlocked / sim free devices for years. The reason.. more manageable contracts and you get the latest and greatest updates without worrying about Telco&#8217;s update approval red tape.. Unfortunately my experiences over the last 1.5 years tell me that things aren&#8217;t the same.. Ever since Nokia released first [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=807&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I have been a keen buyer of unlocked / sim free devices for years. The reason.. more manageable contracts and you get the latest and greatest updates without worrying about Telco&#8217;s update approval red tape.. Unfortunately my experiences over the last 1.5 years tell me that things aren&#8217;t the same..</p>
<p>Ever since Nokia released first Windows Phone 7 product, the update release cycles have been secretive. Even developers do not have access to new releases like before. I don&#8217;t necessarily blame Nokia for it but something has changed with Microsoft WP Team. Windows Phone 8 was supposed to get around this by OTA&#8230; guess what..it hasn&#8217;t.. Portico was released days after #WP8 became public and surprise surprise.. its rolling across all locked / Telco managed devices.. the only ones who are left behind are the enthusiasts who getting it the last. So much for shelling out your hard earned cash..</p>
<p>If you think this was the end of my rant.. it isn&#8217;t&#8230; I also learned recently that by default, Windows Phone while having the capability to do NFC Secure wallet payment has been shipped neutered.. yes it has a big piece missing and it requires your Telco to release that piece.. now you my enthusiast friend are stuffed.. if your Telco starts supporting Secure Wallets stuff, be prepared to flash your devices with Telco ROM.. that&#8217;s your only hope as things stand today.</p>
<p>I suppose I better go back to coding now. Have a fantastic evening..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/invokeit.wordpress.com/807/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/invokeit.wordpress.com/807/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=invokeit.wordpress.com&#038;blog=24711896&#038;post=807&#038;subd=invokeit&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://invokeit.wordpress.com/2013/02/11/enthasiasts-beware/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/507efe9f8ee8d8322d359375a6cd45fa?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">hermitd</media:title>
		</media:content>
	</item>
	</channel>
</rss>
