示例#1
0
        //导入用户配置信息
        private void ReadUserInfo()
        {
            List <UserInfoConfig> tmpListUsers = OperFile.GetUserInfoByFile();

            if (tmpListUsers == null)
            {
                return;
            }
            listUsers = tmpListUsers;
            listUserInfo.Items.Clear();
            foreach (UserInfoConfig uif in listUsers)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = uif.username;
                lvi.SubItems.Add("********");
                lvi.SubItems.Add(uif.contractID);
                lvi.SubItems.Add(uif.valsign);
                lvi.SubItems.Add(uif.trade_addr_port);
                lvi.SubItems.Add(uif.market_addr_port);
                lvi.SubItems.Add(uif.http_addr_port);
                listUserInfo.Items.Add(lvi);
            }
            if (m_datarecv_send != null)
            {
                m_datarecv_send.OnUserInfoList(listUsers);
            }
        }
示例#2
0
        //读取账户信息 和 工程配置信息
        private void ReadUserInfo()
        {
            #region 加载用户信息
            if (listUsers == null)
            {
                listUsers = OperFile.GetUserInfoByFile();
                if (listUsers == null)
                {
                    return;
                }

                foreach (UserInfoConfig ufi in listUsers)
                {
                    cboxSelectAccount.Items.Add(ufi.username);
                }
            }
            #endregion

            #region 加载工程配置信息
            List <ProjectStrategy> tmpPS = null;
            tmpPS = OperFile.GetProjectInfoByFile();
            if (tmpPS == null || tmpPS.Count == 0)
            {
                return;
            }
            listProjects = tmpPS;
            bool IsChange = false;

            //检查是否存在失效信息
            for (int i = 0; i < listProjects.Count; i++)
            {
                ProjectStrategy pic  = listProjects[i];
                bool            IsIn = false;
                foreach (UserInfoConfig ufi in listUsers)
                {
                    if (pic.username == ufi.username)
                    {
                        Transmit(ref pic, ufi);
                        IsIn = true;
                        break;
                    }
                }
                if (IsIn == false)
                {
                    IsChange = true;
                    listProjects.RemoveAt(i);
                }
            }
            if (IsChange == true)
            {
                OperFile.SaveProjectInfoConfig(listProjects);
            }
            #endregion

            #region 显示信息
            foreach (ProjectStrategy ps in listProjects)
            {
                ListViewItem lvi = new ListViewItem();
                lvi.Text = ps.username;
                lvi.SubItems.Add(ps.projectName);
                lvi.SubItems.Add(EnumRunState.未运行.ToString());
                lvi.SubItems.Add(System.IO.Path.GetFileName(ps.fileName));
                lvi.SubItems.Add(ps.strategyName);
                lvi.SubItems.Add(". . .");
                listStrategy.Items.Add(lvi);
            }

            #endregion
        }