static int Main (string [] args) { HTML html; Window win; Application.Init (); html = new HTML (); win = new Window ("Test"); ScrolledWindow sw = new ScrolledWindow (); win.Add (sw); sw.Add (html); HTMLStream s = html.Begin ("text/html"); if (args.Length > 0) { using (StreamReader r = File.OpenText (args [0])) s.Write (r.ReadToEnd ()); } else { s.Write ("<html><body>"); s.Write ("Hello world!"); } html.End (s, HTMLStreamStatus.Ok); win.ShowAll (); Application.Run (); return 0; }
/// Create new instance of Html Renderer public GtkHtmlHtmlRender(Gtk.Window parent) { this.parentWindow = parent; html_panel = new HTML(); html_panel.Show(); html_panel.Submit += new SubmitHandler(SubmitRequest); html_panel.UrlRequested += new UrlRequestedHandler (UrlRequested); }
public bool Initialize() { try { html_panel = new HTML(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); return(false); } html_panel.Show(); html_panel.LinkClicked += new LinkClickedHandler(LinkClicked); html_panel.OnUrl += new OnUrlHandler(OnUrlMouseOver); html_panel.UrlRequested += new UrlRequestedHandler(UrlRequested); return(true); }
private void PrintRelatedSites() { if (HistoricalFigure.RelatedSites.Count > 0) { HTML.AppendLine(Bold("Related Sites") + LineBreak); StartList(ListType.Unordered); foreach (SiteLink link in HistoricalFigure.RelatedSites) { string linkString = link.Site.ToLink() + ", " + link.Type.GetDescription() + " (" + (link.Type == SiteLinkType.Occupation ? link.OccupationID : link.SubID) + ") "; if (link.Entity != null) { linkString += "" + link.Entity.ToLink(); } HTML.AppendLine(ListItem + linkString); } EndList(ListType.Unordered); } }
//완전삭제버튼을 만든다. public static string DeletePerfectButton(string daID, System.Int16 daStatus) { string retValue; if (daStatus == 0 && Cookie.Self["DeptName"] == "기획/관리" && Convert.ToInt16(Cookie.Self["sLevel"]) >= 30) { URLQuery.Self.RemoveAll(); URLQuery.Self["mode"] = "dd"; URLQuery.Self["daID"] = daID; retValue = HTML.MakeLink("javascript:ConfirmJ('문서자료를 영구히 삭제하시겠습니까?','DocList.aspx?" + URLQuery.Self.GetQueryString() + "')", "<img src='../../zImages/btn_admin_completedel.gif'>"); } else { retValue = ""; } return(retValue); }
private void PrintBeastAttacks() { if (HistoricalFigure.BeastAttacks != null && HistoricalFigure.BeastAttacks.Count > 0) { HTML.AppendLine(Bold("Beast Attacks")); StartList(ListType.Ordered); foreach (BeastAttack attack in HistoricalFigure.BeastAttacks) { HTML.AppendLine(ListItem + attack.StartYear + ", " + MakeLink(attack.GetOrdinal(attack.Ordinal) + "rampage in ", attack) + attack.Site.ToLink()); if (attack.GetSubEvents().OfType <HFDied>().Any()) { HTML.Append(" (Kills: " + attack.GetSubEvents().OfType <HFDied>().Count() + ")"); } } EndList(ListType.Ordered); HTML.AppendLine(LineBreak); } }
private string sideColor(string orgName, string orgSide) { orgSide = orgSide.ToLower(); switch (orgSide) { case "clan": return(HTML.CreateColorString(RichTextWindow.ColorOrange, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(orgName))); case "neutral": return(HTML.CreateColorString("FFFFFF", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(orgName))); case "omni": return(HTML.CreateColorString(RichTextWindow.ColorBlue, CultureInfo.CurrentCulture.TextInfo.ToTitleCase(orgName))); default: return(HTML.CreateColorString("FFFFFF", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(orgName))); } }
private void OnAuctionAbortCommand(BotShell bot, CommandArgs e) { if (!this._running) { bot.SendReply(e, "There is no auction to abort"); return; } this._timer.Stop(); this._running = false; this._item = null; this._timeLeft = 0; this._currentBid = 0; this._proxyBid = 0; this._bidder = null; bot.SendPrivateChannelMessage(bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender) + " has aborted the auction"); bot.SendReply(e, "You aborted the auction"); this._core.Log(e.Sender, e.Sender, this.InternalName, "auction", e.Sender + " has aborted the auction"); }
/// <summary> /// 供前端显示的专业最顶级分类 /// </summary> /// <param name="orgid"></param> /// <param name="count"></param> /// <returns></returns> public Song.Entities.Subject[] ShowRoot(int orgid, int count) { Song.Entities.Subject[] sbjs = Business.Do <ISubject>().SubjectCount(orgid, string.Empty, true, 0, count); string path = Upload.Get["Subject"].Virtual; foreach (Song.Entities.Subject c in sbjs) { c.Sbj_Logo = path + c.Sbj_Logo; c.Sbj_LogoSmall = path + c.Sbj_LogoSmall; //如果别名为空,则别名等于专业名称 if (string.IsNullOrWhiteSpace(c.Sbj_ByName) || c.Sbj_ByName.Trim() == "") { c.Sbj_ByName = c.Sbj_Name; } c.Sbj_Intro = HTML.ClearTag(c.Sbj_Intro); } return(sbjs); }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var img = sceneData.SelectSingleText("//img[@id='video_jacket_img']/@src"); if (!string.IsNullOrEmpty(img)) { result.Add(new RemoteImageInfo { Url = $"http:{img}", Type = ImageType.Primary, }); } var sceneImages = sceneData.SelectNodesSafe("//div[@class='previewthumbs']/img"); foreach (var sceneImage in sceneImages) { img = $"http:{sceneImage.Attributes["src"].Value.Replace("-", "jp-", StringComparison.OrdinalIgnoreCase)}"; result.Add(new RemoteImageInfo { Url = img, Type = ImageType.Primary, }); result.Add(new RemoteImageInfo { Url = img, Type = ImageType.Backdrop, }); } return(result); }
private void createHTMLToolStripMenuItem_Click(object sender, EventArgs e) { var css = File.ReadAllText(Data.TemplateDir + "/style.css"); var template = File.ReadAllText(Data.TemplateDir + "/index.html"); var artCol = new HTMLTableColumn("Article / Interview", "width: 55%"); var dateCol = new HTMLTableColumn("Date"); var pubCol = new HTMLTableColumn("Publisher"); var srcCol = new HTMLTableColumn("Sources / Mirrors"); var table = new HTMLTable(artCol, dateCol, pubCol, srcCol); foreach (var a in articles) { table.Row(HTML.Link(a.title, a.primarySource), a.date, a.publisher ?? "", HTML.LinksString(a.sources)); } template = template.Replace("<!--ARTICLES_TABLE-->", table.ToString()); table = new HTMLTable(new HTMLTableColumn("Video", "width: 80%"), dateCol); foreach (var v in videos) { table.Row(HTML.Link(v.title, v.primarySource), v.dateHTMLLinks); } template = template.Replace("<!--VIDEOS_TABLE-->", table.ToString()); table = new HTMLTable(new HTMLTableColumn("Game", "width: 80%"), new HTMLTableColumn("Year")); foreach (var s in source) { table.Row(HTML.Link(s.game, s.url), s.year); } template = template.Replace("<!--SOURCE_TABLE-->", table.ToString()); table = new HTMLTable(new HTMLTableColumn("Audio", "width: 80%"), dateCol); foreach (var a in audio) { table.Row(HTML.Link(a.title, a.primarySource), a.dateHTMLLinks); } template = template.Replace("<!--AUDIO_TABLE-->", table.ToString()); File.WriteAllText(Data.OutputDir + "/index.html", template); File.WriteAllText(Data.OutputDir + "/style.css", css); }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); if (!sceneURL.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { sceneURL = Helper.GetSearchBaseURL(siteNum) + sceneURL; } var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var xpaths = new List <string> { "//picture[@class='poster']//img/@src", "//div[@id='gallery-thumbs']//img/@src", }; foreach (var xpath in xpaths) { var img = sceneData.SelectSingleText(xpath); if (!string.IsNullOrEmpty(img)) { result.Add(new RemoteImageInfo { Url = img, Type = ImageType.Primary, }); result.Add(new RemoteImageInfo { Url = img, Type = ImageType.Backdrop, }); } } return(result); }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var poster = sceneData.SelectSingleNode("//div[@class='icon-container']//img"); if (poster != null) { result.Add(new RemoteImageInfo { Url = $"https:{poster.Attributes["src"].Value}", Type = ImageType.Primary, }); } var img = sceneData.SelectNodes("//div[contains(@class, 'preview-image-container')]//a"); if (img != null) { foreach (var sceneImages in img) { var url = Helper.GetSearchBaseURL(siteNum) + sceneImages.Attributes["href"].Value; var posterHTML = await HTML.ElementFromURL(url, cancellationToken).ConfigureAwait(false); var posterData = posterHTML.SelectSingleNode("//div[contains(@class, 'remove-bs-padding')]/img").Attributes["src"].Value; result.Add(new RemoteImageInfo { Url = posterData, Type = ImageType.Backdrop, }); } } return(result); }
public void OnLinksRemoveCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: links remove [id]"); return; } string id = Config.EscapeString(e.Args[0]); int result = this._database.ExecuteNonQuery("DELETE FROM links WHERE id = '" + id + "'"); if (result > 0) { bot.SendReply(e, "Link " + HTML.CreateColorString(bot.ColorHeaderHex, "#" + e.Args[0]) + " has been removed from the links database"); } else { bot.SendReply(e, "Unable to remove that link from the database"); } }
// public QuotationDetailDataPageDelete() // : base("Follow", "foll_FollowID", "FollowNewEntry") // { // this.CancelButton = false; // this.DeleteButton = false; // } public override void BuildContents() { try { AddContent(HTML.Form()); string qutaid = Dispatch.EitherField("quta_Quotationid"); if (string.IsNullOrEmpty(qutaid)) { qutaid = Dispatch.EitherField("key37"); } string QuotationDetailid = Dispatch.EitherField("qtdt_QuotationDetailID"); Record rec = FindRecord("QuotationDetail", "qtdt_QuotationDetailID=" + QuotationDetailid); EntryGroup QuotationDetailentry = new EntryGroup("QuotationDetailNewEntry"); QuotationDetailentry.Fill(rec); AddTabHead("QuotationDetail"); //GetTabs("QuotationDetail", "QuotationDetail"); string hMode = Dispatch.EitherField("HiddenMode"); if (hMode == "Save") { //Record rec = base.FindCurrentRecord("QuotationDetail"); rec.DeleteRecord = true; rec.SaveChanges(); QuerySelect qs = this.GetQuery(); qs.SQLCommand = @"Update Quotation set quta_localeamount = (select sum(qtdt_localeamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @") ,quta_foreignamount = (select sum(qtdt_foreignamount) from QuotationDetail where qtdt_deleted is null and qtdt_qutaid= " + qutaid + @") where quta_Quotationid=" + qutaid; qs.ExecuteNonQuery(); Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid); } /* Add your code here */ AddContent(HTML.InputHidden("HiddenMode", "")); QuotationDetailentry.GetHtmlInViewMode(rec); AddContent(QuotationDetailentry); AddSubmitButton("确认删除", "delete.gif", "javascript:document.EntryForm.HiddenMode.value='Save';"); AddUrlButton("Cancel", "Cancel.gif", UrlDotNet(ThisDotNetDll, "RunDataPage") + "&quta_Quotationid=" + qutaid); } catch (Exception error) { this.AddError(error.Message); } }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); if (!sceneURL.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { sceneURL = Helper.GetSearchBaseURL(siteNum) + sceneURL; } var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var poster = sceneData.SelectSingleText("//a[@id='front-cover']/@data-href"); if (!string.IsNullOrEmpty(poster)) { result.Add(new RemoteImageInfo { Url = poster, Type = ImageType.Primary, }); } var sceneImages = sceneData.SelectNodesSafe("//a[@rel='scenescreenshots']"); foreach (var sceneImage in sceneImages) { result.Add(new RemoteImageInfo { Url = sceneImage.Attributes["href"].Value, Type = ImageType.Backdrop, }); } return(result); }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var scenePoster = sceneData.SelectSingleNode("//div[@id='player']").Attributes["style"].Value.Split('(')[1].Split(')')[0]; result.Add(new RemoteImageInfo { Url = scenePoster, Type = ImageType.Primary, }); var scenePosters = sceneData.SelectNodes("//div[contains(@class, 'thumbs2 gallery')]//img"); if (scenePosters != null) { foreach (var poster in scenePosters) { scenePoster = poster.Attributes["src"].Value.Split('?')[0]; result.Add(new RemoteImageInfo { Url = scenePoster, Type = ImageType.Primary, }); result.Add(new RemoteImageInfo { Url = scenePoster, Type = ImageType.Backdrop, }); } } return(result); }
private void OnAltsAddCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: alts add [alt]"); return; } string alt = Format.UppercaseFirst(e.Args[0]); if (bot.GetUserID(alt) < 1) { bot.SendReply(e, "No such user: "******"This command can only be used by your main: " + HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(bot.Users.GetMain(e.Sender)))); return; } if (bot.Users.IsAlt(alt)) { bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, alt) + " already has been added as alt of " + HTML.CreateColorString(bot.ColorHeaderHex, Format.UppercaseFirst(bot.Users.GetMain(alt)))); return; } if (bot.Users.GetUser(alt) > bot.Users.GetUser(e.Sender)) { bot.SendReply(e, "You can't add alts that outrank you!"); return; } if (bot.Users.GetAlts(alt).Length > 0) { bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, alt) + " is a main with registered alts and can't be added as your alt"); return; } if (bot.Users.GetUser(alt) > UserLevel.Guest) { bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, alt) + " was a member of this bot and has been removed prior to being added as alt"); bot.Users.RemoveUser(alt); } bot.Users.AddAlt(e.Sender, alt); bot.SendReply(e, HTML.CreateColorString(bot.ColorHeaderHex, alt) + " has been added as your alt"); }
private void create_road_html() { //生成赛道表 string msg = ""; foreach (RaceRoad v in track.raceRoad) { var top = v.getRaceTopInTop(1); if (top != null) { msg = msg + "<tr>"; msg = msg + "<td>" + v.getRaceName() + "</td>"; //赛道名 msg = msg + "<td>" + top.rcarname + "</td>"; //车辆 msg = msg + "<td>" + (top.rtime / 1000.0).ToString() + "s</td>"; //时间 msg = msg + "<td>" + top.playername + "</td>"; //玩家 msg = msg + "<td>" + top.team + "</td>"; //车队 msg = msg + "</tr>"; } } foreach (RaceRoad v in track.raceRoad) { var top = v.getRaceTopInTop(1); if (top == null) { msg = msg + "<tr>"; msg = msg + "<td>" + v.getRaceName() + "</td>"; //赛道名 msg = msg + "<td>无数据</td>"; //车辆 msg = msg + "<td>无数据</td>"; //时间 msg = msg + "<td>无数据</td>"; //玩家 msg = msg + "<td>无数据</td>"; //车队 msg = msg + "</tr>"; } } var p = new HTML("index_origin.html", "resources\\shadowscity\\html\\"); //API.consoleOutput(p.Path()); p.loadHtml(); p.replace("$list$", msg); p.replace("$createtime$", "页面生成于" + DateTime.Now.ToString()); //API.consoleOutput(p.Html()); p.saveHtml("index.html"); }
private void update_stats() { List <string> head = HTML.GetHead("", "", DisplaySize.Small); head.Add("<BODY>"); if (this.fCreatures.Count == 0) { head.Add("<P class=instruction>"); head.Add("You have not yet selected any creatures; to select a creature, drag it from the list at the left onto the box above"); head.Add("</P>"); } else { head.Add("<P class=table>"); head.Add("<TABLE>"); head.Add("<TR class=heading>"); head.Add("<TD colspan=3><B>Selected Creatures</B></TD>"); head.Add("</TR>"); foreach (ICreature fCreature in this.fCreatures) { head.Add("<TR class=header>"); head.Add(string.Concat("<TD colspan=2>", fCreature.Name, "</TD>")); head.Add(string.Concat("<TD align=center><A href=remove:", fCreature.ID, ">remove</A></TD>")); head.Add("</TR>"); } head.Add("</TABLE>"); head.Add("</P>"); } foreach (ICreature creature in this.fCreatures) { EncounterCard encounterCard = new EncounterCard(creature); head.Add("<P class=table>"); head.AddRange(encounterCard.AsText(null, CardMode.View, false)); head.Add("</P>"); } head.Add("</BODY>"); head.Add("</HTML>"); string str = HTML.Concatenate(head); this.Browser.Document.OpenNew(true); this.Browser.Document.Write(str); }
public override void BuildContents() { try { AddContent(HTML.Form()); string qutaid = Dispatch.EitherField("quta_Quotationid"); if (string.IsNullOrEmpty(qutaid)) { qutaid = Dispatch.EitherField("key37"); } EntryGroup qutacompEntry = new EntryGroup("QuotationCompanyEntry"); qutacompEntry.Title = "商机客户"; EntryGroup qutaEntry = new EntryGroup("QuotationNewEntry"); qutaEntry.Title = "报价信息"; Record qutaRec = FindRecord("Quotation", "quta_Quotationid=" + qutaid); qutacompEntry.Fill(qutaRec); qutaEntry.Fill(qutaRec); GetTabs("Quotation", "Quotation Summary"); List UseList = new List("QuotationDetailGrid"); UseList.Filter = "qtdt_deleted is null and qtdt_qutaid =" + qutaid; UseList.PadBottom = false; qutacompEntry.GetHtmlInViewMode(qutaRec); qutaEntry.GetHtmlInViewMode(qutaRec); VerticalPanel vp = new VerticalPanel(); vp.AddAttribute("width", "100%"); vp.Add(qutacompEntry); vp.Add(qutaEntry); vp.Add(UseList); AddContent(vp); AddUrlButton("Edit", "Edit.gif", UrlDotNet(ThisDotNetDll, "RunDataPageEdit") + "&quta_Quotationid=" + qutaid); AddUrlButton("添加报价明细", "New.gif", UrlDotNet(ThisDotNetDll, "RunQDAdd") + "&quta_Quotationid=" + qutaid); AddUrlButton("Cancel", "Cancel.gif", UrlDotNet(ThisDotNetDll, "RunListPage") + "&J=Quotation&T=Opportunity"); } catch (Exception error) { this.AddError(error.Message); } }
public async Task <List <RemoteSearchResult> > Search(int[] siteNum, string searchTitle, DateTime?searchDate, CancellationToken cancellationToken) { var result = new List <RemoteSearchResult>(); if (siteNum == null || string.IsNullOrEmpty(searchTitle)) { return(result); } var url = Helper.GetSearchSearchURL(siteNum) + searchTitle; var data = await HTML.ElementFromURL(url, cancellationToken).ConfigureAwait(false); var searchResults = data.SelectNodes("//div[contains(@class, 'main-content-videos')]//div[contains(@class, 'card-video')]"); if (searchResults != null) { foreach (var searchResult in searchResults) { string sceneURL = searchResult.SelectSingleText(".//a/@href"), curID = $"{siteNum[0]}#{siteNum[1]}#{Helper.Encode(sceneURL)}", sceneName = searchResult.SelectSingleText(".//a/@aria-label"), sceneDate = searchResult.SelectSingleText(".//p[contains(@class, 'extra-info') and not(contains(@class, 'actors'))]"), scenePoster = searchResult.SelectSingleText(".//div[contains(@class, 'thumb')]/@data-bg"); var res = new RemoteSearchResult { ProviderIds = { { Plugin.Instance.Name, curID } }, Name = sceneName, ImageUrl = scenePoster, }; if (DateTime.TryParseExact(sceneDate, "MMM dd, yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None, out var sceneDateObj)) { res.PremiereDate = sceneDateObj; } result.Add(res); } } return(result); }
private void UserJoinChannelEvent(BotShell bot, UserJoinChannelArgs e) { if (!e.Local) { return; } lock (this._lds) { if (this._lds.ContainsKey(e.Sender)) { if (this._core.AddRaider(e.Sender, false)) { bot.SendPrivateChannelMessage(bot.ColorHighlight + HTML.CreateColorString(bot.ColorHeaderHex, e.Sender) + " has rejoined the raid"); bot.SendPrivateMessage(e.SenderID, bot.ColorHighlight + "Welcome back. You have automatically rejoined the raid"); this._core.Log(e.Sender, null, this.InternalName, "raiders", string.Format("{0} has automatically rejoined the raid (Points: {1})", e.Sender, this._core.GetPoints(e.Sender))); } this._lds.Remove(e.Sender); } } }
private void OnConfigurationResetCommand(BotShell bot, CommandArgs e) { if (e.Args.Length < 2) { bot.SendReply(e, "Usage: configuration reset [plugin] [key]"); return; } if (!bot.Configuration.IsRegistered(e.Args[0], e.Args[1])) { bot.SendReply(e, "No such configuration entry"); return; } string section = e.Args[0].ToLower(); string key = e.Args[1].ToLower(); ConfigurationEntry entry = bot.Configuration.GetRegistered(section, key); bot.Configuration.Set(entry.Type, section, key, entry.DefaultValue); bot.Configuration.Delete(section, key); bot.SendReply(e, "Configuration entry " + HTML.CreateColorString(bot.ColorHeaderHex, section + "::" + key) + " has been reset to it's default value"); }
private HttpResponse handleIndex(HttpRequest req) { var html = new HTML( new HEAD( new TITLE("Status Screen Site") ), new BODY { style = "margin:0; padding:0; overflow:hidden; background: #000;" }._( new IFRAME { id = "appframe", src = "app.html", style = "display: block; border: none; width: 100vw; height: 100vh;" }, new DIV { style = "position: absolute; left: 0; bottom: 0; width: 25vw; height: 25vh;", onclick = "var af = document.getElementById('appframe'); (af.requestFullScreen || af.webkitRequestFullScreen || af.mozRequestFullScreen).call(af);" } ) ); return(HttpResponse.Html(html)); }
private void PrintLeaders() { if (Entity.Leaders != null && Entity.Leaders.Count > 0) { HTML.AppendLine(Bold("Leaders") + " " + MakeLink("[Load]", LinkOption.LoadEntityLeaders) + LineBreak); foreach (string leaderType in Entity.LeaderTypes) { HTML.AppendLine(leaderType + "s" + LineBreak); TableMaker leaderTable = new TableMaker(true); foreach (HistoricalFigure leader in Entity.Leaders[Entity.LeaderTypes.IndexOf(leaderType)]) { leaderTable.StartRow(); leaderTable.AddData(leader.Positions.Last(position => position.Title == leaderType).Began.ToString()); leaderTable.AddData(leader.ToLink()); leaderTable.EndRow(); } HTML.AppendLine(leaderTable.GetTable() + LineBreak); } } }
public override void BuildContents() { try { AddContent(HTML.Form()); string compid = Dispatch.EitherField("comp_companyid"); string hMode = Dispatch.EitherField("HiddenMode"); EntryGroup USEntry = new EntryGroup("UseSituationNewEntry"); USEntry.Title = "使用情况"; int errflag = 0; AddTabHead("UseSituation"); if (hMode == "Save") { Record USRec = new Record("UseSituation"); USEntry.Fill(USRec); if (USEntry.Validate() == true) { USRec.SetField("usst_companyid", compid); USRec.SaveChanges(); Dispatch.Redirect(UrlDotNet(ThisDotNetDll, "RunUSList") + "&comp_companyid=" + compid + "&J=Summary&T=CompanySummary"); } } if (errflag != -1) { AddContent(HTML.InputHidden("HiddenMode", "")); USEntry.GetHtmlInEditMode(); VerticalPanel vp = new VerticalPanel(); vp.AddAttribute("width", "100%"); vp.Add(USEntry); AddContent(vp); string url = "javascript:document.EntryForm.HiddenMode.value='Save';"; AddSubmitButton("Save", "Save.gif", url); AddUrlButton("Cancel", "cancel.gif", UrlDotNet(ThisDotNetDll, "RunUSList") + "&comp_companyid=" + compid + "&J=Summary&T=CompanySummary"); } } catch (Exception ex) { AddError(ex.Message + "USAddPage"); } }
public async Task <List <RemoteSearchResult> > Search(int[] siteNum, string searchTitle, DateTime?searchDate, CancellationToken cancellationToken) { var result = new List <RemoteSearchResult>(); if (siteNum == null) { return(result); } var url = Helper.GetSearchSearchURL(siteNum) + searchTitle; var data = await HTML.ElementFromURL(url, cancellationToken).ConfigureAwait(false); var searchResults = data.SelectNodes("//div[contains(@class, 'product-items')]//div[contains(@class, 'video-box-item')]"); if (searchResults != null) { foreach (var searchResult in searchResults) { string sceneURL = Helper.GetSearchBaseURL(siteNum) + searchResult.SelectSingleText(".//a/@href"), curID = $"{siteNum[0]}#{siteNum[1]}#{Helper.Encode(sceneURL)}", sceneName = searchResult.SelectSingleText(".//div[@class='product-item-bottom']//a"), scenePoster = Helper.GetSearchBaseURL(siteNum) + searchResult.SelectSingleText(".//img/@data-src"); if (searchDate.HasValue) { curID += $"#{searchDate.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)}"; } var res = new RemoteSearchResult { ProviderIds = { { Plugin.Instance.Name, curID } }, Name = sceneName, ImageUrl = scenePoster, }; result.Add(res); } } return(result); }
private void PrintTitle() { string title = Entity.ToLink(false); if (Entity.IsCiv) { title += " is a civilization of "; } else { title += " is a group of "; } title += Entity.Race.ToLower(); if (Entity.Parent != null) { title += " of " + Entity.Parent.ToLink(true, Entity); } HTML.AppendLine(Bold(title) + LineBreak + LineBreak); if (Entity.IsCiv) { HTML.AppendLine(Entity.PrintIdenticon(true) + LineBreak + LineBreak); } if (Entity.SiteHistory.Count > 0) { if (Entity.SiteHistory.Count(sitePeriod => sitePeriod.EndYear == -1) == 0) { HTML.AppendLine(Font("Last Known Sites. Year: " + (Entity.SiteHistory.Max(sitePeriod => sitePeriod.EndYear) - 1), "red")); } List <Bitmap> maps = MapPanel.CreateBitmaps(World, Entity); TableMaker mapTable = new TableMaker(false, maps[0].Width + maps[1].Width + 10); mapTable.StartRow(); mapTable.AddData(MakeLink(BitmapToHTML(maps[0]), LinkOption.LoadMap)); mapTable.AddData(MakeLink(BitmapToHTML(maps[1]), LinkOption.LoadMap)); mapTable.EndRow(); HTML.AppendLine(mapTable.GetTable()); maps[0].Dispose(); maps[1].Dispose(); } }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); if (!sceneURL.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { sceneURL = Helper.GetSearchBaseURL(siteNum) + sceneURL; } var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var image = sceneData.SelectSingleText("//a[@class='fake_trailer']//img/@src0_1x"); if (!string.IsNullOrEmpty(image)) { if (!image.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { image = Helper.GetSearchBaseURL(siteNum) + image; } result.Add(new RemoteImageInfo { Url = image, Type = ImageType.Primary, }); result.Add(new RemoteImageInfo { Url = image, Type = ImageType.Backdrop, }); } return(result); }
public async Task <IEnumerable <RemoteImageInfo> > GetImages(int[] siteNum, string[] sceneID, BaseItem item, CancellationToken cancellationToken) { var result = new List <RemoteImageInfo>(); if (sceneID == null) { return(result); } var sceneURL = Helper.Decode(sceneID[0]); if (!sceneURL.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { sceneURL = Helper.GetSearchBaseURL(siteNum) + sceneURL; } var sceneData = await HTML.ElementFromURL(sceneURL, cancellationToken).ConfigureAwait(false); var imgNode = sceneData.SelectNodesSafe("//img[contains(@id, 'player-overlay-image')]"); foreach (var sceneImages in imgNode) { result.Add(new RemoteImageInfo { Url = $"https:{sceneImages.Attributes["src"].Value}", Type = ImageType.Primary, }); } imgNode = sceneData.SelectNodesSafe("//div[@id='img-slider']//img"); foreach (var sceneImages in imgNode) { result.Add(new RemoteImageInfo { Url = $"https:{sceneImages.Attributes["src"].Value}", Type = ImageType.Backdrop, }); } return(result); }
private void OnRosterAddCommand(BotShell bot, CommandArgs e) { if (this._state != RosterState.Idle) { bot.SendReply(e, "Roster update is currently in progress. Please try again later"); return; } using (IDbCommand command = this._database.Connection.CreateCommand()) { command.CommandText = "SELECT * FROM organizations"; IDataReader reader = command.ExecuteReader(); int i = 0; while (reader.Read()) { i++; } reader.Close(); if (i > 4) { bot.SendReply(e, "You can't add more than 5 guilds!"); return; } } if (e.Args.Length < 1) { bot.SendReply(e, "Correct Usage: roster add [username]"); return; } WhoisResult whois = XML.GetWhois(e.Args[0], bot.Dimension, false, true); if (whois == null || whois.Organization == null || whois.Organization.Name == null || whois.Organization.ID < 1) { bot.SendReply(e, "Unable to add an organization based on that user"); return; } this._database.ExecuteNonQuery(String.Format("INSERT INTO organizations VALUES ({0}, '{1}', 0)", whois.Organization.ID, Config.EscapeString(whois.Organization.Name))); bot.SendReply(e, "Added " + HTML.CreateColorString(bot.ColorHeaderHex, whois.Organization.Name) + " to the auto-update list"); }
public Admin (bool real_server) { LoadProviders (); ui = new Glade.XML (null, "admin.glade", "main_window", null); ui.Autoconnect (this); contextid = statusbar.GetContextId (""); main_window.DeleteEvent += new DeleteEventHandler (OnDeleteEvent); d = new Contributions (); if (real_server) d.Url = "http://www.go-mono.com/docs/server.asmx"; html = new HTML (); html.LinkClicked += new LinkClickedHandler (LinkClicked); html.Show (); html.SetSizeRequest (700, 500); container.Add (html); html_review = new HTML (); html_review.LinkClicked += new LinkClickedHandler (ReviewLinkClicked); html_review.Show (); review_container.Add (html_review); }
// https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150807/shadertoy /// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(HTML.Pages.IApp page) { // show shader based on tab selection? //Native.document.documentElement.style.overflow = IStyle.OverflowEnum.auto; // chrome by default has no scrollbar, bowser does // "C:\util\jsc\bin\ScriptCoreLib.dll" Native.document.documentElement.style.overflow = IStyle.OverflowEnum.hidden; Native.body.style.margin = "0px"; Native.body.Clear(); // ipad? Native.window.onerror += e => { new IHTMLPre { "error " + new { e.error } }.AttachToDocument(); }; // https://www.youtube.com/watch?v=tnS8K0yhmZU // http://www.reddit.com/r/oculus/comments/2sv5lk/new_release_of_shadertoy_vr/ // https://www.shadertoy.com/view/lsSGRz // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201503/20150309 // https://zproxy.wordpress.com/2015/03/09/project-windstorm/ // https://github.com/jimbo00000/RiftRay //1>Z:\jsc.svn\examples\javascript\chrome\apps\WebGL\ChromeShaderToyPrograms\ChromeShaderToyPrograms\Application.cs(81,35,81,39): // error CS0656: Missing compiler required member 'Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo.Create' // #region += Launched chrome.app.window dynamic self = Native.self; dynamic self_chrome = self.chrome; object self_chrome_socket = self_chrome.socket; if (self_chrome_socket != null) { if (!(Native.window.opener == null && Native.window.parent == Native.window.self)) { Console.WriteLine("chrome.app.window.create, is that you?"); // pass thru } else { // should jsc send a copresence udp message? chrome.runtime.UpdateAvailable += delegate { new chrome.Notification(title: "UpdateAvailable"); }; chrome.app.runtime.Launched += async delegate { // 0:12094ms chrome.app.window.create {{ href = chrome-extension://aemlnmcokphbneegoefdckonejmknohh/_generated_background_page.html }} Console.WriteLine("chrome.app.window.create " + new { Native.document.location.href }); new chrome.Notification(title: "ChromeUDPSendAsync"); var xappwindow = await chrome.app.window.create( Native.document.location.pathname, options: null ); //xappwindow.setAlwaysOnTop xappwindow.show(); await xappwindow.contentWindow.async.onload; Console.WriteLine("chrome.app.window loaded!"); }; return; } } #endregion var gl = new WebGLRenderingContext(alpha: true); if (gl == null) { new IHTMLPre { // https://code.google.com/p/chromium/issues/detail?id=294207 "Rats! WebGL hit a snag.", //new IHTMLAnchor { href = "about:gpu", innerText = "about:gpu" } }.AttachToDocument(); return; } Native.body.style.backgroundColor = "blue"; gl.oncontextlost += delegate { Native.body.style.backgroundColor = "red"; // reload? }; //gl.canvas.async.oncont var combo = new IHTMLSelect().AttachToDocument(); combo.style.position = IStyle.PositionEnum.absolute; combo.style.left = "0px"; combo.style.top = "0px"; //combo.style.right = "0px"; combo.style.width = "100%"; combo.style.backgroundColor = "rgba(255,255,255,0.5)"; //combo.style.backgroundColor = "rgba(255,255,0,0.5)"; //combo.style.background = "linear-gradient(to bottom, rgba(255,255,255,0.5 0%,rgba(255,255,255,0.0 100%))"; combo.style.border = "0px solid transparent"; combo.style.fontSize = "large"; combo.style.paddingLeft = "1em"; combo.style.fontFamily = IStyle.FontFamilyEnum.Verdana; combo.style.cursor = IStyle.CursorEnum.pointer; //var mAudioContext = new AudioContext(); var c = gl.canvas.AttachToDocument(); #region onresize new { }.With( async delegate { do { c.width = Native.window.Width; c.height = Native.window.Height; c.style.SetSize(c.width, c.height); } while (await Native.window.async.onresize); } ); #endregion #region CaptureMouse var mMouseOriX = 0; var mMouseOriY = 0; var mMousePosX = 0; var mMousePosY = 0; c.onmousedown += async ev => { mMouseOriX = ev.CursorX; //mMouseOriY = ev.CursorY; mMouseOriY = c.height - ev.CursorY; mMousePosX = mMouseOriX; mMousePosY = mMouseOriY; // why aint it canvas? //ev.Element //ev.CaptureMouse(); // using ? ev.Element.requestPointerLock(); await ev.Element.async.onmouseup; Native.document.exitPointerLock(); mMouseOriX = -Math.Abs(mMouseOriX); mMouseOriY = -Math.Abs(mMouseOriY); }; //c.ontouchmove += c.onmousemove += ev => { if (ev.MouseButton == IEvent.MouseButtonEnum.Left) { mMousePosX += ev.movementX; mMousePosY += ev.movementY; } }; c.onmousewheel += ev => { ev.preventDefault(); ev.stopPropagation(); mMousePosY += 3 * ev.WheelDirection; }; #endregion // http://www.wufoo.com/html5/attributes/05-list.html // http://www.w3schools.com/tags/att_input_list.asp //uiauto.datalist1.EnsureID(); //uiauto.search.list = uiauto.datalist1.id; //uiauto.datalist1.id = "datalist1"; //uiauto.search.list = "datalist1"; //new IHTMLPre { new { uiauto.search.list, uiauto.datalist1.id } }.AttachToDocument(); var sw = Stopwatch.StartNew(); new IHTMLOption { value = "", innerText = $"{References.programs.Count} shaders available" }.AttachTo(combo); // should bind the selection to uri and reload if gpu crashes. #region can we have a next button? // https://sites.google.com/a/jsc-solutions.net/work/knowledge-base/15-dualvr/20150807/shadertoy new IHTMLButton { "next" }.AttachToDocument().With( next => { new IStyle(next) { position = IStyle.PositionEnum.absolute, right = "1em", top = "2em", bottom = "1em", padding = "4em" }; next.onclick += delegate { var n = combo.selectedIndex + 1; Console.WriteLine(new { n }); combo.selectedIndex = n; }; } ); #endregion ShaderToy.EffectPass pip = null; // http://stackoverflow.com/questions/25289390/html-how-to-make-input-type-list-only-accept-a-list-choice References.programs.Keys.WithEachIndex( async (key, index) => { var text = (1 + index) + " of " + References.programs.Count + " " + key.SkipUntilIfAny("ChromeShaderToy").Replace("By", " by "); var option = new IHTMLOption { value = key, innerText = text }.AttachTo(combo); await Native.window.async.onframe; // we are about to create 100 objects. does it have any impact to UI? var frag = References.programs[key](); var len = frag.ToString().Length; option.innerText = text + " " + new { //frame, //load = load.ElapsedMilliseconds + "ms ", frag = len + "bytes ", // a telemetry to track while running on actual hardware //fragGPU = pass0.xCreateShader.fsTranslatedShaderSource.Length + " bytes" }; // cant we get it if we manually set it? await option.async.onselect; await Native.window.async.onframe; var load = Stopwatch.StartNew(); var pass0 = new ShaderToy.EffectPass( gl: gl, precission: ShaderToy.DetermineShaderPrecission(gl), supportDerivatives: gl.getExtension("OES_standard_derivatives") != null ); pass0.MakeHeader_Image(); pass0.NewShader_Image(frag); load.Stop(); new { }.With( async delegate { while (await option.async.ondeselect) { pip = pass0; await option.async.onselect; } } ); var framesInSecond = 0; var theSecond = Stopwatch.StartNew(); var frame = 0; do { frame++; framesInSecond++; if (theSecond.ElapsedMilliseconds >= 1000) { //option.innerText = key + new { frame }; option.innerText = text + " " + new { //frame, framesInSecond, load = load.ElapsedMilliseconds + "ms ", frag = len + "bytes ", // a telemetry to track while running on actual hardware fragGPU = pass0.xCreateShader.fsTranslatedShaderSource.Length + " bytes" }; framesInSecond = 0; //theSecond.Restart(); theSecond = Stopwatch.StartNew(); } // can we scale? pass0.Paint_Image( sw.ElapsedMilliseconds / 1000.0f, mMouseOriX, mMouseOriY, mMousePosX, mMousePosY, zoom: 1.0f ); if (pip != null) { // can we scale? pip.Paint_Image( sw.ElapsedMilliseconds / 1000.0f, mMouseOriX, mMouseOriY, mMousePosX, mMousePosY, zoom: 0.10f ); } // what does it do? gl.flush(); // wither we are selected or we are pip? await option.async.selected; } while (await Native.window.async.onframe); } ); }
public BugDisplay(Frame frm) { //web = new WebControl(); ScrolledWindow sw = new ScrolledWindow(); web = new HTML(); web.Show(); sw.Add(web); //web.StatusChange += new EventHandler(changeHandler); //web.NetStart += new EventHandler(NetStateAllHandler); frm.Add(sw); StreamReader inFile = new StreamReader("bugs.xsl"); xsl = inFile.ReadToEnd(); inFile.Close(); }
public void Bind(string iFunctionName, HTML.Core.V8JavascriptObject.IWebView iContext, Action<string, IJavascriptObject, IJavascriptObject[]> action) { JSObject ob = _JSValue; ob.Bind(iFunctionName, false, (o, e) => { action(iFunctionName, null, e.Arguments.Select(el => el.Convert()).ToArray()); }); }
public Task<IJavascriptObject> InvokeAsync(string iFunctionName, HTML.Core.V8JavascriptObject.IWebView iContext, params IJavascriptObject[] iparam) { return Task.FromResult(Invoke(iFunctionName, iContext, iparam)); }
public bool Initialize () { try { html_panel = new HTML (); } catch (Exception ex) { Console.WriteLine (ex.Message); Console.WriteLine (ex.StackTrace); return false; } html_panel.Show (); html_panel.LinkClicked += new LinkClickedHandler (LinkClicked); html_panel.OnUrl += new OnUrlHandler (OnUrlMouseOver); html_panel.UrlRequested += new UrlRequestedHandler (UrlRequested); return true; }
public IJavascriptObject Invoke(string iFunctionName, HTML.Core.V8JavascriptObject.IWebView iContext, params IJavascriptObject[] iparam) { var res =((JSObject)_JSValue).Invoke(iFunctionName, iparam.Cast<IJavascriptObject>().Select(c => c.Convert()).ToArray()); return res.Convert(); }