public Main() { _settingsManager = Factories.CreateSettingsManager(); _logger = LoggerFactory.Create(_settingsManager.LogFilePath); this._timeManager = ServiceFactory.CreateTimeManager(_settingsManager.GetSettingValue(AppSettingsKey.Begin), _settingsManager.GetSettingValue(AppSettingsKey.End)); InitializeComponent(); CheckBasicSettings(); InitBasicUI(); if (!_basicSettingOK) { OnEditConfig(null, null); return; } InitOrderMaker(); if (!HasTradeSettings) { this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("您還沒有設定策略. 請先設定策略才可同步下單.", Color.Red, DockStyle.Fill), 0, 0); } else { this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("策略設定", Color.Black, DockStyle.Fill), 0, 0); } InitStrategyUI(); }
void InitBasicUI() { if (_basicSettingOK) { this.tpTop.Controls.Add(UIHelpers.CreateLabel("基本設定", Color.Black, DockStyle.Fill), 0, 0); } else { this.tpTop.Controls.Add(UIHelpers.CreateLabel("您還沒有完成基本設定", Color.Red, DockStyle.Fill), 0, 0); } }
public Uc_Strategy(IOrderMaker orderMaker, TradeSettings settings, ITimeManager timeManager, ILogger logger) { this._orderMaker = orderMaker; this._tradeSettings = settings; this._timeManager = timeManager; this._logger = logger; InitializeComponent(); if (!File.Exists(_tradeSettings.FileName)) { File.Create(_tradeSettings.FileName).Close(); } _positionFile = new PositionFile(); _positionManager = ServiceFactory.CreatePositionManager(_orderMaker, _tradeSettings, logger); this.timer.Interval = _tradeSettings.Interval; this.timer.Enabled = true; #region UI var lbl = UIHelpers.CreateLabel(_tradeSettings.Name); lbl.Font = new System.Drawing.Font("新細明體", 11.25F); this.tpTop.Controls.Add(lbl, 0, 0); this.tpTop.Controls.Add(UIHelpers.CreateLabel("即時部位:"), 2, 0); lblPosition = UIHelpers.CreateLabel(""); this.tpTop.Controls.Add(lblPosition, 3, 0); lblTime = UIHelpers.CreateLabel(""); this.tpTop.Controls.Add(lblTime, 4, 0); for (int i = 0; i < _tradeSettings.Accounts.Count; i++) { var item = _tradeSettings.Accounts[i]; var uc_Account = new Uc_Account(); uc_Account.BindData(item); this.uc_AccountList.Add(uc_Account); fpanelAccounts.Height += uc_Account.Height; this.fpanelAccounts.Controls.Add(uc_Account); fpanelAccounts.Controls.SetChildIndex(uc_Account, 0); this.Height += uc_Account.Height; } #endregion }
public StrategyTestForm() { _settingsManager = Factories.CreateSettingsManager(); _logger = LoggerFactory.Create(_settingsManager.LogFilePath); this._timeManager = ServiceFactory.CreateTimeManager(_settingsManager.GetSettingValue(AppSettingsKey.Begin), _settingsManager.GetSettingValue(AppSettingsKey.End)); InitializeComponent(); if (HasTradeSettings) { this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("策略設定", Color.Black, DockStyle.Fill), 0, 0); } else { this.tpStrategy.Controls.Add(UIHelpers.CreateLabel("您還沒有設定策略. 請先設定策略才可同步下單.", Color.Red, DockStyle.Fill), 0, 0); } InitOrderMaker(); InitStrategyUI(); }
public EditConfig(ISettingsManager settingsManager, ITimeManager timeManager) { this._settingsManager = settingsManager; this._timeManager = timeManager; InitializeComponent(); #region UI this.tpMain.Dock = DockStyle.Fill; this.tpMain.ColumnCount = 2; this.tpMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 15F)); this.tpMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 85F)); this.tpMain.RowCount = 5; for (int i = 0; i < this.tpMain.RowCount; i++) { this.tpMain.RowStyles.Add(new RowStyle(SizeType.Absolute, 45F)); } this.tpMain.Controls.Add(UIHelpers.CreateLabel("開始"), 0, 0); openTimePicker.Format = DateTimePickerFormat.Custom; openTimePicker.CustomFormat = "HH:mm:ss"; openTimePicker.ShowUpDown = true; openTimePicker.Width = 100; this.tpMain.Controls.Add(openTimePicker, 1, 0); this.tpMain.Controls.Add(UIHelpers.CreateLabel("結束"), 0, 1); closeTimePicker.Format = DateTimePickerFormat.Custom; closeTimePicker.CustomFormat = "HH:mm:ss"; closeTimePicker.ShowUpDown = true; closeTimePicker.Width = 100; this.tpMain.Controls.Add(closeTimePicker, 1, 1); this.tpMain.Controls.Add(UIHelpers.CreateLabel("身分證號"), 0, 2); txSID.Width = 100; this.tpMain.Controls.Add(txSID, 1, 2); this.tpMain.Controls.Add(UIHelpers.CreateLabel("密碼"), 0, 3); txPW.Text = this.defaultPW; txPW.PasswordChar = '*'; txPW.Width = 100; this.tpMain.Controls.Add(txPW, 1, 3); btnSave.Text = "存檔"; btnSave.Click += new System.EventHandler(this.OnSave); this.tpMain.Controls.Add(btnSave, 1, this.tpMain.RowCount - 1); this.panel1.Controls.Add(this.tpMain); #endregion BindData(); }