Ejemplo n.º 1
0
        /// <summary>
        /// 保存配置文件
        /// </summary>
        static public void SaveInifile()
        {
            string textA = "";
            string textB = "";
            string textC = "";

            textA = A_param[0].ToString() + "|" + A_param[1].ToString() + "|" + A_param[2].ToString() + "|" + A_param[3].ToString() + "|" + A_param[4].ToString();
            textB = B_param[0].ToString() + "|" + B_param[1].ToString() + "|" + B_param[2].ToString();
            textC = C_param[0].ToString() + "|" + C_param[1].ToString() + "|" + C_param[2].ToString() + "|" + C_param[3].ToString();
            IniFunc.WriteString("Param", "A", textA, Application.StartupPath + "\\config.ini");
            IniFunc.WriteString("Param", "B", textB, Application.StartupPath + "\\config.ini");
            IniFunc.WriteString("Param", "C", textC, Application.StartupPath + "\\config.ini");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 基础数据初始化
        /// </summary>
        void initialization()
        {
            //读取需要的句柄以及UIElement
            //1.读取预警列表UIElement     DZH_uiElement
            //GetReadWaringListViewElement();
            //2.买入按钮UIElement
            GetZT_OrderButtonElement("买入");
            //3.卖出按钮UIElement
            GetZT_OrderButtonElement("卖出");
            //4.获取买入界面UIElement
            var click = new iAutomationElement();

            //点击买入按钮
            click.InvokeButton(ZT_BuyButtonElement);
            ////获取持仓单UIElement
            //GetZTViewListElement("买入下单");
            //获取买入界面证券代码TextBox UIElement
            GetZTSecodeElement("买入下单");
            //输入证券代码
            click.WriteTextBox(ZT_BuySecuritiesCode, "000001");
            //获取NumBoxUIElement
            GetNumboxElement("买入下单");
            //获取ZT_BuyOrderUIElement
            GetZTOrder("买入下单");
            //获取 ZT_CanUseMoneyUIElement
            GetCanUseMoney();
            //获取 ZT_BuyPriceUIElement
            //GetBuyPrice();

            //5.获取卖出界面UIElement
            //点击买入按钮
            click.InvokeButton(ZT_SaleButtonElement);
            ////获取持仓单UIElement
            //GetZTViewListElement("卖出下单");
            //获取买入界面证券代码TextBox UIElement
            GetZTSecodeElement("卖出下单");
            //输入证券代码
            click.WriteTextBox(ZT_SaleSecuritiesCode, "000001");
            //获取NumBoxUIElement
            GetNumboxElement("卖出下单");
            //获取ZT_SaleOrderUIElement
            GetZTOrder("卖出下单");
            //获取持仓按钮
            GetZT_PositionOrderButtonElement();
            //获取A参数
            string textA = IniFunc.GetString("Param", "A", "", Application.StartupPath + "\\config.ini").Trim();

            if (textA.Contains("|"))
            {
                string[] array = textA.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Count(); i++)
                {
                    A_param[i] = Convert.ToDouble(array[i]);
                }
            }
            //获取B参数
            string textB = IniFunc.GetString("Param", "B", "", Application.StartupPath + "\\config.ini").Trim();

            if (textB.Contains("|"))
            {
                string[] array = textB.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Count(); i++)
                {
                    B_param[i] = Convert.ToDouble(array[i]);
                }
            }
            //获取C参数
            string textC = IniFunc.GetString("Param", "C", "", Application.StartupPath + "\\config.ini").Trim();

            if (textC.Contains("|"))
            {
                string[] array = textC.Split(new char[]
                {
                    '|'
                });
                for (int i = 0; i < array.Count(); i++)
                {
                    C_param[i] = Convert.ToDouble(array[i]);
                }
            }
        }