public static void CheckPageReadOnly(Page myPage, string checkType, string loginUserId) { var parameter = new PageHelp { Operate = "PageHelp", UserID = myPage.User.Identity.Name, Category = "", Area = "", Code = "" }; }
private void btnNext_Click(object sender, EventArgs e) { switch (findTabPage) { case 0: PageHelp.SelectTab(1); break; case 1: PageHelp.SelectTab(2); break; case 2: PageHelp.SelectTab(3); break; case 3: PageHelp.SelectTab(4); break; case 4: PageHelp.SelectTab(5); break; case 5: PageHelp.SelectTab(6); break; case 6: break; } }
public UC_Help() { InitializeComponent(); PageHelp.SelectTab(0); }
public void GenerateFacebookHelpApi() { var page = new PageHelp(); //page.GoToPage("https://www.facebook.com/help/246750422356731/adding-friends/?helpref=hc_fnav"); var classes = new List <ClassDefinationDTO>(); int attempts = 0; while (attempts < 4) { try { var headerMenuItems = page.GetMainMenuItems; for (var h = 1; h < headerMenuItems.Count; h++) { var childrenCount = page.GetMenuItemsNames(headerMenuItems[h]).Count(); for (var i = 0; i <= childrenCount; i++) { var classDTO = new ClassDefinationDTO(); classes.Add(classDTO); classDTO.NameSpace = new Defiantion { Name = headerMenuItems[h] }; page.GetFirstItem(headerMenuItems[h]).Click(); var menuItem = page.GetMenuItemsNames(headerMenuItems[h]).ToList()[i]; var className = menuItem.GetAttribute("aria-label"); var partUrl = menuItem.GetAttribute("href"); page.ClickElement(menuItem); var newDefination = new Defiantion(); newDefination.Name = className; classDTO.ClassDefination = newDefination; var grandChildren = page.GetSubMenuItemsName(className); if (!grandChildren.Any()) { continue; } var methodDefinitions = new List <MethodDefination>(); for (var j = 0; j < grandChildren.Count; j++) { var grandChildEmement = page.GetSubMenuItemHyperlink(className, grandChildren[j])[j]; page.GoToPage(grandChildEmement.GetAttribute("href")); string funtionNamePart = string.Empty; for (var k = 0; k < page.GetFunctionNames.Count; k++) { page.ClickElement(page.GetFunctionNames[k]); Thread.Sleep(10000); funtionNamePart = page.GetFunctionNames[k].Text; IEnumerable <IWebElement> functionSummaryElements = null; IList <string> functionSummaryHeader = null; try { functionSummaryElements = page.GetFunctionNames[k].FindElements(By.XPath($"//div[@role='main']/div//div[2]//div[@role='button']//span[text()=\"{funtionNamePart}\"]/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::h3/following-sibling::div[1]//ol")); } catch (Exception) { page.ClickElement(page.GetFunctionNames[k]); continue; } try { functionSummaryHeader = page.GetFunctionNames[k].FindElements(By.XPath($"//div[@role='main']/div//div[2]//div[@role='button']//span[text()=\"{funtionNamePart}\"]/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::div/parent::h3/following-sibling::div[1]//ol/preceding-sibling::h2")).Select(x => x.Text).ToList(); } catch (Exception) { } var index = 0; foreach (var functionSummaryElement in functionSummaryElements) { var comments = new List <string>(); if (functionSummaryHeader.Count() - 1 >= index) { funtionNamePart = $"{funtionNamePart}{functionSummaryHeader[index++]}"; } foreach (var functionSummary in functionSummaryElement.FindElements(By.XPath("//li"))) { var header = funtionNamePart; comments.Add(functionSummary.Text); } methodDefinitions.Add(new MethodDefination { Name = $"{funtionNamePart}", Comments = comments }); } Thread.Sleep(10000); page.ClickElement(page.GetFunctionNames[k]); Thread.Sleep(34000); } } classDTO.Methods = methodDefinitions; FileOperations.Serialize(@"D:\Dev\Robotize\RobotizeFacebook\Services\RobotizeAPIs\JsonClasses11", classes); } } break; } catch (StaleElementReferenceException e) { Debug.WriteLine(e.Message); } attempts++; Thread.Sleep(3000); } }
private void 加载本地数据ToolStripMenuItem_Click(object sender, EventArgs e) { if (!localData) { //第二次就没必要提示了 DialogResult dialog = MessageBox.Show("使用本地数据部分功能将无法使用\n建议只有在无法从互联网取得数据时才启用\n确定要加载本地缓存数据?\n", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2); if (dialog == DialogResult.Cancel) { return; } } filterDictionary["hangye"] = false; filterDictionary["baojian"] = false; filterDictionary["shenji"] = false; filterDictionary["lvshi"] = false; DirectoryInfo directoryInfo = new DirectoryInfo(localBasePath); DirectoryInfo[] subinfos = directoryInfo.GetDirectories(); List <Result> results = new List <Result>(); PageHelp pageHelp = new PageHelp(); List <Data> datas = new List <Data>(); int total = 0; foreach (DirectoryInfo dir in subinfos) { if (statuDictionary.Keys.Contains(dir.Name)) { //本地文件存在状态列表 才加载 DirectoryInfo[] companydirInfos = dir.GetDirectories(); foreach (var companydir in companydirInfos) { Data data = new Data(); data.FileResults = new List <Result>(); data.currStatus = statuDictionary[dir.Name]; data.stockAuditName = companydir.Name; foreach (FileInfo f in companydir.GetFiles()) { //遍历文件名 Result result = new Result(); result.fileTitle = System.IO.Path.GetFileNameWithoutExtension(f.FullName); result.filePath = f.FullName; result.CompanyStatus = dir.Name; result.companyFullName = companydir.Name; results.Add(result); data.FileResults.Add(result); total++; //MessageBox.Show(result.localPath); } datas.Add(data); } } } pageHelp.data = datas; fileRoot = new RootObject(); companyRoot = new RootObject(); fileRoot.result = results; fileRoot.pageHelp = new PageHelp() { total = total.ToString() }; companyRoot.pageHelp = pageHelp; resultTemp = fileRoot.result.ToList(); localData = true; comboBox2.SelectedIndex = 0; button1.Enabled = false; button2.Enabled = false; label5.Text = "高级筛选支持正则表达式\n本地模式部分功能不可使用"; toolStripStatusLabel1.Text = "本地数据已加载"; this.Text = "科创板信息披露文件采集器(本地模式)"; }