Beispiel #1
0
        /// <summary>
        /// 获取证券代码TextBoxUIElement
        /// </summary>
        /// <param name="_type">"买入下单" or "卖出下单"</param>
        static void GetZTSecodeElement(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("AfxWnd42", elementlist);
                        if (_type == "买入下单")
                        {
                            ZT_BuySecuritiesCode = elementlist[0];
                        }
                        else if (_type == "卖出下单")
                        {
                            ZT_SaleSecuritiesCode = elementlist[0];
                        }
                        //uielement.WriteTextBox(elementlist[0], "\b\b\b\b\b\b");
                        //uielement.WriteTextBox(elementlist[0], "000005");
                    }
                }
            }
        }
Beispiel #2
0
        /// <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);
                    }
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取NumBox的UIElement
        /// </summary>
        /// <param name="_type">"买入下单" or "卖出下单"</param>
        static void GetNumboxElement(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("Edit", elementlist);
                        foreach (var i in elementlist)
                        {
                            if (i.Current.Name.ToString() == "" || i.Current.Name.ToString() == string.Empty)
                            {
                                if (_type == "买入下单")
                                {
                                    ZT_BuyNum = i;
                                }
                                else if (_type == "卖出下单")
                                {
                                    ZT_SaleNum = i;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #4
0
        /// <summary>
        /// 更新持仓单信息
        /// </summary>
        void UpdatePostion()
        {
            var click = new iAutomationElement();

            if (ZT_PositionOrder != null)
            {
                click.InvokeButton(ZT_PositionOrder);
                GetZT_OutPutElement();
                if (ZT_Output != null)
                {
                    click.InvokeButton(ZT_Output);
                    GetZT_OutPutSuessElement();
                    if (ZT_OutputSuess != null)
                    {
                        click.InvokeButton(ZT_OutputSuess);
                        Thread.Sleep(500);
                        var uielement   = new iAutomationElement();
                        var elementlist = uielement.enumRoot();
                        elementlist = uielement.FindByClassName("Notepad", elementlist);

                        uielement.CloseTextBook(elementlist[0]);
                        var list = ReadText.Read();
                        foreach (var item in list)
                        {
                            string[] array = item.Split(new char[]
                            {
                                '|'
                            });
                            var data = new DataItem();
                            data.data = array;
                            if (!ZT_DataList.ContainsKey(array[0]))
                            {
                                ZT_DataList.Add(array[0], data);
                            }
                            else
                            {
                                //若标记为空更新全部数据
                                if (ZT_DataList[array[0]].data[18] == "")
                                {
                                    ZT_DataList[array[0]] = data;
                                }
                                else
                                {
                                    data.data[18]         = "1";
                                    ZT_DataList[array[0]] = data;
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// 获取当前可用资金
        /// </summary>
        static void GetCanUseMoney()
        {
            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, "买入下单");
                    if (list.Count > 0)
                    {
                        buyWindowsElement = TreeWalker.RawViewWalker.GetParent(list[0]);
                        elementlist = uielement.enumNode(buyWindowsElement);
                        elementlist = uielement.FindByClassName("Static", elementlist);
                        ZT_CanUseMoney = elementlist[7];

                    }
                }
            }
        }