public override void Load(SettingsStorage storage) { if (storage.ContainsKey("UnderlyingAsset")) { UnderlyingAsset.SelectedSecurity = ConfigManager.GetService <IEntityRegistry>().Securities.ReadById(storage.GetValue <string>("UnderlyingAsset")); } Desk.Load(storage.GetValue <SettingsStorage>("Desk")); if (storage.ContainsKey("ExpiryDate")) { ExpiryDate.Value = storage.GetValue <DateTime>("ExpiryDate"); } MinStrike.Value = storage.GetValue <decimal?>("MinStrike"); MaxStrike.Value = storage.GetValue <decimal?>("MaxStrike"); UseBlackMode.IsChecked = Desk.UseBlackModel; if (storage.ContainsKey("CurrentDate")) { CurrentDate.Value = storage.GetValue <DateTime>("CurrentDate"); } AssetPrice.Value = storage.GetValue <decimal?>("AssetPrice"); }
public void Load(SettingsStorage storage) { if (storage.ContainsKey("From")) { From = storage.GetValue <DateTime>("From"); } if (storage.ContainsKey("To")) { To = storage.GetValue <DateTime>("To"); } }
public override void Load(SettingsStorage storage) { if (storage.ContainsKey("UnderlyingAsset")) { UnderlyingAsset.SelectedSecurity = ConfigManager.GetService <IEntityRegistry>().Securities.ReadById(storage.GetValue <string>("UnderlyingAsset")); } if (storage.ContainsKey("CurrentDate")) { CurrentDate.Value = storage.GetValue <DateTime>("CurrentDate"); } AssetPrice.Value = storage.GetValue <decimal?>("AssetPrice"); }
public override void Load(SettingsStorage storage) { _isLoading = true; try { ((IPersistable)MarketDataGrid).Load(storage.GetValue <SettingsStorage>("MarketDataGrid") ?? storage.GetValue <SettingsStorage>("Grid")); var selectedSettings = storage.GetValue("SelectedSettings", Guid.Empty); var settings = ConfigManager.GetService <MarketDataSettingsCache>().Settings; if (selectedSettings != Guid.Empty) { SelectedSettings = settings.FirstOrDefault(s => s.Id == selectedSettings) ?? settings.FirstOrDefault(); } if (storage.ContainsKey("Security")) { SecurityPicker.SelectedSecurity = ConfigManager.GetService <IEntityRegistry>().Securities.ReadById(storage.GetValue <string>("Security")); } FormatCtrl.SelectedFormat = storage.GetValue <StorageFormats>("SelectedFormat"); } finally { _isLoading = false; } RefreshGrid(); }
private void Save() { SettingsStorage clone; bool saveLayout; lock (Storage.SyncRoot) { if (!_needToSave) { return; } saveLayout = _isLayoutChanged; _needToSave = false; _isLayoutChanged = false; clone = new SettingsStorage(); clone.AddRange(Storage); } if (saveLayout || !clone.ContainsKey("MainWindow")) { clone.SetValue("MainWindow", SaveLayout()); } try { CultureInfo.InvariantCulture.DoInCulture(() => new XmlSerializer <SettingsStorage>().Serialize(clone, _configFile)); } catch (Exception ex) { this.AddErrorLog(ex); } }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { var drives = storage .GetValue <IEnumerable <SettingsStorage> >(nameof(Drives)) .Select(s => s.LoadEntire <IMarketDataDrive>()) .ToArray(); lock (_drives.SyncRoot) { foreach (var drive in drives) { _drives.TryAdd(CreatePair(drive.Path), drive); } } if (storage.ContainsKey(nameof(DefaultDrive))) { var pair = CreatePair(storage.GetValue <string>(nameof(DefaultDrive))); if (_drives.TryGetValue(pair, out var drive)) { DefaultDrive = drive; } } }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey(_propKey)) { Property = storage.GetValue <SettingsStorage>(_propKey).ToMember <PropertyInfo>(); } else { var parts = storage.GetValue <string>(nameof(Property)).Split('/'); if (parts.Length > 1) { Property = parts[0].To <Type>().GetMember <PropertyInfo>(parts[1]); } } try { ExtraField = storage.GetValue <SettingsStorage>(nameof(ExtraField))?.FromStorage(); } catch (Exception) { // 2022-08-08 remove 1 year later ExtraField = storage.GetValue <string>(nameof(ExtraField)).To(Property.PropertyType.GetGenericArguments()[0]); } UpdateState(); }
public override void Load(SettingsStorage storage) { base.Load(storage); DepthGrid.Load(storage.GetValue <SettingsStorage>("DepthGrid")); Depth.SelectedIndex = storage.GetValue <int>("Depth"); if (storage.ContainsKey("DepthGenerationInterval")) { DepthGenerationInterval.Value = storage.GetValue <int>("DepthGenerationInterval"); } if (storage.ContainsKey("IsBuildFromOrderLog")) { IsBuildFromOrderLog.IsChecked = storage.GetValue <bool>("IsBuildFromOrderLog"); } }
/// <summary> /// Загрузить настройки. /// </summary> /// <param name="storage">Хранилище настроек.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey("Security")) { Security = ConfigManager.GetService <IEntityRegistry>().Securities.ReadById(storage.GetValue <string>("Security")); } From = storage.GetValue <DateTime>("From"); To = storage.GetValue <DateTime>("To"); if (storage.ContainsKey("Drive")) { Drive = DriveCache.Instance.GetDrive(storage.GetValue <string>("Drive")); } StorageFormat = storage.GetValue <StorageFormats>("StorageFormat"); }
void IPersistable.Load(SettingsStorage storage) { if (storage.ContainsKey("TaskId")) { var taskId = storage.GetValue <Guid>("TaskId"); Task = MainWindow.Instance.Tasks.SingleOrDefault(s => s.Settings.Id == taskId); } SecuritiesCtrl.Load(storage.GetValue <SettingsStorage>("Securities")); }
void IPersistable.Load(SettingsStorage storage) { if (storage.ContainsKey("Drive")) DrivePanel.SelectedDrive = DriveCache.Instance.GetDrive(storage.GetValue<string>("Drive")); DrivePanel.StorageFormat = storage.GetValue<StorageFormats>("StorageFormat"); MarketData.Load(storage.GetValue<SettingsStorage>("MarketData")); SecurityPicker.Load(storage.GetValue<SettingsStorage>("SecurityPicker")); LookupPanel.Load(storage.GetValue<SettingsStorage>("LookupPanel")); }
/// <summary> /// Загрузить настройки. /// </summary> /// <param name="storage">Хранилище настроек.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey("WorkingTime")) { WorkingTime.Load(storage.GetValue <SettingsStorage>("WorkingTime")); } Interval = storage.GetValue <TimeSpan>("Interval"); AttemptCount = storage.GetValue <int>("AttemptCount"); ReAttemptCount = storage.GetValue <int>("ReAttemptCount"); TimeOutInterval = storage.GetValue <TimeSpan>("TimeOutInterval"); }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey(nameof(WorkingTime))) { WorkingTime.Load(storage.GetValue <SettingsStorage>(nameof(WorkingTime))); } Interval = storage.GetValue <TimeSpan>(nameof(Interval)); AttemptCount = storage.GetValue <int>(nameof(AttemptCount)); ReAttemptCount = storage.GetValue <int>(nameof(ReAttemptCount)); TimeOutInterval = storage.GetValue <TimeSpan>(nameof(TimeOutInterval)); }
void IPersistable.Load(SettingsStorage storage) { if (storage.ContainsKey("Drive")) { DrivePanel.SelectedDrive = DriveCache.Instance.GetDrive(storage.GetValue <string>("Drive")); } DrivePanel.StorageFormat = storage.GetValue <StorageFormats>("StorageFormat"); MarketData.Load(storage.GetValue <SettingsStorage>("MarketData")); SecurityPicker.Load(storage.GetValue <SettingsStorage>("SecurityPicker")); DataTypeComboBox.SelectedIndex = storage.GetValue <int>("DataTypeComboBox"); }
public override void Load(SettingsStorage storage) { base.Load(storage); DepthGrid.Load(storage.GetValue <SettingsStorage>("DepthGrid")); Depth.SelectedIndex = storage.GetValue <int>("Depth"); if (storage.ContainsKey("DepthGenerationInterval")) { DepthGenerationInterval.Value = storage.GetValue <int>("DepthGenerationInterval"); } BuildFrom.SelectedIndex = storage.GetValue <int>("BuildFrom"); }
public override void Load(SettingsStorage storage) { base.Load(storage); if (storage.ContainsKey("SelectedLevel1Fields")) { Level1FieldsCtrl.SelectedFields = storage .GetValue <string>("SelectedLevel1Fields") .Split(",") .Select(s => s.To <Level1Fields>()) .ToArray(); } FindedChanges.Load(storage.GetValue <SettingsStorage>("FindedChanges")); }
public void Load(SettingsStorage storage) { Path = storage.GetValue <string>("Path"); ColumnSeparator = storage.GetValue <string>("ColumnSeparator"); //RowSeparator = storage.GetValue<string>("RowSeparator"); SkipFromHeader = storage.GetValue <int>("SkipFromHeader"); //SkipFromFooter = storage.GetValue<int>("SkipFromFooter"); Format = storage.GetValue <StorageFormats>("Format"); if (storage.ContainsKey("Drive")) { Drive = DriveCache.Instance.GetDrive(storage.GetValue <string>("Drive")); } TimeZone = TimeZoneInfo.FindSystemTimeZoneById(storage.GetValue <string>("TimeZone")); CandleSettings = storage.GetValue("CandleSettings", CandleSettings); }
/// <summary> /// Загрузить настройки. /// </summary> /// <param name="storage">Хранилище настроек.</param> public void Load(SettingsStorage storage) { var drives = storage .GetValue <IEnumerable <SettingsStorage> >("Drives") .Select(s => s.LoadEntire <IMarketDataDrive>()) .ToArray(); lock (_drives.SyncRoot) { foreach (var drive in drives) { _drives.TryAdd(drive.Path, drive); } } if (storage.ContainsKey("DefaultDrive")) { DefaultDrive = _drives[storage.GetValue <string>("DefaultDrive")]; } }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey(_propKey)) { Property = storage.GetValue <SettingsStorage>(_propKey).ToMember <PropertyInfo>(); } else { var parts = storage.GetValue <string>(nameof(Property)).Split('/'); if (parts.Length > 1) { Property = parts[0].To <Type>().GetMember <PropertyInfo>(parts[1]); } } ExtraField = storage.GetValue <object>(nameof(ExtraField)); UpdateState(); }
public override void Load(SettingsStorage storage) { base.Load(storage); if (storage.ContainsKey("SelectedLevel1Fields")) { Level1FieldsCtrl.SelectedFields = storage .GetValue <string>("SelectedLevel1Fields") .Split(",") .Select(s => s.To <Level1Fields>()) .ToArray(); } FindedChanges.Load(storage.GetValue <SettingsStorage>("FindedChanges")); var selectedFields = Level1FieldsCtrl.SelectedFields.ToArray(); foreach (var pair in _columns) { pair.Value.Visibility = selectedFields.Contains(pair.Key) ? Visibility.Visible : Visibility.Collapsed; } }
public override void Load(SettingsStorage storage) { _isLoading = true; try { ((IPersistable)Grid).Load(storage.GetValue <SettingsStorage>("Grid")); if (storage.ContainsKey("Security")) { SecurityPicker.SelectedSecurity = ConfigManager.GetService <IEntityRegistry>().Securities.ReadById(storage.GetValue <string>("Security")); } FormatCtrl.SelectedFormat = storage.GetValue <StorageFormats>("SelectedFormat"); } finally { _isLoading = false; } RefreshGrid(); }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey("Times")) { // TODO Удалить через несколько версий Periods = new[] { new WorkingTimePeriod { Till = DateTime.MaxValue, Times = storage.GetValue <Range <TimeSpan>[]>("Times") } }; } else { Periods = storage.GetValue <IEnumerable <SettingsStorage> >("Periods").Select(s => s.Load <WorkingTimePeriod>()).ToArray(); } SpecialWorkingDays = storage.GetValue <DateTime[]>("SpecialWorkingDays"); SpecialHolidays = storage.GetValue <DateTime[]>("SpecialHolidays"); }
public override void Load(SettingsStorage storage) { _isLoading = true; try { ((IPersistable)Grid).Load(storage.GetValue<SettingsStorage>("Grid")); if (storage.ContainsKey("Security")) SecurityPicker.SelectedSecurity = ConfigManager.GetService<IEntityRegistry>().Securities.ReadById(storage.GetValue<string>("Security")); FormatCtrl.SelectedFormat = storage.GetValue<StorageFormats>("SelectedFormat"); } finally { _isLoading = false; } RefreshGrid(); }
public override void Load(SettingsStorage storage) { _isLoading = true; try { ((IPersistable)MarketDataGrid).Load(storage.GetValue<SettingsStorage>("MarketDataGrid") ?? storage.GetValue<SettingsStorage>("Grid")); var selectedSettings = storage.GetValue("SelectedSettings", Guid.Empty); var settings = ConfigManager.GetService<MarketDataSettingsCache>().Settings; if (selectedSettings != Guid.Empty) SelectedSettings = settings.FirstOrDefault(s => s.Id == selectedSettings) ?? settings.FirstOrDefault(s => s.Id != Guid.Empty); if (storage.ContainsKey("Security")) SecurityPicker.SelectedSecurity = ConfigManager.GetService<IEntityRegistry>().Securities.ReadById(storage.GetValue<string>("Security")); FormatCtrl.SelectedFormat = storage.GetValue<StorageFormats>("SelectedFormat"); } finally { _isLoading = false; } RefreshGrid(); }
void IPersistable.Load(SettingsStorage storage) { if (storage.ContainsKey("LogMonitor")) MonitorControl.Load(storage.GetValue<SettingsStorage>("LogMonitor")); }
public override void Load(SettingsStorage storage) { base.Load(storage); if (storage.ContainsKey("SelectedLevel1Fields")) { Level1FieldsCtrl.SelectedFields = storage .GetValue<string>("SelectedLevel1Fields") .Split(",") .Select(s => s.To<Level1Fields>()) .ToArray(); } FindedChanges.Load(storage.GetValue<SettingsStorage>("FindedChanges")); var selectedFields = Level1FieldsCtrl.SelectedFields.ToArray(); foreach (var pair in _columns) { pair.Value.Visibility = selectedFields.Contains(pair.Key) ? Visibility.Visible : Visibility.Collapsed; } }
public virtual void Load(SettingsStorage storage) { if (storage.ContainsKey("SelectedSecurity")) SelectedSecurity = ConfigManager.GetService<IEntityRegistry>().Securities.ReadById(storage.GetValue<string>("SelectedSecurity")); From = storage.GetValue<DateTime?>("From"); To = storage.GetValue<DateTime?>("To"); if (storage.ContainsKey("Drive")) Drive = DriveCache.Instance.GetDrive(storage.GetValue<string>("Drive")); StorageFormat = storage.GetValue<StorageFormats>("StorageFormat"); }
public void Load(SettingsStorage storage) { if (storage.ContainsKey(nameof(Security))) Security = ConfigManager.GetService<IEntityRegistry>().Securities.ReadById(storage.GetValue<string>("Security")); From = storage.GetValue<DateTime>(nameof(From)); To = storage.GetValue<DateTime>(nameof(To)); if (storage.ContainsKey(nameof(Drive))) Drive = DriveCache.Instance.GetDrive(storage.GetValue<string>(nameof(Drive))); StorageFormat = storage.GetValue<StorageFormats>(nameof(StorageFormat)); }
public override void Load(SettingsStorage storage) { if (storage.ContainsKey("UnderlyingAsset")) UnderlyingAsset.SelectedSecurity = ConfigManager.GetService<IEntityRegistry>().Securities.ReadById(storage.GetValue<string>("UnderlyingAsset")); Desk.Load(storage.GetValue<SettingsStorage>("Desk")); if (storage.ContainsKey("ExpiryDate")) ExpiryDate.Value = storage.GetValue<DateTime>("ExpiryDate"); MinStrike.Value = storage.GetValue<decimal?>("MinStrike"); MaxStrike.Value = storage.GetValue<decimal?>("MaxStrike"); UseBlackMode.IsChecked = Desk.UseBlackModel; if (storage.ContainsKey("CurrentDate")) CurrentDate.Value = storage.GetValue<DateTime>("CurrentDate"); AssetPrice.Value = storage.GetValue<decimal?>("AssetPrice"); }
void IPersistable.Load(SettingsStorage storage) { if (storage.ContainsKey("Drive")) DrivePanel.SelectedDrive = DriveCache.Instance.GetDrive(storage.GetValue<string>("Drive")); DrivePanel.StorageFormat = storage.GetValue<StorageFormats>("StorageFormat"); MarketData.Load(storage.GetValue<SettingsStorage>("MarketData")); SecurityPicker.Load(storage.GetValue<SettingsStorage>("SecurityPicker")); DataTypeComboBox.SelectedIndex = storage.GetValue<int>("DataTypeComboBox"); }
public void Load(SettingsStorage storage) { Path = storage.GetValue<string>("Path"); ColumnSeparator = storage.GetValue<string>("ColumnSeparator"); //RowSeparator = storage.GetValue<string>("RowSeparator"); SkipFromHeader = storage.GetValue<int>("SkipFromHeader"); //SkipFromFooter = storage.GetValue<int>("SkipFromFooter"); Format = storage.GetValue<StorageFormats>("Format"); if (storage.ContainsKey("Drive")) Drive = DriveCache.Instance.GetDrive(storage.GetValue<string>("Drive")); TimeZone = TimeZoneInfo.FindSystemTimeZoneById(storage.GetValue<string>("TimeZone")); CandleSettings = storage.GetValue("CandleSettings", CandleSettings); }
public override void Load(SettingsStorage storage) { if (storage.ContainsKey("UnderlyingAsset")) UnderlyingAsset.SelectedSecurity = ConfigManager.GetService<IEntityRegistry>().Securities.ReadById(storage.GetValue<string>("UnderlyingAsset")); if (storage.ContainsKey("CurrentDate")) CurrentDate.Value = storage.GetValue<DateTime>("CurrentDate"); AssetPrice.Value = storage.GetValue<decimal?>("AssetPrice"); }
private ExportDiagramElement LoadComposition(string strategyFile) { var password = _settings.GetValue <SecureString>("Password"); var hasPassword = _settings.ContainsKey("Password"); var savePassword = false; var strategy = File.ReadAllText(strategyFile); while (true) { if (!hasPassword) { var wnd = new SecretWindow { Secret = password }; if (!wnd.ShowModal(this)) { return(null); } savePassword = wnd.SaveSecret; password = wnd.Secret; } try { var data = strategy; if (!password.IsEmpty()) { data = data.Decrypt(password.To <string>()); } var composition = ConfigManager.GetService <CompositionRegistry>().DeserializeExported(data.LoadSettingsStorage()); if (!savePassword) { return(composition); } _settings.SetValue("Password", password); SaveSettings(); return(composition); } catch (Exception ex) { ex.LogError(); new MessageBoxBuilder() .Error() .Text(LocalizedStrings.StrategyLoadingError) .Owner(this) .Button(MessageBoxButton.OK) .Show(); hasPassword = false; } } }
public override void Load(SettingsStorage storage) { base.Load(storage); DepthGrid.Load(storage.GetValue<SettingsStorage>("DepthGrid")); Depth.SelectedIndex = storage.GetValue<int>("Depth"); if (storage.ContainsKey("DepthGenerationInterval")) DepthGenerationInterval.Value = storage.GetValue<int>("DepthGenerationInterval"); if (storage.ContainsKey("IsBuildFromOrderLog")) IsBuildFromOrderLog.IsChecked = storage.GetValue<bool>("IsBuildFromOrderLog"); }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey("WorkingTime")) WorkingTime.Load(storage.GetValue<SettingsStorage>("WorkingTime")); Interval = storage.GetValue<TimeSpan>("Interval"); AttemptCount = storage.GetValue<int>("AttemptCount"); ReAttemptCount = storage.GetValue<int>("ReAttemptCount"); TimeOutInterval = storage.GetValue<TimeSpan>("TimeOutInterval"); }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { if (storage.ContainsKey(nameof(WorkingTime))) WorkingTime.Load(storage.GetValue<SettingsStorage>(nameof(WorkingTime))); Interval = storage.GetValue<TimeSpan>(nameof(Interval)); AttemptCount = storage.GetValue<int>(nameof(AttemptCount)); ReAttemptCount = storage.GetValue<int>(nameof(ReAttemptCount)); TimeOutInterval = storage.GetValue<TimeSpan>(nameof(TimeOutInterval)); }
public override void Load(SettingsStorage storage) { base.Load(storage); DepthGrid.Load(storage.GetValue<SettingsStorage>("DepthGrid")); Depth.SelectedIndex = storage.GetValue<int>("Depth"); if (storage.ContainsKey("DepthGenerationInterval")) DepthGenerationInterval.Value = storage.GetValue<int>("DepthGenerationInterval"); BuildFrom.SelectedIndex = storage.GetValue<int>("BuildFrom"); }
public override void Load(SettingsStorage storage) { base.Load(storage); if (storage.ContainsKey("SelectedLevel1Fields")) { Level1FieldsCtrl.SelectedFields = storage .GetValue<string>("SelectedLevel1Fields") .Split(",") .Select(s => s.To<Level1Fields>()) .ToArray(); } FindedChanges.Load(storage.GetValue<SettingsStorage>("FindedChanges")); }