void mrAjax_RunWorkerCompleted(object sender, EventArgs e) { if (page == null) { page = new Writer.Page(pageRequest); MessageBox.Show("An internal error occurred when retrieving the page. Usually this means you are out of memory or some resource on the page cannot be downloaded. (Yes, I checked both the cdn and www)."); RemoveControl(pageLoadingProgress);RemoveControl(progressLabel); errorLabel = new Label(); errorLabel.AutoSize = true; errorLabel.Text = "Press F5 to try again."; mainPanel.Controls.Add(errorLabel); errorLabel.Location = new Point(mainPanel.Width / 2 - errorLabel.Width / 2, mainPanel.Height / 2 - errorLabel.Height / 2); }else LoadPage(); flashWarning.Visible = pageContainsFlash && (uiToggleButton.Text != "Show UI"); }
public Writer.Page ToWriterObject(int pageNo, bool x2) { var page = new Writer.Page(pageNo); var selectedRes = (from b in Resources where b.pageId == pageNo && b.x2 == false select b); var selectedMeta = (from b in PageMeta where b.pageId == pageNo && b.x2 == false select b).Include(m => m.narr).Include(m => m.lines).Include(m => m.narr.subTexts).Include(m => m.lines.Select(l => l.subTexts)).First(); var selectedLinks = (from b in Links where b.pageId == pageNo select b).ToList(); List < Parser.Link> lnks = new List < Parser.Link>(); foreach (var l in selectedLinks) lnks.Add(new Parser.Link(l.originalText, l.linkTo)); page.links = lnks.ToArray(); List<Parser.Resource> res = new List<Parser.Resource>(); foreach (var r in selectedRes) { var tmp = new Parser.Resource(r.data, r.originalFileName, r.titleText); tmp.isInPesterLog = r.isInPesterLog; res.Add(tmp); } page.resources = res.ToArray(); page.meta = new Parser.Text(); page.meta.altText = selectedMeta.altText; page.meta.lines = selectedMeta.GetScriptLines(); if (selectedMeta.narr != null) page.meta.narr = selectedMeta.narr.ToParserObject(); else if (page.meta.lines == null) page.meta.narr = new Parser.Text.ScriptLine("#000000", "", 0); page.meta.promptType = selectedMeta.promptType; page.meta.title = selectedMeta.title; if(x2){ page.links2 = page.links; page.links = null; selectedRes = (from b in Resources where b.pageId == pageNo && b.x2 == true select b); selectedMeta = (from b in PageMeta where b.pageId == pageNo && b.x2 == true select b).Include(m => m.narr).Include(m => m.lines).Include(m => m.narr.subTexts).Include(m => m.lines.Select(l => l.subTexts)).First(); res.Clear(); foreach (var r in selectedRes) { var tmp = new Parser.Resource(r.data, r.originalFileName, r.titleText); tmp.isInPesterLog = r.isInPesterLog; res.Add(tmp); } page.resources2 = res.ToArray(); page.meta2 = new Parser.Text(); page.meta2.altText = selectedMeta.altText; page.meta2.lines = selectedMeta.GetScriptLines(); if (selectedMeta.narr != null) page.meta2.narr = selectedMeta.narr.ToParserObject(); else if (page.meta2.lines == null) page.meta2.narr = new Parser.Text.ScriptLine("#000000", "", 0); page.meta2.promptType = selectedMeta.promptType; page.meta2.title = selectedMeta.title; } return page; }
private void mrAjax_DoWork(object sender, EventArgs e) { page = null; page = db.WaitPage(pageRequest,mrAjax); }