<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Adventures in C#/XAML app development</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/adventuresinappdev/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/adventuresinappdev/feed.xml</link>
    <description>New Developer experiences creating windows phone and windows store apps in c#/XAML</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:21:36 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Changing your Published Windows Store App Name</title>
      <link>https://docs.microsoft.com/archive/blogs/adventuresinappdev/changing-your-published-windows-store-app-name</link>
      <pubDate>Mon, 19 Nov 2012 12:59:41 GMT</pubDate>
      <dc:creator><![CDATA[Erik Steinfeld]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/adventuresinappdev/2012/11/19/changing-your-published-windows-store-app-name/</guid>
      <description><![CDATA[So you released your app, got a bunch of positive reviews and downloads.&nbsp; Then one of a few...]]></description>
      <content:encoded><![CDATA[<p>So you released your app, got a bunch of positive reviews and downloads.&nbsp; Then one of a few things happens:</p>
<ol>
<li>You get a bunch of reviews that say your app name is stupid</li>
<li>You decide you app name is stupid</li>
<li>You realize that your name, while creative,&nbsp;doesn't contain the primary search keywords&nbsp;thus&nbsp;ensuring your search relevance will be mediocre at best.</li>
</ol>
<p>If you reach this point like me, I'm&nbsp;sure you're feeling frustrated, sad, confused and afraid you'll never retire off your&nbsp;brilliantly executed&nbsp;micro-transaction implementation.&nbsp; Don't worry though, I'm here to help you!&nbsp; Windows store has made it pretty easy to change your app name, the only problem is that the documentation isn't crystal clear.&nbsp; It says you need to reserve another name within the Dashboard under the specific submission, and change the app name within the Package.appxmanifest (among other places).&nbsp; The overarching issue here is that there are a handful of places you need to change, and missing one could mean your app is named properly from a deployment standpoint, but the store won't reflect the change unless you update it in the proper locations.&nbsp; So, now that I've gone through and missed those locations initially I am here to give you a CLEAR path to success.</p>
<p>Visual Studio (i.e. the app itself) - here is what to change</p>
<ol>
<li>First off, update everything that's within your primary code.&nbsp; If you have a splash screen or show the name on the mainpage, change it.&nbsp; If you have underlying data services that use some form of the app name obviously evaluate that separately but anything public facing should be changed.</li>
<li>Update your artwork/art assets.&nbsp; Don't forget this</li>
<li>For the windows store to reflect the changes you need to do two things - on the client side open up the&nbsp;Package.appxmanifest in VS.&nbsp; Click the "Packaging" tab and change the Package Display Name.</li>
<li>Under the Application UI under the Package.appxmanifest you also need to change the "Display Name" there.&nbsp; That should update the deployed package name and what shows up on the Windows Client</li>
<li>In the Properties -&gt; AssemblyInfo.cs file I like to update the AssemblyTitle and AssemblyProduct but I don't think these actually used by anything that displays your app name</li>
</ol>
<p><br />Store Dashboard -</p>
<p>Create a new release for your existing app and then click the "App Name" selection.&nbsp;&nbsp;In the last&nbsp;line of text&nbsp;you'll need to click the line "Reserve another&nbsp;Name" hotlink to reserve the&nbsp;name.&nbsp; Then upload your new package and you are good to go.</p>
<p>&nbsp;</p>
<p>Seems easy?&nbsp; Good it's supposed to be just don't miss both spots in the&nbsp;Package.appxmanifest and your good to go :-)&nbsp;</p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Testing in-app purchases/Microtransactions for C#/XAML Store apps</title>
      <link>https://docs.microsoft.com/archive/blogs/adventuresinappdev/testing-in-app-purchasesmicrotransactions-for-cxaml-store-apps</link>
      <pubDate>Fri, 05 Oct 2012 11:46:00 GMT</pubDate>
      <dc:creator><![CDATA[Erik Steinfeld]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/adventuresinappdev/2012/10/05/testing-in-app-purchasesmicrotransactions-for-cxaml-store-apps/</guid>
      <description><![CDATA[Background
Many people like to write code just for the fun of it, but i can&nbsp;guarantee&nbsp;you...]]></description>
      <content:encoded><![CDATA[<h1>Background</h1>
<p>Many people like to write code just for the fun of it, but i can&nbsp;guarantee&nbsp;you that getting paid is much more rewarding! &nbsp;Windows Phone's first release cycle left you with two options for making money...advertising or paid apps. &nbsp;Most people went the paid app with an ad-supported trial initially but found out quickly that your "trial" free app never showed up in the free section so the majority of the population completely skipped your app. &nbsp;The smart developers quickly released a second version of their app that was a&nbsp;separate&nbsp;'free' version and updated both apps when they released updates. &nbsp;Fast forward to now, unless you were the only competitor for your app type and had a laser focused target audience that you knew would pay for an app the free/ad supported version came out on top monetarily. &nbsp;For me personally I was earning anywhere from 10x to 20x as much on my free app with ads opposed to my paid app. &nbsp;Lessons learned? &nbsp;MAKE YOUR APP FREE!</p>
<p>That said Windows Store 8 (and phone 8) brings in the MUCH MUCH needed option of&nbsp;micro-transactions! &nbsp;Thus begins the new era of freemium apps and though there are a million different opinions on how to properly structure your app to best to capitalize on this we'll stick to the implementation here. &nbsp;I will say that any app with freemium features should reward those who want to pay but also not punish those who don't. &nbsp;As a quick example - my primary app (for now) is your a-typical gun/shotgun app, I have a handful of guns that are locked and can be unlocked 2 different ways. &nbsp;Way number 1 is&nbsp;micro-transactions&nbsp;(obviously). &nbsp;You can unlock a set of guns for the minimum amount of 1.49 US, or buy a certain amount of in game currency (bullets) to unlock the same "value" of guns except pick and choose which to unlock. &nbsp;Any purchase automatically disables the Ad forever as well (it's estimated each user is worth 3-5 cents over the lifetime of an ad-supported app) and I'm happy to do so given the value proposition. &nbsp;Option number 2 is to spend in game currency (bullets) which you earn for every weapon discharge and for doing in game "missions". &nbsp;There is nothing that can't be unlocked or done simply by using the app but if someone just wants to unlock a large set of features right away and get rid of the Ad they can. &nbsp;I don't think this will be too viable initially but as I grow the app adding more&nbsp;unlock-able&nbsp;features it becomes more attractive for the target audience.</p>
<p></p>
<p>How To setup and test</p>
<p>Ok! &nbsp;I'm going to skim over creating your&nbsp;micro-transaction&nbsp;stuff initially since there is <a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh694067.aspx" title="decent documentation">decent documentation</a> on it thus far but it wasn't 100% clear upon reading it what was needed. &nbsp;I'm assuming you at least have the includes (Windows.ApplicationMdoel.Store).</p>
<p>Before we code you need to define a few things...and this may seem trivial but it's more important than all of the below. &nbsp;See, once you define your initial unlockables you must ALWAYS support them. &nbsp;If you change your price, or what it unlocks that's fine but you can't change the keys you initially assign and must always support them so choose wisely. &nbsp;for my example lets pick 2 things, one is 1000 in game currency called "1000Bullets" and another is a weapon pack "weaponPack1". &nbsp;Another requirement is to have a windowsStoreProxy XML file that will be used by the current app simulator to test your app. &nbsp;Now if you don't feel like creating one initially, your app WILL create a basic one for you by default if you add said code below. &nbsp;Of course when you hit the code block the solution will break into the debugger though it doesn't crash the app so feel free to continue. &nbsp;After doing so once, the XML file is created and you can edit it to your hearts content &nbsp;I would&nbsp;recommend this path as one mistake in the file and it becomes incredibly hard to debug what's not working correctly (yes, this happened to me, hence why I'm recommending said path).</p>
<p>First in your code behind page (mainpage.xaml.cs) declare a global variable:</p>
<p>public LicenseInformation licenseInfo;</p>
<p>Next, you'll need to populate said variable and do some form of featureChecking. &nbsp;This is where you need to be a bit creative as there are two ways to populate your licenseInfo depending on if your app is in the store or not. &nbsp;Since you are testing new unlockables anyways you need to use the non release code method which is currentAppSimulator. &nbsp;Usually when I complete a feature set and get ready to push my code live I get so gosh darned FIRED UP that I forget to change my flags properly so I try and build my code to support my&nbsp;shortcomings. &nbsp;Thus I detect whether I'm in debug mode, thus below:</p>
<pre class="scroll"><code class="csharp">private void featureCheck()<br /> {<br /> try<br /> {<br /> if (System.Diagnostics.Debugger.IsAttached)<br /> {<br /> licenseInfo = currentAppSimulator.LicenseInformation;<br /> }<br /> else<br /> {<br /> licenseInfo = currentApp.LicenseInformation;<br /> }<br /> if (licenseInfo.productLicenses["1000Bullets"].isActive)<br /> {<br /> //unlock feature<br /> }<br /> (licenseInfo.productLicenses["weaponPack1"].isActive)<br /> {<br /> //unlock feature<br /> }<br /> catch<br /> {<br /> //keeps your code from crashin', do some error reporting<br /> }<br /> }</code></pre>
<p>Time to break it down. &nbsp;So I'm checking if this is going down in the emulator, if so use the currentAppSimulator which covers my over-excited behind in my pre-release exuberance. &nbsp;I also include everything in try/catch blocks so the app don't crash if i don't have the proxy file setup. &nbsp;This is important because EVERYTIME your app redeploys fully (change architecture, reboot, etc) your xml file gets blown away. &nbsp;This way your app can still run after you've verified everything works, or it's a reminder to go update your proxy XML file. &nbsp;Finally you check if the features are unlocked, if they are do something otherwise they should remain locked. &nbsp;Bam.</p>
<p>Next up lets edit that XML file &nbsp;It looks like the below by default:</p>
<pre class="scroll"><code class="html">&lt;?xml version="1.0" encoding="utf-16" ?&gt; &lt;CurrentApp&gt;<br /> &lt;ListingInformation&gt;<br /> &lt;App&gt;<br /> &lt;AppId&gt;00000000-0000-0000-0000-000000000000&lt;/AppId&gt;<br /> &lt;LinkUri&gt;http://apps.microsoft.com/webpdp/app/00000000-0000-0000-0000-000000000000&lt;/LinkUri&gt;<br /> &lt;CurrentMarket&gt;en-US&lt;/CurrentMarket&gt;<br /> &lt;AgeRating&gt;3&lt;/AgeRating&gt;<br /> &lt;MarketData xml:lang="en-us"&gt;<br /> &lt;Name&gt;AppName&lt;/Name&gt;<br /> &lt;Description&gt;AppDescription&lt;/Description&gt;<br /> &lt;Price&gt;1.00&lt;/Price&gt;<br /> &lt;CurrencySymbol&gt;$&lt;/CurrencySymbol&gt;<br /> &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;<br /> &lt;/MarketData&gt;<br /> &lt;/App&gt;<br /> &lt;Product ProductId="1" LicenseDuration="0"&gt;<br /> &lt;MarketData xml:lang="en-us"&gt;<br /> &lt;Name&gt;Product1Name&lt;/Name&gt;<br /> &lt;Price&gt;1.00&lt;/Price&gt;<br /> &lt;CurrencySymbol&gt;$&lt;/CurrencySymbol&gt;<br /> &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;<br /> &lt;/MarketData&gt;<br /> &lt;/Product&gt;<br /> &lt;/ListingInformation&gt;<br /> &lt;LicenseInformation&gt;<br /> &lt;App&gt;<br /> &lt;IsActive&gt;true&lt;/IsActive&gt;<br /> &lt;IsTrial&gt;true&lt;/IsTrial&gt;<br /> &lt;/App&gt;<br /> &lt;Product ProductId="1"<br /> &lt;IsActive&gt;true&lt;/IsActive&gt;<br /> &lt;/Product&gt;<br /> &lt;/LicenseInformation&gt;<br /> &lt;/CurrentApp&gt;<br /> </code></pre>
<p>Two VERY IMPORTANT things to note here. &nbsp;One, your app DOES NOT change this file. &nbsp;When you are in testing mode and try and purchase things, you get back the return codes but this file is never changed, nor is your app so you control the license.isActive state from here and from here alone. <strong>&nbsp;Again, when you are in testing mode all the commands sent and received are governed by this file and your app will NOT change it</strong>so can't test the actual unlocking of a feature except by changing this file and seeing your app react. &nbsp;I read this somewhere and it didn't sink in initially so I had a tough time figuring out why my app wasn't unlocking the features. &nbsp;I'm changing TWO area's, first is the product in the listing area which details the price data, etc. the other is in the licenseInformation which determines the isActive return. &nbsp;I don't bother with anything else.</p>
<pre class="scroll"><code class="cplusplus">&lt;?xml version="1.0" encoding="utf-16" ?&gt; &lt;CurrentApp&gt;<br /> &lt;ListingInformation&gt;<br /> &lt;App&gt;<br /> &lt;AppId&gt;00000000-0000-0000-0000-000000000000&lt;/AppId&gt;<br /> &lt;LinkUri&gt;http://apps.microsoft.com/webpdp/app/00000000-0000-0000-0000-000000000000&lt;/LinkUri&gt;<br /> &lt;CurrentMarket&gt;en-US&lt;/CurrentMarket&gt;<br /> &lt;AgeRating&gt;3&lt;/AgeRating&gt;<br /> &lt;MarketData xml:lang="en-us"&gt;<br /> &lt;Name&gt;AppName&lt;/Name&gt;<br /> &lt;Description&gt;AppDescription&lt;/Description&gt;<br /> &lt;Price&gt;1.00&lt;/Price&gt;<br /> &lt;CurrencySymbol&gt;$&lt;/CurrencySymbol&gt;<br /> &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;<br /> &lt;/MarketData&gt;<br /> &lt;/App&gt;<br /> &lt;Product ProductId="weaponsUnlock1" LicenseDuration="0"&gt;<br /> &lt;MarketData xml:lang="en-us"&gt;<br /> &lt;Name&gt;Unlock 3 Guns&lt;/Name&gt;<br /> &lt;Price&gt;1.49&lt;/Price&gt;<br /> &lt;CurrencySymbol&gt;$&lt;/CurrencySymbol&gt;<br /> &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;<br /> &lt;/MarketData&gt;<br /> &lt;/Product&gt;<br /> &lt;Product ProductId="1000Bullets" LicenseDuration="0"&gt;<br /> &lt;MarketData xml:lang="en-us"&gt;<br /> &lt;Name&gt;1000 Bullet Currency&lt;/Name&gt;<br /> &lt;Price&gt;1.49&lt;/Price&gt;<br /> &lt;CurrencySymbol&gt;$&lt;/CurrencySymbol&gt;<br /> &lt;CurrencyCode&gt;USD&lt;/CurrencyCode&gt;<br /> &lt;/MarketData&gt;<br /> &lt;/Product&gt;<br /> &lt;/ListingInformation&gt;<br /> &lt;LicenseInformation&gt;<br /> &lt;App&gt;<br /> &lt;IsActive&gt;true&lt;/IsActive&gt;<br /> &lt;IsTrial&gt;true&lt;/IsTrial&gt;<br /> &lt;/App&gt;<br /> &lt;Product ProductId="1000Bullets"&gt;<br /> &lt;IsActive&gt;true&lt;/IsActive&gt;<br /> &lt;/Product&gt;<br /> &lt;Product ProductId="weaponsUnlock1"&gt;<br /> &lt;IsActive&gt;false&lt;/IsActive&gt;<br /> &lt;/Product&gt;<br /> &lt;/LicenseInformation&gt;<br /> &lt;/CurrentApp&gt;</code></pre>
<p>Now go ahead and test out your app. &nbsp;With the above XML file the licenseInfo["1000Bullets"].isActive in your c# code should return true and you can verify that your code is properly unlocking said feature. &nbsp;Double Bam.</p>
<p>The only missing piece now is how you handle the purchase of items, but this is in fact the easiest piece! &nbsp;Lets say you go ahead and create a gridview &nbsp;and bind your store objects to it. &nbsp;How do you handle user selection of an item? &nbsp;Well the best part about this is that the UI piece is handled completely by the store so you only need to make the call and your good to go. &nbsp;Now remember, when you are in the simulator/local machine when you make the call using currentAppSimulator you get a pop up that lets you return various messages (Ok, network issues, etc) and see how your code handles the response but the license file DOES NOT CHANGE so the feature won't unlock regardless of the message you send back. &nbsp;Obviously this doesn't happen in the live store but keep that in mind for testing purposes, to simulate the item being purchased you need to edit the XAML file above. &nbsp;</p>
<pre class="scroll"><code class="cplusplus">//class used for purchasable objects<br /> public Class PurchaseObject<br /> {<br /> string name {get; set;}<br /> string key {get; set;}<br /> int cost {get; set;}<br /> }<br /> <br /> private async void gridviewItem_Click_1(object sender, ItemCLickEventArgs e)<br /> {<br /> PurchaseObject element = e.ClickedItem as PurchaseObject;<br /> if(!licenseInfo.ProductLicenses[element.key].IsActive)<br /> {<br /> try<br /> {<br /> string success;<br /> if(System.Diagnostics.Debugger.IsAttached)<br /> {<br /> success = await CurrentAppSimulator.RequestProductPurchaseAsync(element.key, false);<br /> }<br /> else<br /> {<br /> success = await CurrentApp.RequestProductPurchaseAsync(element.key, false);<br /> }<br /> //do some form of feature checking at this point<br /> // read the success string if you want to see what<br /> //happened<br /> }<br /> catch<br /> {<br /> //network issues or store connection issues<br /> }<br /> }</code></pre>
<p>So we create a class real quick that contains the name, price and key of the purchasable object. &nbsp;The name and cost will obviously be used for displaying in the gridview, but the key is what's really important here. &nbsp;The key is the same productId you used above for the feature and is the same string you'll use when submitting your app to the store. &nbsp;The click event checks if the feature is already unlocked and if it is it does nothing (you can add en else clause to notify the user they already own it) but in theory you probably aren't displaying any objects that are already purchased so this is more of an extra safety check. &nbsp;Next is a try/catch block in case of network issues, store being down, etc. &nbsp;Then we have the if Debugger attached to determine if your in the simulator, &nbsp;and finally the store API call. &nbsp;The call does everything for you UI wise so that's it. &nbsp;If your in the simulator you get a pop up to send back a message but it doesn't change anything as mentioned above. &nbsp;Hope this helps some of you out with your end to end solution and if you make a million dollars with my amazing suggestions, give 5 dollars to charity! &nbsp;Happy Coding!</p>]]></content:encoded>
    </item>
    <item>
      <title>Azure Mobile Services, Linq, leaderboards and you!</title>
      <link>https://docs.microsoft.com/archive/blogs/adventuresinappdev/azure-mobile-services-linq-leaderboards-and-you</link>
      <pubDate>Wed, 03 Oct 2012 14:23:00 GMT</pubDate>
      <dc:creator><![CDATA[Erik Steinfeld]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/adventuresinappdev/2012/10/03/azure-mobile-services-linq-leaderboards-and-you/</guid>
      <description><![CDATA[Background
On my windows phone app Bang Bang I had a buddy setup a web service to run my...]]></description>
      <content:encoded><![CDATA[<h1>Background</h1>
<p>On my windows phone app Bang Bang I had a buddy setup a web service to run my leaderboard using a linux web services and mySQL. &nbsp;This worked out great but it's on Amazon ACS and i feel dirty everytime I need to update it, as well as not fully understanding the what/why/how it works from every angle. &nbsp;Now that I'm building a C#/XAML app with a Leaderboard for the Windows 8 Store I decided to examine the AWESOME new <a href="https://www.windowsazure.com/en-us/develop/mobile/" title="Azure Mobile Services">Azure Mobile Services</a>. &nbsp;I ran into a few confusing moments in getting setup with the service and I thought I'd share my experiences.</p>
<p>After testing out the initial tutorial post signing up I was able to insert data into the table without problem. &nbsp;Doing just about anything else wasn't working well for me and I was left with these questions/issues:</p>
<ol>
<li>When updating what was happening client side and what was happening server side? &nbsp;Was I pulling down the entire table everytime I did a getTable&lt;myClass&gt;() &nbsp;??&nbsp;</li>
<li>So I get how insert works, but what if i want to update an entry? &nbsp;How the heck does updateAsync() work?</li>
<li>No developer should admit this but I hadn't full grasped Linq yet (shame on me)...thus how do I get queries &nbsp;to work (server side only) that takes the top 10 entries ordered by an int?</li>
<li>How are the tables created, how do I edit them?</li>
</ol>
<div>I contacted the Azure mobile services team who graciously assisted me with the answers I was so desperately seeking. &nbsp;Below is what i did to get my code working step by step and the answers to each question will be revealed!</div>
<h1>Code Time</h1>
<div><em>pre-reqs for below:</em></div>
<div><em>*download, install and include the azure mobile services DLL under references</em></div>
<div><em>*in app.xaml.cs and the page you use it on (assuming mainpage.xaml.cs) add 'using Microsoft.WindowsAzure.MobileServices;'</em></div>
<div><em>*create a public static MobileServiceClient MobileService in your app.xaml.cs and assign it to your URL and key (see the basic examples in either the initial setup or the site above)</em></div>
<div><i>*also please note I bind the lbTable object a few times so I can explain it clearly but you don't need to do this. &nbsp;You should be able to bind it once after page initialization and simply do .getTableAsync(), .InsertAsync(), UpdateAsync() etc calls against it</i></div>
<div><br />First, as they show in the examples lets create our Class. &nbsp;When you sync the class to the service, the service dynamically updates the database schema so you don't ever have to worry about creating the structure! &nbsp;Though I did try messing with the ID field....that was a bad idea so don't. &nbsp;Messing with the ID field is bad, don't do it. &nbsp;For each user I want to keep track of their overall score, their username, their uid (a unique identifier for them, and them alone) and a couple other score objects. &nbsp;For this example we'll stick with the basics:</div>
<div></div>
<div><strong><span style="color: #339966;">Class</span> <span style="color: #0000ff;">lbObject</span></strong></div>
<div><strong>{</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>int Id {get; set;}</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>string uid {get; set;}</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>string username {get; set;}</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>int&nbsp;score {get; set;}</strong></div>
<div><strong>}</strong></div>
<div></div>
<div>Next, in the page we plan to use this (assuming mainpage.xaml.cs) lets go ahead and create a global declaration:</div>
<div></div>
<div><strong><span style="color: #339966;">public</span> <span style="color: #0000ff;">IMobileServiceTable</span>&lt;<span style="color: #0000ff;">lbObject</span>&gt; lbTable;</strong></div>
<div></div>
<div>And now the fun part, using all this awesomeness. &nbsp;First, lets create a function that is going to either insert the entry or update the entry based on if it exists or not. &nbsp;You CAN do this server side if you want but I like doing it client side. &nbsp;I have the code to do so server-side if anyone is interested, just hit me up in the comments and I'll throw it up but the below is the cleanest way IMO. &nbsp;Here is the entire function:</div>
<div></div>
<div><strong><span style="color: #339966;">private async void</span> syncLeaderboardAsync(l<span style="color: #0000ff;">bObject</span> objectToSync)</strong></div>
<div><strong>{</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">try</span></strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>{</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">var</span> table =<span style="color: #0000ff;"> App</span>.MobileService.GetTable&lt;<span style="color: #0000ff;">lbObject</span>&gt;(); //<span color="#808080" style="color: #808080;">&nbsp;I do this here as an example, but you can do this on page initialization once</span></strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">var</span> itemList = <span style="color: #339966;">await</span> table.Where(i =&gt; i.uid == objectToSync.uid).ToListAsync();</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">if</span>(itemList.Count == <span style="color: #ff9900;">0</span>)</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>{</strong></div>
<div style="padding-left: 90px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">await</span> table.InsertAsync(objectToSync);</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>}</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">else</span></strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>{</strong></div>
<div style="padding-left: 90px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>objectToSync.Id = itemList[<span style="color: #ff9900;">0</span>].Id;</strong></div>
<div style="padding-left: 90px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">await</span> table.UpdateAsync(objectToSync);</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>}</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>}</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">catch</span></strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>{</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #808080;">//update a textBlock or some other method to let the user know there were network issues</span></strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>}</strong></div>
<div>}</div>
<p><br /><br /></p>
<div>BAM! &nbsp;You may be saying "um yah that's what you do, duh" but if you're like me you look at the code there and it makes perfect sense and none at all AT THE SAME TIME. &nbsp;<strong>Break down time </strong>&nbsp;- first things first. &nbsp;ALWAYS use try/catch blocks for network code. &nbsp;Want to fail certification right away and piss off your users if you somehow slip through? &nbsp;Don't use try/catch blocks on your network code. &nbsp;Wifi could be off, they could be using your app in airplane mode, the router is rebooting, they are torrenting too much, your packets got dropped...you never know. &nbsp;When I first started development I didn't use them and I was stupid. &nbsp;Don't be like me. &nbsp;They also let you notify the user if something failed, or let you do an auto retry with a global retry counter...etc. &nbsp;All kinds of cool stuff, use them.</div>
<p></p>
<div>Next up is this line:&nbsp;<strong><span style="color: #339966;">var</span>&nbsp;table =<span style="color: #0000ff;">&nbsp;App</span>.MobileService.GetTable&lt;<span style="color: #0000ff;">lbObject</span>&gt;(); &nbsp;</strong>Now this was my first major confusing point, GetTable seems to imply it's pulling down the ENTIRE table from the service but it's simply binding that object to a proxy connection to your table object...no data is getting pulled down at this point. &nbsp;Thus you need to pull down data but you want only pull down a select subset and that's where Linq comes in. &nbsp;Linq is AWESOME, don't be stupid like me and not figure it out as it's SUPER simple. &nbsp;<strong><span style="color: #339966;">var</span>&nbsp;itemList =&nbsp;<span style="color: #339966;">await</span>&nbsp;table.Where(i =&gt; i.uid == objectToSync.uid).ToListAsync(); &nbsp;</strong>So what this does is create a var (but it's just a list&lt;lbObject&gt; when it's all said and done) and then does some linq magic that pulls down the table as a listObject&nbsp;asynchronously. &nbsp;Now if you have a mobileServicesCollectionView&lt;blah&gt; you want to use, you can do a ToCollectionView() BUT NOTE that object is not Async, and you cannot await it. &nbsp;That means you need to setup a callback for when it receives data so that you can populate your UI with whatever data magic you pulled down. &nbsp;This was not clear to me, and I like Async stuff so just dump it to a list like above unless you really need a collectionView. &nbsp;Back to the call, we take the table object, and use a linq call .Where(). &nbsp;Inside the where we declare an object (I used "i" as it's easy, but you can call it" velociraptor" for all it matters) and since the table object has already been defined as an lbObject table that means your "i" object can be compared using the =&gt; Operator. thus the&nbsp;<strong>Where(i =&gt; i.uid == objectToSync.uid) </strong>equates to a "where all objects that the uid equals the same uid as the objectToSync's uid. &nbsp;FInally the ToListAsync() call connects to the service, uses the query you sent it and returns the data.</div>
<p></p>
<div>Now here is where things get interesting, if the uid doesn't exist, it will return an empty list and we can check against whether it returned anything or not. &nbsp;If it did, then we update it, if it's empty (i.e. the count is 0) we insert the new entry. &nbsp;The only piece we are missing here is how updateAsync works. &nbsp;Now, in theory using the above code you should only ever be inserting once with a given uid, so that means that said uid will only appear once in the table, and thus will only ever have one index, i.e. the Id field in the class. &nbsp;Since the database assigns this by default you only need to figure out what the index(Id) is and then assign that Id to your syncObject's Id and updateAsync will find that Id and update it. &nbsp;So, since already pulled down the table, and you know the table contained one object you simply need to access the tableObject's first entry, get it's Id, assign it to the syncObject and call the updateAsync Method -</div>
<div>
<div><strong><span class="Apple-tab-span"> </span>objectToSync.Id = itemList[<span>0</span>].Id;</strong></div>
<div><strong><span class="Apple-tab-span"> </span><span>await</span>&nbsp;table.UpdateAsync(objectToSync);</strong></div>
<div></div>
<div>Double Bam! &nbsp;You now have your table updating and syncing based on a given uid and it will only ever keep one object alive for a given UID which is awesome. &nbsp;At this point Linq kinda makes sense now, and we understand that the table object isn't actually the whole table just a bound proxy object so pulling down the leaderboard should be pretty easy...and if you assumed so you are correct! &nbsp;Below I'm assuming THIS time you bound the lbTableObject in page initialization and are just accesing it below</div>
<br />
<div><strong><span style="color: #339966;">private async</span> <span style="color: #339966;">void</span> getLeaderboard()</strong></div>
<div><strong>{</strong></div>
<div style="padding-left: 30px;"><strong><span style="color: #339966;"><span class="Apple-tab-span" style="white-space: pre;"> </span>try</span></strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>{</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #339966;">var</span> table = <span style="color: #339966;">await</span> lbTable.OrderByDescending( velociraptor =&gt; velociraptor.score).Take(10).ToListAsync();</strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: #808080;">//now bind it to your UI</span></strong></div>
<div style="padding-left: 60px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>leaderboardGridView.ItemsSource = table;</strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>}</strong></div>
<div style="padding-left: 30px;"></div>
<div style="padding-left: 30px;"><strong><span style="color: #339966;"><span class="Apple-tab-span" style="white-space: pre;"> </span>catch</span></strong></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>{</strong></div>
<div style="padding-left: 60px;"><span style="color: #808080;"><strong>//update user with network error text somehow</strong></span></div>
<div style="padding-left: 30px;"><strong><span class="Apple-tab-span" style="white-space: pre;"> </span>}</strong></div>
<div><strong>}</strong></div>
<br />
<div>And We're done. &nbsp;Super SIMPLE to pull the code down, and since it's Async as soon as the table is pulled down your UI will update. &nbsp;You might want to put in some textBlock that says "connecting to Leaderboard" that you hide after it successfully pulls it down, or displays the error if/when there are network issues. &nbsp;That said lets break down the Linq cause it's important. &nbsp;First, we apply a OrderByDescending which is awesome, but if you want ascending it's simply OrderBy. &nbsp;So we take the OrderByDescending, give it an object that is actually just a name for the lbObject since the lbTable is a collection of that class, (and notice we used velociraptor this time, it really doesn't matter) and then tell it to order it by the "score" of the object...then from that now descending ordered list of lbObjects we do another Linq call .Take(10) which takes the first 10 objects of the list. &nbsp;You can also do other stuff like Skip(3) and it skips the first 3, etc but that's all Linq magic and it should make perfect sense now how it works and how to use it. &nbsp;Finally we call ToListAsync which then connects to the service, takes our query we created with Linq and it gives us what we want. &nbsp;If you only have 6 objects and you requested 10, it'll give you 6 (no errors are thrown).</div>
</div>
<p></p>
<div>If your wondering how I'm grabbing the uid, I'm using the Live SDK, request the user to sign in once and then grab the AuthenticatedSafeCustomerId. &nbsp;I take that, throw it in a localSettings object and use it from then on out...there aren't any other easily identifiable uid/hardwareID's that make sense to use and the liveSDK is like 3 lines of code and a button...SUPER SIMPLE.</div>]]></content:encoded>
    </item>
  </channel>
</rss>