Exemple #1
0
        public RefreshSecurities(MarketDataSettings settings, IEnumerable <SecurityTypes> types, Func <bool> isCancelled, Action <int> progressChanged, Action <int> whenFinished)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (types == null)
            {
                throw new ArgumentNullException(nameof(types));
            }

            if (isCancelled == null)
            {
                throw new ArgumentNullException(nameof(isCancelled));
            }

            if (progressChanged == null)
            {
                throw new ArgumentNullException(nameof(progressChanged));
            }

            if (whenFinished == null)
            {
                throw new ArgumentNullException(nameof(whenFinished));
            }

            Settings        = settings;
            Types           = types;
            IsCancelled     = isCancelled;
            ProgressChanged = progressChanged;
            WhenFinished    = whenFinished;
        }
Exemple #2
0
        private void SettingsChanged(MarketDataSettings settings)
        {
            SettingsPanel.Path    = string.Empty;
            SettingsPanel.Address = string.Empty;
            SetCredentials();

            if (settings == null)
            {
                SettingsPanel.IsEnabled = false;
                return;
            }

            SettingsPanel.IsEnabled = true;
            SettingsPanel.IsLocal   = settings.UseLocal;
            //SettingsPanel.IsAlphabetic = settings.IsAlphabetic;

            if (settings.UseLocal)
            {
                SettingsPanel.Path = settings.Path;
            }
            else
            {
                SettingsPanel.Address = settings.Path;
            }

            SetCredentials(settings.Credentials);
        }
		private void SettingsChanged(MarketDataSettings settings)
		{
			if (settings == null)
			{
				SettingsPanel.IsEnabled = false;
				MarketDataGrid.IsEnabled = false;
				return;
			}

			SettingsPanel.IsEnabled = true;
			MarketDataGrid.IsEnabled = true;

			SettingsPanel.IsLocal = settings.UseLocal;
			//SettingsPanel.IsAlphabetic = settings.IsAlphabetic;

			if (settings.UseLocal)
				SettingsPanel.Path = settings.Path;
			else
				SettingsPanel.Address = settings.Path;

			SetCredentials(settings.IsStockSharpStorage, settings.Credentials);

			_storageRegistry = new StudioStorageRegistry { MarketDataSettings = settings };
			RefreshGrid();
		}
        private void SettingsChanged(MarketDataSettings settings)
        {
            if (settings == null)
            {
                SettingsPanel.IsEnabled = false;
                Grid.IsEnabled          = false;
                return;
            }

            SettingsPanel.IsEnabled = true;
            Grid.IsEnabled          = true;

            SettingsPanel.IsLocal = settings.UseLocal;
            //SettingsPanel.IsAlphabetic = settings.IsAlphabetic;

            if (settings.UseLocal)
            {
                SettingsPanel.Path = settings.Path;
            }
            else
            {
                SettingsPanel.Address = settings.Path;
            }

            SetCredentials(settings.IsStockSharpStorage, settings.Credentials);

            _storageRegistry = new StudioStorageRegistry {
                MarketDataSettings = settings
            };
            RefreshGrid();
        }
        public override void Load(SettingsStorage storage)
        {
            _isLoading = true;

            try
            {
                ((IPersistable)Grid).Load(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();
        }
		public OpenMarketDataSettingsCommand(MarketDataSettings settings)
		{
			if (settings == null)
				throw new ArgumentNullException(nameof(settings));

			Settings = settings;
		}
Exemple #7
0
        public OpenMarketDataSettingsCommand(MarketDataSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            Settings = settings;
        }
Exemple #8
0
        private void OpenMarketDataPanel(MarketDataSettings settings)
        {
            var content = new MarketDataPanel
            {
                SelectedSettings = settings
            };

            _layoutManager.OpenDocumentWindow(content);
        }
		public MarketDataSettingsCache()
		{
			NewSettingsItem = new MarketDataSettings
			{
				Id = Guid.Empty,
				Path = LocalizedStrings.Str3229 + "..."
			};

			Settings = new ObservableCollection<MarketDataSettings> { NewSettingsItem };
			Settings.CollectionChanged += OnSettingsCollectionChanged;
		}
        public MarketDataPanel()
        {
            DataContext = this;
            InitializeComponent();

            SelectedSettings = ConfigManager.GetService <MarketDataSettingsCache>().Settings.FirstOrDefault(s => s.Id != Guid.Empty);
            SecurityPicker.SecurityProvider = ConfigManager.GetService <FilterableSecurityProvider>();

            Grid.PropertyChanged += (s, e) => RaiseChangedCommand();
            Grid.DataLoading     += () => BusyIndicator1.IsBusy = true;
            Grid.DataLoaded      += () => BusyIndicator1.IsBusy = false;
        }
		public MarketDataPanel()
		{
			DataContext = this;
			InitializeComponent();

			SelectedSettings = ConfigManager.GetService<MarketDataSettingsCache>().Settings.FirstOrDefault(s => s.Id != Guid.Empty);
			SecurityPicker.SecurityProvider = ConfigManager.GetService<ISecurityProvider>();

			MarketDataGrid.PropertyChanged += (s, e) => RaiseChangedCommand();
			MarketDataGrid.DataLoading += () => BusyIndicator1.IsBusy = true;
			MarketDataGrid.DataLoaded += () => BusyIndicator1.IsBusy = false;
		}
		private void SettingsChanged(MarketDataSettings settings)
		{
			if (settings != null)
			{
				MarketDataGrid.IsEnabled = true;
				SecurityPicker.SelectedSecurity = null;

				_storageRegistry = new StudioStorageRegistry
				{
					MarketDataSettings = settings
				};
				RefreshGrid();
			}
			else
				MarketDataGrid.IsEnabled = false;
		}
Exemple #13
0
        private void SettingsChanged(MarketDataSettings settings)
        {
            if (settings != null)
            {
                MarketDataGrid.IsEnabled        = true;
                SecurityPicker.SelectedSecurity = null;

                _storageRegistry = new StudioStorageRegistry
                {
                    MarketDataSettings = settings
                };
                RefreshGrid();
            }
            else
            {
                MarketDataGrid.IsEnabled = false;
            }
        }
		private void MarketDataSettingsComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			var item = (MarketDataSettings)SelectedItem;

			var isNew = item == _cache.NewSettingsItem;
			var selection = !isNew
				? item
				: new MarketDataSettings
				{
					UseLocal = true,
					//IsAlphabetic = true,
					Path = Environment.CurrentDirectory
				};

			SelectedSettings = selection;

			if (!isNew)
				return;

			_cache.Settings.Add(selection);
			new OpenMarketDataSettingsCommand(selection).Process(this);
		}
		public RefreshSecurities(MarketDataSettings settings, IEnumerable<SecurityTypes> types, Func<bool> isCancelled, Action<int> progressChanged, Action<int> whenFinished)
		{
			if (settings == null)
				throw new ArgumentNullException(nameof(settings));

			if (types == null)
				throw new ArgumentNullException(nameof(types));

			if (isCancelled == null)
				throw new ArgumentNullException(nameof(isCancelled));

			if (progressChanged == null)
				throw new ArgumentNullException(nameof(progressChanged));

			if (whenFinished == null)
				throw new ArgumentNullException(nameof(whenFinished));

			Settings = settings;
			Types = types;
			IsCancelled = isCancelled;
			ProgressChanged = progressChanged;
			WhenFinished = whenFinished;
		}
Exemple #16
0
        private void AddCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var settings = new MarketDataSettings
            {
                UseLocal = true,
                //Path = Environment.CurrentDirectory
            };

            var settingsWnd = new StorageSettingsWindow
            {
                Settings = settings
            };

            if (!settingsWnd.ShowModal(this))
            {
                return;
            }

            var cache = ConfigManager.GetService <MarketDataSettingsCache>();

            cache.Settings.Add(settings);
            SelectedSettings = settings;
        }
		private void SettingsChanged(MarketDataSettings settings)
		{
			SettingsPanel.Path = string.Empty;
			SettingsPanel.Address = string.Empty;
			SetCredentials();

			if (settings == null)
			{
				SettingsPanel.IsEnabled = false;
				return;
			}

			SettingsPanel.IsEnabled = true;
			SettingsPanel.IsLocal = settings.UseLocal;
			//SettingsPanel.IsAlphabetic = settings.IsAlphabetic;

			if (settings.UseLocal)
				SettingsPanel.Path = settings.Path;
			else
				SettingsPanel.Address = settings.Path;

			SetCredentials(settings.Credentials);
		}
