private void btnTradingSets_Click(object sender, EventArgs e) { var sets = TradersSettings.ReadSettings(); var dlg = new TradingSettingsDialog(sets); dlg.ShowDialog(); }
public static SettingsPreset GetPresetByIndex(int index) { var defSets = TradersSettings.ReadSettings(); var presetType = Presets[index].GetType(); return((SettingsPreset)presetType.GetConstructor(new[] { typeof(TradersSettings) }).Invoke(new object[] { defSets })); }
public MoneyManagementDialog() { InitializeComponent(); settings = TradersSettings.ReadSettings(); tbContracts.Text = JsonConvert.SerializeObject(settings.MoneyManagementSets.Tickers, Formatting.Indented); cbTradeRandomContract.Checked = settings.MoneyManagementSets.TradeRandomTicker; tbFixedContractId.Text = settings.MoneyManagementSets.FixedTickerIndex.ToString(); tbLotsMin.Text = settings.MoneyManagementSets.LotsMin.ToStringDefault(); tbLotsMax.Text = settings.MoneyManagementSets.LotsMax.ToStringDefault(); ControlsValidation.SetupErrorProvider(out tbLotsMinErrorProvider, tbLotsMin); ControlsValidation.SetupErrorProvider(out tbLotsMaxErrorProvider, tbLotsMax); }
/// <summary> /// set up predefined test scenarios' buttons /// </summary> private void SetupPresets() { var defSets = TradersSettings.ReadSettings(); SettingsPreset.Presets = new SettingsPreset[] { new TakerPoolPreset(defSets), new MakerTakerEven(defSets), new SimpleFadeInPreset(defSets), new OneShotPreset(defSets), new SinusoidalPreset(defSets), new SlowLoadGrowthPreset(defSets), new StairsPreset(defSets), new StairsDownPreset(defSets) }; presetButtons = new List <Button> { btnPreset01, btnPreset02, btnPreset03, btnPreset04, btnPreset05, btnPreset06, btnPreset07, btnPreset08 }; for (var i = 0; i < presetButtons.Count; i++) { var preset = SettingsPreset.Presets[i]; presetButtons[i].Tag = i; presetButtons[i].ImageIndex = preset.ImageIndex; toolTip.SetToolTip(presetButtons[i], preset.Description); // setup and run the test on the button's click presetButtons[i].Click += (sender, args) => { if (pool != null) { return; } var presetIndex = (int)((Button)sender).Tag; var dlg = new PresetDialog(SettingsPreset.GetPresetByIndex(presetIndex)); if (dlg.ShowDialog() != DialogResult.OK) { return; } StartTest(); }; } toolTip.SetToolTip(btnStop, "Stop the test"); toolTip.SetToolTip(btnManTest, "Manually set up and start a test"); }
public CommonSettingsDialog() { InitializeComponent(); settings = TradersSettings.ReadSettings(); var logTypes = Enum.GetValues(typeof(LoggingLevel)).Cast <object>().ToArray(); cbLoggingLevel.Items.AddRange(logTypes); cbLoggingLevel.SelectedItem = settings.LoggingLevel; cbSaveServersStat.Checked = settings.LogServerStatistics; tbStatTimeframe.Text = settings.StatisticsTimeframeSeconds.ToStringDefault(); tbTestDuration.Text = settings.TestDurationSeconds.ToStringDefault(); ControlsValidation.SetupErrorProvider(out tbStatTimeframeErrorProvider, tbStatTimeframe); }
/// <summary> /// show the connection's settings dialog /// and apply the settings provided by the user /// </summary> private void btnSetupConnection_Click(object sender, EventArgs e) { if (pool != null) { return; } var sets = TradersSettings.ReadSettings(); var dlg = new ConnectionSettingsDialog { MatchingURI = sets.Uri, StatusURI = sets.StatUri }; dlg.ShowDialog(); if (dlg.DialogResult != DialogResult.OK) { return; } sets.Uri = dlg.MatchingURI; sets.StatUri = dlg.StatusURI; sets.SaveSettings(); }