public void TestDefaultPage() { MockPage page = new MockPage(); server.AddPage(page); string text = WebUtils.PlainText(WebUtils.ReadPage(server.Url)); Assert.IsTrue(text.Contains("test page"), "Didn't output test page"); }
void TryToStartNavBot() { try { server = new PageServer(); server.ReportError += new PageServer.ErrorMessageHandler(ReportError); server.AddPage(new WelcomePage()); //server.AddPage(new HelpPage()); server.AddPage(new SearchPage(new TradeFinderFactory(eveDirectory.Text))); server.AddPage(new ReportsPage(new TradeFinderFactory(eveDirectory.Text))); try { Clipboard.SetText(ConfigurationSettings.AppSettings["URLPrefix"]); } catch (Exception) { } notifyIcon.Visible = true; Hide(); notifyIcon.ShowBalloonTip(7000); } catch (PlatformNotSupportedException e) { WindowState = FormWindowState.Normal; if (server != null) { server.Close(); } ReportError("Sorry, NavBot requires Windows XP SP2, Windows Vista or Windows Server 2003 to run.\nNo, really, I *am* sorry, but Microsoft simply doesn't support the HttpListener class on anything else.", e.ToString()); } catch (Exception e) { WindowState = FormWindowState.Normal; if (server != null) { server.Close(); ReportError("Are you sure EVE stores your market logs in \"" + eveDirectory.Text + "\"?\nIf so, then something else has gone wrong.\nI've put some extra error information in your clipboard - if you send it to Tejar then he'll do his best to help you.", e.ToString()); } else { ReportError("Is another copy of NavBot already running? If not, try restarting or send an EVE mail to Tejar for help. \nI've put some extra error information in your clipboard that you can send to him.", e.ToString()); } } }
void TryToStartNavBot() { try { server = new PageServer(); server.ReportError += new PageServer.ErrorMessageHandler(ReportError); server.AddPage(new WelcomePage()); //server.AddPage(new HelpPage()); server.AddPage(new SearchPage(new TradeFinderFactory(eveDirectory.Text))); server.AddPage(new ReportsPage(new TradeFinderFactory(eveDirectory.Text))); try { Clipboard.SetText(ConfigurationSettings.AppSettings["URLPrefix"]); } catch (Exception) { } notifyIcon.Visible = true; Hide(); notifyIcon.ShowBalloonTip(7000); } catch (PlatformNotSupportedException e) { WindowState = FormWindowState.Normal; if (server != null) { server.Close(); } ReportError("Sorry, NavBot requires Windows XP SP2, Windows Vista or Windows Server 2003 to run.\nNo, really, I *am* sorry, but Microsoft simply doesn't support the HttpListener class on anything else.", e.ToString()); } catch (Exception e) { WindowState = FormWindowState.Normal; if (server != null) { server.Close(); ReportError("Are you sure EVE stores your market logs in \"" + eveDirectory.Text + "\"?\nIf so, then something else has gone wrong.\nI've put some extra error information in your clipboard - if you send it to Tejar then he'll do his best to help you.", e.ToString()); } else { ReportError("Is another copy of NavBot already running? If not, try restarting or send an EVE mail to Tejar for help. \nI've put some extra error information in your clipboard that you can send to him.", e.ToString()); } } }