Category name:WinRT

DEP0700 : Registration of the app failed. Rejecting a request to register from because the files are on a network share.

I wanted to run my app an my VM, but got the above error…

A quick search on google lead me to this thread on DevCenter: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/3fc1f3cf-2d8b-4dee-a348-40d0bf2c3c66/

The answer there is spot on!

I chose option 1, setting my debug option to Remote and setting by Debug option to localhost. Works like a charm! Thanks Gearard Boland for providing us with the answer!

Happy coding!

 

PS. Malavikas comment made me create this image:

Installing Win8 in VHD for use with Virtualbox using install.WIM

I found this wonderful solution for installing Windows 8 on a VHD for dual-boot using the imagex tool. You can read about it here: http://blogs.technet.com/b/haroldwong/archive/2012/08/18/how-to-create-windows-8-vhd-for-boot-to-vhd-using-simple-easy-to-follow-steps.aspx

Problem I experienced now was that I needed a VitualBox Windows 8 machine and there it did not work. I got the message ‘BOOT FAILURE’ after trying to start up that installation.

I ended up using WIM2VHD with the /HyperV switch to prep the VHD for Hyper-V. Then I created a new VirtualBox machine with the vhd. I removed the SATA controller entirely and added new IDE harddisk using the vhd.

And now I am running Windows 8 in VirtualBox!

 

Happy coding!

Status update for In the Pocket

I am still working on my app In the Pocket, but my focus is now on getting my paid version out.

The paid version of In The Pocket (release 1) will add the following features to In The Pocket Free:

  • Being able to save articles locally (implemented using DiffBot service)
  • Queuing added items even when you have no internet
  • Marking items as read even when you have no internet
  • Being able to mark many items as read from the main screen
  • Being able to read items that have been archived (Marked as read)

You may wander, why I want to have all these offline features. The reason is simple and I will explain below.

Although the moments are scarce, we are still not always connected to the internet with our tablet or laptop. When we are on the move, we have a phone that is still connected, our other devices are usually not. You can set up Connection sharing to have a wifi connection always, but your data plan would have to be a big one and your bill will be huge. For most people this is not an option.

So better to plan for an ‘occasionally connected’ application, but that means you will have to have all the features available that you would have when you are online.

Installing your app on your Windows RT device

Alright… so my app is almost finished and I want to install it for real on my Surface tablet. How do I do that? Is it possible?

Yes it is.

