locked
Is the XAML portion of the "Windows Store sample application" included in "HV Library for Windows 8" valid? RRS feed

  • Question

  • In the sample code found here:  http://healthvaultwin8.codeplex.com/

    I am perplexed by the following step:

    • Now right-click the References node of the XAML project created above and select Add Reference....
    • Select the HealthVault.Foundation project and the HealthVault.Runtime project and continue.

    How does one select a project as a reference?

    Thanks.

    Thursday, March 28, 2013 11:01 AM

All replies

  • After you click on Add Reference, you will have to select the Solutions section to see the projects. And then check the checkboxes to select the projects to be added as references.

    Thursday, March 28, 2013 5:58 PM
  • Even though I have installed the SDK, I cannot find those items on my machine.  I cannot see the full path in your illustration so I cannot be sure, but I have searched my entire PC.  What are these items?  I don't see any extension. Are they dlls?  It's not clear.  Where do I get them from?  Thanks.

    Thursday, March 28, 2013 7:34 PM
  • The SDK download is a zip file: HealthVaultLib-Windows8-0.2.zip. You can unzip it to any folder you want. I chose C:\Program Files (x86)\Microsoft HealthVault\SDK\HealthVaultLib-Windows8-0.2.

    Once that is done, you will have to follow the steps outlined under XAML-based Windows Store applications for HealthVault at http://healthvaultwin8.codeplex.com/.

    In my case HealthVault.Foundation.csproj was at C:\Program Files (x86)\Microsoft HealthVault\SDK\HealthVaultLib-Windows8-0.2\hvsdk and HealthVault.Runtime.csproj was at C:\Program Files (x86)\Microsoft HealthVault\SDK\HealthVaultLib-Windows8-0.2\hvrt. They are not dlls. They are .csproj files as the documentation says.

    Thursday, March 28, 2013 7:47 PM
  • I have done what you say.  The javascript-based sample works fine.   And I can see that it references: HealthVault.Runtime and HealthVault.Foundation.  But the reference manager will not let me select a *.csproj.  Those two projects do not appear under Solution/Projects, so I have to browse for them.  The browser has a set of extension masks which do not include *.csproj.  If I change the drop-down to All Files (*.*) and select the *.csproj then I get an error:

    A reference to 'C:\Users\jim\Documents\Visual Studio 2012\Projects\hvrt\HealthVault.Runtime.csproj' could not be added.  Please make sure that the file is accessible, and that it is a valid assembly or COM component.

    So what do I do?

    Thursday, March 28, 2013 8:14 PM
  • I am using Visual Studio 2012.  I just started fresh and tried it again and it does not work.  There are not too many steps so I'm not sure were the discrepancy is.  For the 2nd step I have to "Add->Existing Item..."  since there is no "Add->Existing Project", I don't know whether that's a clue?  Are you using VS 2012?  Are there any environmental parameters that I should check?  In the "Reference Manager" if the projects don't automatically appear in "Solution/Projects" I'm sunk, because the Browse tool won't accept *.csproj.

    Thursday, March 28, 2013 8:39 PM
  • You have to right-click on the Solution in (not the Project) to see Add->Existing Project.
    Thursday, March 28, 2013 8:43 PM
  • Okay that helped.  But I not quite there yet.  In the two line code snippet:

    var app = new HealthVault.Foundation.HealthVaultApp("c24d9800-236f-48e3-b06b-bdf90a6cb0be");
    await app.StartAsync();

    Both lines generate errors.  I've fixed the first line.  Can you help with the second? 

    The remaining error is:

    The 'await' operator can only be used within an async method.  Consider marking this method with the 'async' modifier and change its return type to 'Task'.

    ----------

    I'm also not sure why the documentation dated Jan. 29th 2013 doesn't seem to work as stated.  Do I have the wrong version of something?

    Thursday, March 28, 2013 9:40 PM
  • Sorry for the issues. We have never run any of the XAML code since we developed the Windows 8 SDK while doing it using Windows RunTime and JavaScript. We never tried it out in XAML and only provided snippets of how it should work. After doing a bit more research it looks like you cannot await the app.StartAsync since the signature of async methods in C# 4.5 are not supported in the Windows Runtime (Tasks are not RT compatible).

    I don't have an easy answer for you but basically we will need to do more work and research and expose new methods for you to be able to get this working in XAML.

    I will let my team know and we'll start looking into it. If you really want to jump in, I'd say try it out using HTML5/JS.

    Friday, March 29, 2013 5:47 AM
  • I am glad that I found this thread as I was just about to try to use XAML code myself. Clearly, XAML is a big part of Win8 (and I learned to love Silverlight long time ago), so please let us all know when there is progress on this front.

    It's pretty amazing to see how quickly Silverlight was overrun by HTML5 / JS considering that this is taking place at Microsoft :-)


    Nik

    Thursday, April 11, 2013 12:52 AM
  • There is an error in the parameter to startup the applicaiton. Use the following:

    protected override async void OnNavigatedTo(NavigationEventArgs e)
            {
                var app = new HealthVault.Foundation.HealthVaultApp( new HealthVault.Foundation.HealthVaultAppSettings("c24d9800-236f-48e3-b06b-bdf90a6cb0be"));
                await app.StartAsync();
            }

    Saturday, June 29, 2013 12:12 PM
  • Visual Studio 2012 will not accept:

     await app.StartAsync();

    It provides the following hint:

    (local variable) HealthVaultFoundation.HealthVaultApp app

    Error:
       The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'

    -----------

    I don't know enough to understand whether this is valid advice or not.  Whatever the case, I cannot compile the example and study the xaml techniques employed which was my goal.

    Saturday, June 29, 2013 3:06 PM