Beispiel #1
0
        private void InitializeUserControl()
        {
            this.orderBookListControl1.Initialize();
            this.tradeBookListControl1.Initialize();
            this.positionListControl1.Initialize();
            this.arbitrageOrderListControl1.Initialize();
            this.arbitrageLogViewControl1.Initialize();
            this.arbitrageRunStateControl1.Initialize();
            this.bottomStateControl1.Initialize();
            this.investorFundControl1.Initialize();
            this.alarmNoticeViewControl1.Initialize();

            this.bottomStateControl1.OnSelectedProduct += BottomStateControl1_OnSelectedProduct;

            //this.arbitrageQuoteListControl1.OnSelectCombineInstrumentChanged += QuoteListControl1_OnSelectInstrumentChanged;

            UserDefineSetting userSetting = USeManager.Instance.SystemConfigManager.GetUserDefineSetting();

            Debug.Assert(userSetting != null);

            this.arbitrageQuoteListControl1.Initialize();
            this.arbitrageQuoteListControl1.OnSelectCombineInstrumentChanged += ArbitrageQuoteListControl1_OnSelectCombineInstrumentChanged;

            USeProduct defaultProduct = new USeProduct()
            {
                ProductCode = userSetting.LastSelectProduct,
                ShortName   = userSetting.LastSelectProductName
            };

            this.bottomStateControl1.SetDefaultProduct(defaultProduct);
            SetDefaultProduct(defaultProduct);
        }
        /// <summary>
        /// 初始化。
        /// </summary>
        public void Initialize()
        {
            try
            {
                if (m_dataAccessor == null)
                {
                    throw new ApplicationException("未设定数据访问器");
                }

                USeSystemSetting systemSetting = m_dataAccessor.GetUseSystemSetting();
                if (systemSetting == null)
                {
                    systemSetting = USeSystemSetting.CreateDefault();
                }

                UserDefineSetting userDefineSetting = m_dataAccessor.GetUserDefineSetting();
                if (userDefineSetting == null)
                {
                    userDefineSetting = UserDefineSetting.CreateDefault();
                }

                lock (m_syncObj)
                {
                    m_systemSetting     = systemSetting;
                    m_userDefineSetting = userDefineSetting;
                }
            }
            catch (Exception ex)
            {
                throw new Exception("初始化系统配置管理类失败," + ex.Message);
            }
        }
 /// <summary>
 /// 获取用户自定义配置。
 /// </summary>
 /// <returns></returns>
 public UserDefineSetting GetUserDefineSetting()
 {
     Debug.Assert(m_userDefineSetting != null);
     lock (m_syncObj)
     {
         UserDefineSetting setting = m_userDefineSetting.Clone();
         return(setting);
     }
 }
Beispiel #4
0
 /// <summary>
 /// 保存用户配置。
 /// </summary>
 /// <param name="userConfig">用户配置。</param>
 public void SaveUserDefineConfig(UserDefineSetting userConfig)
 {
     try
     {
         USeXmlSerializer.SaveToXml(this.UserDefineSettingFilePath, userConfig);
     }
     catch (Exception ex)
     {
         throw new Exception("SaveUSeSystemConfig failed,Error:" + ex.Message);
     }
 }
Beispiel #5
0
        /// <summary>
        /// 创建用户默认定义。
        /// </summary>
        /// <returns></returns>
        public static UserDefineSetting CreateDefault()
        {
            UserDefineSetting config = new UserDefineSetting()
            {
                LastInvestorId        = string.Empty,
                SaveInvestorId        = true,
                LastSelectProduct     = "cu",
                LastSelectProductName = "铜"
            };

            return(config);
        }
Beispiel #6
0
        public UserDefineSetting Clone()
        {
            UserDefineSetting setting = new UserDefineSetting()
            {
                LastInvestorId        = this.LastInvestorId,
                SaveInvestorId        = this.SaveInvestorId,
                LastSelectProduct     = this.LastSelectProduct,
                LastSelectProductName = this.LastSelectProductName
            };

            return(setting);
        }
Beispiel #7
0
        private void LoginForm_Load(object sender, EventArgs e)
        {
            LoadFrontServer();
            this.txtAccount.Focus();
            this.txtAccount.Select();

            UserDefineSetting userSetting = USeManager.Instance.SystemConfigManager.GetUserDefineSetting();

            if (userSetting.SaveInvestorId)
            {
                this.txtAccount.Text = userSetting.LastInvestorId;
                this.cbxSaveInvestorAccount.Checked = true;
            }
# if DEBUG
            this.txtAccount.Text  = "090952";
        /// <summary>
        /// 保存用户设定。
        /// </summary>
        /// <param name="userSetting"></param>
        public void SaveUserDefineSetting(UserDefineSetting userSetting)
        {
            try
            {
                m_dataAccessor.SaveUserDefineConfig(userSetting);

                lock (m_syncObj)
                {
                    m_userDefineSetting = userSetting.Clone();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("保存用户设定失败," + ex.Message);
            }

            SafeFireUserDefineSettingChanged();
        }
Beispiel #9
0
        private void BottomStateControl1_OnSelectedProduct(USeProduct product)
        {
            SetDefaultProduct(product);
            m_product = product;
            UserDefineSetting userSetting = USeManager.Instance.SystemConfigManager.GetUserDefineSetting();

            userSetting.LastSelectProduct     = product.ProductCode;
            userSetting.LastSelectProductName = product.ShortName;

            try
            {
                USeManager.Instance.SystemConfigManager.SaveUserDefineSetting(userSetting);
            }
            catch (Exception ex)
            {
                Debug.Assert(false, ex.Message);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 获取用户配置信息。
        /// </summary>
        /// <returns></returns>
        public UserDefineSetting GetUserDefineSetting()
        {
            UserDefineSetting userConfig = null;

            try
            {
                if (File.Exists(this.UserDefineSettingFilePath) == false)
                {
                    userConfig = new UserDefineSetting();
                }
                else
                {
                    userConfig = USeXmlSerializer.LoadFromXml <UserDefineSetting>(this.UserDefineSettingFilePath);
                }
                return(userConfig);
            }
            catch (Exception ex)
            {
                throw new Exception("GetUserDefineSetting failed,Error:" + ex.Message);
            }
        }