Sunday, August 12, 2012

Windows 8: View And Renew Developer License

Developer licenses are only valid for a given period of time e.g. one month. After expiration you may not run your own applications any more. Even the XAML-Designer in Visual Studio 2012 states that your developer license expired and you may not view any preview of your pages. Usually Visual Studio 2012 then pops up a dialog in which you can sign in with your LiveID and renew that developer license.

It happened to me that this dialog never showed up. So what to do?

There are three PowerShell Commandlets that can be used to view your current Windows 8 developer license and its validity, renew an expired license or return a license:

It is important to run the PowerShell as an Administrator to use those commands.

  1. View your current Developer license, its validity and expiration date:

    PS C:\WINDOWS\system32> Get-WindowsDeveloperLicense

    PowerShell: Get-WindowsDeveloperLicense showing the validity and expiration of the current developer license
  2. Renew a Developer license:
    This command pops up a dialog in which you can sign in to renew your developer license.

    PS C:\WINDOWS\system32> Show-WindowsDeveloperLicenseRegistration

    show registration dialog 1
    show registration dialog 2
  3. Unregister a Developer license:

    PS C:\WINDOWS\system32> Unregister-WindowsDeveloperLicense

Friday, August 10, 2012

Windows 8: Hide Virtual Keyboard Programmatically

The visibility of the virtual keyboard in Windows 8 Metro Style Apps depends on whether a text input enabled control is focused or not:

In the left image the user tapped into a TextBox control. This tap sets the focus on that TextBox and the virtual keyboard appeared. After having entered some Text the user taps the “OK” button and the virtual keyboard hides again due to the loss of focus (right image).

with keyboard       without keyboard copy

But sometimes there is no Button control to hit after having entered some text and thus the virtual keyboard does not hide and still might cover important parts of the UI. In order to hide the virtual keyboard no matter where the user taps outside the TextBox one could set the focus to a hidden button programmatically.

See the following example:

XAML Markup:

   1: <Grid>
   2:   <Button x:Name="hiddenButton" Opacity="0" />
   3:   <TextBox Width="300" Margin="50" 
   4:            LostFocus="TextBox_LostFocus" />
   5: </Grid>

C# Code Behind:



   1: private void TextBox_LostFocus(object sender, RoutedEventArgs e)
   2: {
   3:     this.hiddenButton.Focus(Windows.UI.Xaml.FocusState.Pointer);
   4: }