I have created a simple modern UI app that shows the contents of the localhost site on a WebView when the app loads. The app works perfectly when I debug it. I have deployed it to another machine with Visual Studio Remote Tools and it works as expected.
However, when I publish it in the Windows store, and then install the app from there, the page is blank. The name of the app in the store is named Locked Browser Lite.
I would appreciate any suggestions.
Here's the code:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
namespace App3
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.Loaded += PageLoaded;
this.Unloaded += PageUnloaded;
wvMain.HorizontalAlignment = HorizontalAlignment.Stretch;
wvMain.VerticalAlignment = VerticalAlignment.Stretch;
//wvMain.Source = new Uri("http://localhost");
}
private void PageUnloaded(object sender, RoutedEventArgs e)
{
Window.Current.SizeChanged -= Window_SizeChanged;
}
private void PageLoaded(object sender, RoutedEventArgs e)
{
Window.Current.SizeChanged += Window_SizeChanged;
Uri targeturi = new Uri("http://localhost");
wvMain.Navigate(targeturi);
//wvMain.Refresh();
}
private void Window_SizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
wvMain.HorizontalAlignment = HorizontalAlignment.Stretch;
wvMain.VerticalAlignment = VerticalAlignment.Stretch;
}
private void btnReload_Click(object sender, RoutedEventArgs e)
{
PageLoaded(sender, e);
}
}
}