Exemple #1
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 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 EditCommandExecuted(object sender, ExecutedRoutedEventArgs e)
		{
			var settings = SelectedSettings;

			var settingsWnd = new StorageSettingsWindow
			{
				Settings = settings
			};

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

			if (!settings.UseLocal)
			{
				var wnd = new MarketDataConfirmWindow
				{
					SecurityTypes = new[]
					{
						SecurityTypes.Currency,
						SecurityTypes.Index,
						SecurityTypes.Stock,
						SecurityTypes.Future
					}
				};

				if (wnd.ShowModal(this))
				{
					_isCancelled = false;
					BusyIndicator.IsBusy = true;

					var progress = BusyIndicator.FindVisualChild<ProgressBar>();
					var cancel = (Button)BusyIndicator.FindVisualChild<CancelButton>();

					var secTypes = wnd.SecurityTypes.ToArray();

					progress.Maximum = secTypes.Length;
					cancel.Click += (s1, e1) =>
					{
						_isCancelled = true;
						BusyIndicator.IsBusy = false;
					};

					new RefreshSecurities(settings, secTypes,
						() => _isCancelled,
						count => this.GuiAsync(() => progress.Value = count),
						count => this.GuiAsync(() =>
						{
							BusyIndicator.IsBusy = false;

							new MessageBoxBuilder()
								.Owner(this)
								.Text(LocalizedStrings.Str3264Params.Put(count))
								.Show();

							RefreshGrid();
						})).Process(this);
				}
			}

			ConfigManager.GetService<MarketDataSettingsCache>().Save();
		}
Exemple #4
0
        private void EditCommandExecuted(object sender, ExecutedRoutedEventArgs e)
        {
            var settings = SelectedSettings;

            var settingsWnd = new StorageSettingsWindow
            {
                Settings = settings
            };

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

            if (!settings.UseLocal)
            {
                var wnd = new MarketDataConfirmWindow
                {
                    SecurityTypes = new[]
                    {
                        SecurityTypes.Currency,
                        SecurityTypes.Index,
                        SecurityTypes.Stock,
                        SecurityTypes.Future
                    }
                };

                if (wnd.ShowModal(this))
                {
                    _isCancelled         = false;
                    BusyIndicator.IsBusy = true;

                    var progress = BusyIndicator.FindVisualChild <ProgressBar>();
                    var cancel   = (Button)BusyIndicator.FindVisualChild <CancelButton>();

                    var secTypes = wnd.SecurityTypes.ToArray();

                    progress.Maximum = secTypes.Length;
                    cancel.Click    += (s1, e1) =>
                    {
                        _isCancelled         = true;
                        BusyIndicator.IsBusy = false;
                    };

                    new RefreshSecurities(settings, secTypes,
                                          () => _isCancelled,
                                          count => this.GuiAsync(() => progress.Value = count),
                                          count => this.GuiAsync(() =>
                    {
                        BusyIndicator.IsBusy = false;

                        new MessageBoxBuilder()
                        .Owner(this)
                        .Text(LocalizedStrings.Str3264Params.Put(count))
                        .Show();

                        RefreshGrid();
                    })).Process(this);
                }
            }

            ConfigManager.GetService <MarketDataSettingsCache>().Save();
        }