1.退出當前頁面ide
1 private void imgExit_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) 2 { 3 if (MessageBox.Show("肯定要退出當前頁面?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) 4 { 5 //Silverlight調用JS 6 ScriptObject Show = HtmlPage.Window.GetProperty("closeWin") as ScriptObject; 7 Show.InvokeSelf(); 8 } 9 }
2.跳轉到主頁面spa
1 private void imgExit_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) 2 { 3 if (MessageBox.Show("肯定要退出當前頁面?", "提示", MessageBoxButton.OKCancel) == MessageBoxResult.OK) 4 { 5 HtmlWindow window = HtmlPage.Window; 6 window.Navigate(new Uri("Default.aspx", UriKind.Relative)); 7 8 } 9 }