NB: People, seems like I was not entirely accurate. Before you can install the package this way, you need a developer license for your Win RT device. You can get one by installing the remote tools for VS2012 on your Surface (http://go.microsoft.com/?linkid=9810474) and remote debug at least one app you created yourself.

It involves 4 steps:

  1. Create the app packages
  2. Get files to your tablet
  3. Install the certificate included in the package on your tablet
  4. Install the app on your device

Create the app package

To do this you can navigate to Project > Store > Create App Packages…

You will be asked whether you have a Windows store account, just select ‘no’ and continue. Now you will be asked for the details of your package like the version and the architecture.

Modify as needed or just click ‘Create’. After that you will be shown a window with a link to the outputpath of the package and the possibility to start the Windows App Certification Kit. Klik on the first link to be taken to your package and then click ‘OK’.

You’ll find an .appxupload file and a folder with more files. The .appxupload file is just a zip (if you rename you can open it). The folder contain the interesting documents though…

Getting the files on your tablet

There is one awesome way to get the files on your tablet: SkyDrive! Of course mail, usb or similar will also work.

Move these files to your device: the .appx file and the certificate. Optionally you could include the .appxsym file to include the symbols. BTW both the appx and the appxsym files are zip files.

I placed the files in my SkyDrive and downloaded them to my desktop on my tablet.

Install the certificate on your tablet

When I open the certificate file on my tablet I get option to install the certificate. Now, you should install it to the local machine, make sure the certificate is installed in the ‘Trusted Root Certification Authorities’ store (NOT automatically selected).

Now this step is done… easy right?! On to the files stage: installing your app…

Install the app on your device

Open a powershell window in administrator mode. (Open start, search Powershell, select by dragging down, select ‘Run as Administrator’)

In the powershell console, navigate to the place where your application is. (Hint: ‘cd’ for change directory works fine…)

Now type ‘Add-‘ and tab to let powershell finish the command. It now says: Add-AppxPackage

Just specify the appx filename: Add-AppxPackage .<filename>.appx

Hit enter. The app should now install.

NB: People, seems like I was not entirely accurate. Before you can install the package this way, you need a developer license for your Win RT device. You can get one by installing the remote tools for VS2012 on your Surface (http://go.microsoft.com/?linkid=9810474) and remote debug at least one app you created yourself.

Happy coding! And running, I guess…

Windows 8 –Live tiles

My friend Pascal (http://www.pazquality.com/) is also working on a windows 8 application. He was having trouble with getting the Live tiles to work so I volunteered to find out how to cycle to a couple of tiles and keep cycling between them.

Well, it’s surprisingly simple… Here’s the code that I wrote in the constructor of the App:

//I installed the following nuget package: http://nuget.org/packages/NotificationsExtensions.WinRT


//This will give you access to the Templates without having to go through the xml…


//Add to Tiles


var x1 = TileContentFactory.CreateTileSquareText01();

x1.TextHeading.Text = “Text 1”;


var x2 = TileContentFactory.CreateTileSquareText01();

x2.TextHeading.Text = “Text 2”;


//Make ScheduledTileNotifications out of them with a due date of 10 and 20 seconds from now…


ScheduledTileNotification n1 = new
ScheduledTileNotification(

x1.GetXml(), new
DateTimeOffset(DateTime.Now.AddSeconds(10)));


ScheduledTileNotification n2 = new
ScheduledTileNotification(

x2.GetXml(), new
DateTimeOffset(DateTime.Now.AddSeconds(20)));


//Initialize the TileUpdater


var m = TileUpdateManager.CreateTileUpdaterForApplication();


//Enable Queuing (this is what makes it cycle….)

m.EnableNotificationQueue(true);


//Add the ScheduledTileNotifications to the schedule…

m.AddToSchedule(n1);

m.AddToSchedule(n2);

The tile is now cycling through these 2 notifications…

Happy coding, pazzie!

Windows 8 & Caliburn.Micro – Being a Sharing Target

I wanted to be able to add items to GetPocket.com via my app. To do this in the nicest way possible, it would be awesome to be able to share urls from other apps to my app.

I saw that you can add an OnShareTargetActivated method to your app.xaml.cs where you can capture the ShareOperation.

It looks like this:

protected
override
void OnShareTargetActivated(ShareTargetActivatedEventArgs args)

{

var op = args.ShareOperation;

}

Information how to implement Share Target Contract without Caliburn.Micro can be found at http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh871368.aspx

However… I want my Caliburn.Micro!

This question on Stack Overflow (the answer, that is) shows us the MarkerMetro WinRT example. But this is not our default Caliburn.Micro but a fork… I don’t want no forks, but the code showed me the way. This is how they did it:

protected
override
void OnShareTargetActivated(ShareTargetActivatedEventArgs args)

{

// Normally wouldn’t need to do this but need the container to be initialised

Initialise();

 

// replace the share operation in the container

container.UnregisterHandler(typeof(ShareOperation), null);

container.Instance(args.ShareOperation);

 

DisplayRootViewFor<ShareTargetViewModel>();

}

Basically the point is to unregister the already registered instance if the shareoperation and than register a new one… Unfortunately, the standard Caliburn.Micro doesn’t have the UnregisteredHandler method.

So I ended up creating a ShareContext class which has a ShareOperation property.:

public
class
ShareContext

{

public
ShareOperation Operation { get; set; }

}

This way I can register an instance of ShareContext in the Configure method and leave the Operation parameter null.

So here is my code:

protected
override
void OnShareTargetActivated(ShareTargetActivatedEventArgs args)

{

Initialise();

ShareContext c = container.GetInstance(typeof(ShareContext), null) as
ShareContext;

c.Operation = args.ShareOperation;

DisplayRootViewFor<AddByShareViewModel>();

}

Windows 8 – Using Caliburn.Micro

A collegue of mine followed this blogpost (http://www.jfarrell.net/2012/11/caliburn-from-windows-8-apps.html) to implement Caliburn.Micro in the WinRT app…

He stumbled upon a problem. The post seems to suggest that you should remove all content from your App.xaml, but then the reference to the resource common/standardstyles.xaml will be missing and the default item templates for pages are going to give you errors.

I followed this blogpost (http://mikaelkoskinen.net/caliburn-micro-for-winrt-getting-started) which prevented that issue… However, I still had a problem with getting a new Basic Page to use my ViewModel.

The problem was the line marked in yellow below:

<common:LayoutAwarePage

x:Name=”pageRoot”

x:Class=”InThePocket.BasicPage1″

DataContext=”{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}”

xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”

xmlns:local=”using:InThePocket”

xmlns:common=”using:InThePocket.Common”

xmlns:d=”http://schemas.microsoft.com/expression/blend/2008″

xmlns:mc=”http://schemas.openxmlformats.org/markup-compatibility/2006″

mc:Ignorable=”d”>


<common:LayoutAwarePage>


This line binds the page to a DefaultViewModel and thus overrides the binding that Caliburn.Micro creates.


Hope it will help you avoid or solve these problems…

Windows 8 – WebClient and the AppBar or flyouts

Here’s what I found out the hard way. If you show web content in a WebView control and you want to use the AppBar in the same page (overlapping the WebView) than the AppBar isn’t shown. This allegedly also happens to flyouts.

Very annoying. Apparently it has to do with the internal drawing logic of the WebView control. Luckily there is a way around it. As Alex Yakhnin’s blog (http://blogs.msdn.com/b/priozersk/archive/2012/08/13/how-to-display-charms-on-a-top-of-the-webview.aspx) suggests you can replace the current content of the WebView with the same content used as a brush on a rectangle and this works as a charm.

So here’s what I did:

private
void AppBar_Opened_1(object sender, object e)

{


WebViewBrush wvb = new
WebViewBrush();

wvb.SourceName = “contentView”;

wvb.SetSource(WebViewCtrl);

wvb.Redraw();

WebViewBrushRectangle.Fill = wvb;

WebViewCtrl.Visibility = Windows.UI.Xaml.Visibility.Collapsed;


}


private
void AppBar_Closed_1(object sender, object e)

{

WebViewCtrl.Visibility = Windows.UI.Xaml.Visibility.Visible;

WebViewBrushRectangle.Fill = new
SolidColorBrush(Windows.UI.Colors.Transparent);


}


And the result is: