// Loads webview landing page after Idle time longer than this.timeout (+/- 1 minute)
        private async void ResetOnIdle()
        {
            // checks if idle time is longer than timeout and current Uri is not home
            if (timeout <= GetIdleTime() && uri != currentUri)
            {
                // loads landing page in webview
                WVWebBrowser.Navigate(new Uri(this.uri));
            }
            // waits 1 minute before re executing resetOnIdle();
            await Task.Delay(30000);

            ResetOnIdle();
        }
 public MainPage()
 {
     // set timeout in milliseconds
     timeout = 300000;
     // set home uri
     uri = "https://www.wikipedia.org";
     // set regex for validUri's
     validUrl = new Regex(@"^https:\/\/(([a-zA-Z0-9\-\\_\.]*)\.|)wikipedia.org(\/.*|)$"); // all https sites, domains and sub-domains of wikipedia.org
     InitializeComponent();
     WVWebBrowser.Navigate(new Uri(uri));
     // setting current uri
     currentUri = uri;
     WVWebBrowser.NavigationStarting += WVWebBrowser_NavigationStarting;
     // Initializes the reset scheduler
     ResetOnIdle();
 }
 private void AppBarHome_Click(Object sender, RoutedEventArgs e)
 {
     WVWebBrowser.Navigate(new Uri(this.uri));
 }
Beispiel #4
0
 public WebPageView()
 {
     this.InitializeComponent();
     WVWebBrowser.Navigate(new Uri("http://www.google.com"));
 }