/// <summary> /// 打开浏览器 /// </summary> private void openInWebBrowser() { foreach (Cookie cookie in cookieContainer.GetCookies(new Uri("https://dynamic.12306.cn/otsweb/loginAction.do?method=login"))) { InternetSetCookie( "https://" + cookie.Domain.ToString(), cookie.Name.ToString(), cookie.Value.ToString() + ";expires=Sun,22-Feb-2099 00:00:00 GMT"); } string url = "https://dynamic.12306.cn/otsweb/"; if (radTickerWebBrowser.Checked == true) { TickerWebBrowser tw = new TickerWebBrowser(); tw.Url = url; tw.ShowDialog(); } else if (radIE.Checked == true) { System.Diagnostics.Process.Start("IExplore.exe", url); } else if (radDefaultWebBrowser.Checked == true) { try { System.Diagnostics.Process.Start(url); } catch (System.ComponentModel.Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) { MessageBox.Show("未找到您的默认Web浏览器!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); radTickerWebBrowser.Checked = true; } } catch (System.Exception other) { MessageBox.Show(other.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
/// <summary> /// 打开浏览器 /// </summary> private void openInWebBrowser() { foreach (Cookie cookie in cookieContainer.GetCookies(new Uri("https://dynamic.12306.cn/otsweb/loginAction.do?method=login"))) { InternetSetCookie( "https://" + cookie.Domain.ToString(), cookie.Name.ToString(), cookie.Value.ToString() + ";expires=Sun,22-Feb-2099 00:00:00 GMT"); } string url="https://dynamic.12306.cn/otsweb/"; if (radTickerWebBrowser.Checked == true) { TickerWebBrowser tw = new TickerWebBrowser(); tw.Url = url; tw.ShowDialog(); } else if (radIE.Checked == true) { System.Diagnostics.Process.Start("IExplore.exe", url); } else if (radDefaultWebBrowser.Checked == true) { try { System.Diagnostics.Process.Start(url); } catch(System.ComponentModel.Win32Exception noBrowser) { if (noBrowser.ErrorCode == -2147467259) { MessageBox.Show("未找到您的默认Web浏览器!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); radTickerWebBrowser.Checked = true; } } catch (System.Exception other) { MessageBox.Show(other.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }