private void comboLang_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboLang.SelectedIndex == -1) return; try { frame.Source = new Uri(string.Format("http://cvronmin.github.io/metocraft/{0}/main.html", comboLang.SelectedItem as string)); } catch (WebException ex) { var ru = ex.Response.ResponseUri; string s = ((HttpWebResponse)ex.Response).StatusCode.GetTypeCode() + ((HttpWebResponse)ex.Response).StatusCode.ToString(); /*switch (((HttpWebResponse)ex.Response).StatusCode) { case HttpStatusCode.NotFound: s = "404 Not Found"; break; case HttpStatusCode.Forbidden: s = "403 Forbidden"; break; case HttpStatusCode.BadGateway: break; case HttpStatusCode.GatewayTimeout: break; default: break; }*/ var a = new PageHttpError(); a.OnRetry += delegate { frame.Source = ru; }; frame.Navigate(a.SetStatus(s)); } //frame.Source = new Uri(string.Format("pack://siteoforigin:,,,/Help/{0}/main.html", comboLang.SelectedItem as string)); }
private void frame_NavigationFailed(object sender, NavigationFailedEventArgs e) { e.Handled = true; if (e.Exception is WebException) { WebException ex = e.Exception as WebException; var ru = ex.Response.ResponseUri; string s = ((int)((HttpWebResponse)ex.Response).StatusCode) + " " + ((HttpWebResponse)ex.Response).StatusCode.ToString(); var a = new PageHttpError(); a.OnRetry += delegate { frame.Source = ru; }; frame.Navigate(a.SetStatus(s)); } }