// リンクID(イメージID)取得 private int GetImageId(HTMLLIElement element) { int imageId = 0; var anchor = element.firstChild as IHTMLAnchorElement; if (anchor != null) { int.TryParse(Regex.Match(anchor.href, "(.*)(=)(.*)").Groups[3].Value, out imageId); //int.TryParse(Regex.Match(anchor.href, ".*=(?<img_id>.*)").Result("img_id"), out imageId); Marshal.FinalReleaseComObject(anchor); } return(imageId); }
static void AddNewSheetTab() { var tabControl = Document.GetElementById("TabControl"); _newSheetTab = new HTMLLIElement(); _newSheetTab.Id = "new-sheet"; var anchor = new HTMLAnchorElement(); anchor.ClassName = "new-sheet-anchor"; anchor.TextContent = "+"; anchor.Href = "#"; _newSheetTab.AppendChild(anchor); tabControl.AppendChild(_newSheetTab); }
public static void Logout(WebUtil w) { HTMLLIElement logoutLI = w.GetElementById("logoutLink") as HTMLLIElement; if (logoutLI != null) { int i = 0; foreach (HTMLAnchorElement element in logoutLI.getElementsByTagName("a")) { if (i == 0 && element.className == "profile-link") { element.click(); w.BeginPageLoading(); w.WaitForComplete(); i++; } } } }
public static HTMLDivElement CreateLevelSelectDiv(Action <Level> toSelect) { HTMLDivElement result = new HTMLDivElement(); result.Style.Border = "1px solid black"; HTMLUListElement list = new HTMLUListElement(); foreach (var level in levels) { HTMLLIElement levelA = new HTMLLIElement(); levelA.AppendChild(new HTMLAnchorElement { Href = "javascript:void(0)", OnClick = e => toSelect(level), InnerHTML = level.Name }); list.AppendChild(levelA); } result.AppendChild(list); return(result); }
private void GetCookie(object parameter) { if (parameter != null) { WebBrowser wb = (WebBrowser)parameter; HTMLDocument doc = (HTMLDocument)wb.Document; object obj = doc.getElementById("d_left"); if (obj != null) { uint datasize = 1024; StringBuilder cookieData = new StringBuilder((int)datasize); InternetGetCookieEx("http://www.acip.vip/index.aspx", null, cookieData, ref datasize, INTERNET_COOKIE_HTTPONLY, IntPtr.Zero); Cookie = cookieData.ToString(); object name = doc.getElementById("sp_cn_name"); HTMLLIElement element = (HTMLLIElement)name; Userinfo.UserName = element.innerHTML; HttpDataService httpdataservice = new HttpDataService(Cookie); Departments = httpdataservice.GetDepartmentList(); Userinfo.UserId = httpdataservice.GetUserID(); } } }
public static void NewTab(string name = null, Graph G = null) { if (string.IsNullOrEmpty(name)) { name = "sheet " + _tabID; } var canvas = new HTMLCanvasElement(); canvas.Id = "Tab" + _tabID; canvas.Width = (int)(Window.InnerWidth); canvas.Height = (int)(Window.InnerHeight); canvas.ClassName = "IAmAGraphCanvas"; canvas.OnShow += delegate { canvas.Width = canvas.ParentElement.ClientWidth; canvas.Height = canvas.ParentElement.ClientHeight; }; if (G == null) { G = new Graph(); } var graphCanvas = new GraphCanvas(G); var tc = new TabCanvas(canvas, graphCanvas); tc.Invalidate(); var tabPane = new HTMLDivElement(); tabPane.ClassName = "tab-pane active"; tabPane.Id = "Tab" + _tabID; tabPane.AppendChild(canvas); var tabControlContent = Document.GetElementById("TabControlContent"); foreach (var child in tabControlContent.Children) { child.ClassName = "tab-pane"; } tabControlContent.AppendChild(tabPane); var tab = new HTMLLIElement(); tab.ClassName = "active"; var anchor = new HTMLAnchorElement(); anchor.SetAttribute("data-toggle", "tab"); anchor.TextContent = name; anchor.Href = "#Tab" + _tabID; _canvasLookup[anchor.Href] = tc; _currentTabCanvas = anchor.Href; tab.AppendChild(anchor); var tabControl = Document.GetElementById("TabControl"); foreach (var child in tabControl.Children) { child.ClassName = "narf"; } tabControl.InsertBefore(tab, _newSheetTab); _tabID++; }