1.退出当前页面
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.跳转到主页面
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 }