예제 #1
0
        private bool VerifyDataCheck(FrontSeverConfigViewModel data)
        {
            Debug.Assert(data != null);

            bool conditionStrIsNull = data.BrokerID == string.Empty ||
                                      data.BrokerName == string.Empty ||
                                      data.QuoteFrontAddress == string.Empty ||
                                      data.TradeFrontAddress == string.Empty;

            if (conditionStrIsNull)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "有选项为空,请填入信息......");
                return(false);
            }

            if (data.QuoteFrontPort <= 0 || data.QuoteFrontPort >= 65535)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "请填入正确的行情端口号......");
                return(false);
            }

            if (data.TradeFrontPort <= 0 || data.TradeFrontPort >= 65535)
            {
                USeFuturesSpiritUtility.ShowWarningMessageBox(this, "请填入正确的交易端口号......");
                return(false);
            }

            return(true);
        }
        public static FrontSeverConfigViewModel Create(FrontSeverConfig data)
        {
            FrontSeverConfigViewModel model = new FrontSeverConfigViewModel();

            model.BrokerID          = data.BrokerID;
            model.BrokerName        = data.BrokerName;
            model.QuoteFrontAddress = data.QuoteFrontAddress;
            model.QuoteFrontPort    = data.QuoteFrontPort;
            model.TradeFrontAddress = data.TradeFrontAddress;
            model.TradeFrontPort    = data.TradeFrontPort;
            return(model);
        }
예제 #3
0
        private void FrontServerConfigForm_Load(object sender, EventArgs e)
        {
            m_dataSource = new BindingList <FrontSeverConfigViewModel>();
            this.gridServerConfig.AutoGenerateColumns = false;
            this.gridServerConfig.DataSource          = m_dataSource;

            GlobalFontServerConfig globalConfig = USeManager.Instance.DataAccessor.GetGlobalFontServerConfig();

            if (globalConfig != null && globalConfig.ServerList != null && globalConfig.ServerList.Count > 0)
            {
                foreach (FrontSeverConfig item in globalConfig.ServerList)
                {
                    m_dataSource.Add(FrontSeverConfigViewModel.Create(item));
                }
            }
        }