Exemple #18
0
        private void MarketDataSettingsComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var item = (MarketDataSettings)SelectedItem;

            var isNew     = item == _cache.NewSettingsItem;
            var selection = !isNew
                                ? item
                                : new MarketDataSettings
            {
                UseLocal = true,
                //IsAlphabetic = true,
                Path = Environment.CurrentDirectory
            };

            SelectedSettings = selection;

            if (!isNew)
            {
                return;
            }

            _cache.Settings.Add(selection);
            new OpenMarketDataSettingsCommand(selection).Process(this);
        }
 public MarketInfoRecorder(MarketDataSettings settings)
 {
     Settings = settings;
 }
		public override void Load(SettingsStorage storage)
		{
			_storage = storage;

			var strategyInfoId = storage.GetValue<long?>("StrategyInfoId");

			if (Strategy == null && strategyInfoId != null)
			{
				StrategyInfo = ConfigManager
					.GetService<IStudioEntityRegistry>()
					.Strategies.ReadById(strategyInfoId);

				this.InitStrategy();
			}

			if (Strategy != null)
			{
				Strategy.Id = storage.GetValue<Guid>("StrategyContainerId");
				Strategy.Load(storage);
			}

			var marketDataSettings = storage.GetValue<string>("MarketDataSettings");
			if (marketDataSettings != null)
			{
				var id = marketDataSettings.To<Guid>();
				var settings = ConfigManager.GetService<MarketDataSettingsCache>().Settings.FirstOrDefault(s => s.Id == id);

				if (settings != null)
					MarketDataSettings = settings;
			}

			HistoryDaysCount = storage.GetValue("HistoryDaysCount", _defaultHistoryDaysCount);
		}
 private void MarketDataSettingsComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     SelectedSettings = (MarketDataSettings)SelectedItem;
 }
		private void MarketDataSettingsComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
		{
			SelectedSettings = (MarketDataSettings)SelectedItem;
		}
		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();
		}
		private void AddCommandExecuted(object sender, ExecutedRoutedEventArgs e)
		{
			var settings = new MarketDataSettings
			{
				UseLocal = true,
				//Path = Environment.CurrentDirectory
			};

			var settingsWnd = new StorageSettingsWindow
			{
				Settings = settings
			};

			if (!settingsWnd.ShowModal(this))
				return;

			var cache = ConfigManager.GetService<MarketDataSettingsCache>();

			cache.Settings.Add(settings);
			SelectedSettings = settings;
		}
Exemple #25
0
 private void SettingsChanged(MarketDataSettings settings)
 {
     SelectedItem = settings;
 }
Exemple #26
0
 public PathResolver(MarketDataSettings settings, string marketSymbol)
 {
     Settings = settings;
     MarketSymbol = marketSymbol;
     BaseDir = Path.GetDirectoryName(Path.GetDirectoryName(Directory.GetCurrentDirectory()));
 }
		private void SettingsChanged(MarketDataSettings settings)
		{
			SelectedItem = settings;
		}