/// <summary> /// 获取持仓单UIElement /// 调用前需要点击买入or卖出按钮切换界面 /// </summary> /// <param name="_type" >"买入下单"or "卖出下单"</param> static void GetZTViewListElement(string _type) { var uielement = new iAutomationElement(); var elementlist = uielement.enumRoot(); elementlist = uielement.FindByName("中投证券", elementlist); elementlist = uielement.enumNode(elementlist[0]); if (elementlist.Count > 1) { foreach (AutomationElement item in elementlist) { var list = uielement.enumDescendants(item, _type); if (list.Count > 0) { buyWindowsElement = TreeWalker.RawViewWalker.GetParent(list[0]); elementlist = uielement.enumNode(buyWindowsElement); elementlist = uielement.FindByClassName("SysListView32", elementlist); if (_type == "买入下单") { ZT_BuyListView = elementlist[0]; } else if (_type == "卖出下单") { ZT_SaleListView = elementlist[0]; } ZT_DataList = uielement.GetViewList(elementlist[0], 19); } } } }
static void ReadWarmingOrder() { while (true) { DZH_DataList.Clear(); var data = new iAutomationElement(); DZH_DataList = data.GetViewList(DZH_uiElement, 5); foreach(var item in DZH_DataList) { } } }
/// <summary> /// 大智慧预警表读取 /// </summary> static void GetReadWaringListViewElement() { var uielement = new iAutomationElement(); var elemlentlist = uielement.enumRoot(); elemlentlist = uielement.FindByName("大智慧", elemlentlist); elemlentlist = uielement.enumNode(elemlentlist[0]); elemlentlist = uielement.FindByName("预警", elemlentlist); //foreach (AutomationElement item in elemlentlist) //{ // Console.WriteLine(item.Current.Name + "" + item.Current.ClassName); //} elemlentlist = uielement.enumNode(elemlentlist[0]); elemlentlist = uielement.FindByName("List2", elemlentlist); DZH_uiElement = elemlentlist[0]; DZH_DataList = uielement.GetViewList(elemlentlist[0],5); }
/// <summary> /// 更新预警列表 /// </summary> void updateWarming() { while (isRun) { BindingList <WarmingData> listA = new BindingList <WarmingData>(); var data = new iAutomationElement(); var list = data.GetViewList(DZH_uiElement, 5); foreach (var i in list) { var item = new WarmingData(); item.code = i.Value.data[0]; item.condition = i.Value.data[1]; item.time = i.Value.data[2]; item.price = i.Value.data[3]; item.nowprice = i.Value.data[4]; item.flag = ""; listA.Add(item); //var code = IsNum(i.Value.data[0]); //BuyOrder(code); } var query = listA.Where(p => { if ((!bdlist.Any(s => s.code == p.code)) && bdlist.Any(s => s.condition == p.condition)) { return(true); } return(false); }); foreach (var item in query) { bdlist.Add(item); } Thread.Sleep(5000); } }
/// <summary> /// 大智慧预警表读取 /// </summary> void GetReadWaringListViewElement() { var uielement = new iAutomationElement(); var elemlentlist = uielement.enumRoot(); elemlentlist = uielement.FindByName("大智慧", elemlentlist); if (elemlentlist.Count > 0) { elemlentlist = uielement.enumNode(elemlentlist[0]); elemlentlist = uielement.FindByName("预警", elemlentlist); if (elemlentlist.Count > 0) { elemlentlist = uielement.enumNode(elemlentlist[0]); elemlentlist = uielement.FindByName("List2", elemlentlist); if (elemlentlist.Count > 0) { DZH_uiElement = elemlentlist[0]; DZH_DataList = uielement.GetViewList(elemlentlist[0], 5); } else { output("预警列表加载失败"); return; } } else { output("预警列表未打开"); return; } } else { output("未找到大智慧句柄"); return; } }