예제 #1
0
		private void InitializeGuiEnvironment()
		{
			var dict = _availableTasks.Where(t => t.Type == TaskTypes.Source).GroupBy(t =>
			{
				var category = t.GetType().GetCategory(TaskCategories.Other);

				switch (category)
				{
					case TaskCategories.American:
						return TaskCategories.American;
					case TaskCategories.Russian:
						return TaskCategories.Russian;
					case TaskCategories.Forex:
						return TaskCategories.Forex;
					case TaskCategories.Crypto:
						return TaskCategories.Crypto;
					default:
						return TaskCategories.Other;
				}
			}).ToDictionary();

			InitTaskMenus(RussianSourcesMi, RussianSourcesCi, dict.TryGetValue(TaskCategories.Russian));
			InitTaskMenus(AmericanSourcesMi, AmericanSourcesCi, dict.TryGetValue(TaskCategories.American));
			InitTaskMenus(ForexSourcesMi, ForexSourcesCi, dict.TryGetValue(TaskCategories.Forex));
			InitTaskMenus(CryptoSourcesMi, CryptoSourcesCi, dict.TryGetValue(TaskCategories.Crypto));
			InitTaskMenus(OtherSourcesMi, OtherSourcesCi, dict.TryGetValue(TaskCategories.Other));

			if (CurrentSources.Items.Count > 0)
				CurrentSources.SelectedIndex = 0;

			InitTaskMenus(null, TasksMenu, _availableTasks.Where(t => t.Type != TaskTypes.Source));
			//TasksMenu.ItemsSource = _availableTasks.Where(t => t.Type != TaskTypes.Source);

			if (CurrentConverters.Items.Count > 0)
				CurrentConverters.SelectedIndex = 0;

			UserConfig.Instance.LoadLayout();

			_updateStatusTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) };
			_updateStatusTimer.Tick += OnUpdateUi;

			_trayIcon = new TrayIcon();
			_trayIcon.StartStop += () => StartStopClick(null, null);
			_trayIcon.Logs += () => ExecutedOpenLogCommand(null, null);
			_trayIcon.Show(this);

			MnuTargetPlatform.Visibility = Environment.Is64BitOperatingSystem ? Visibility.Visible : Visibility.Hidden;

			Mouse.OverrideCursor = null;
		}
예제 #2
0
		private void InitializeGuiEnvironment()
		{
			if (CurrentSources.Items.Count > 0)
				CurrentSources.SelectedIndex = 0;

			if (CurrentTools.Items.Count > 0)
				CurrentTools.SelectedIndex = 0;

			UserConfig.Instance.LoadLayout();

			_updateStatusTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(300) };
			_updateStatusTimer.Tick += OnUpdateUi;

			_trayIcon = new TrayIcon();
			_trayIcon.StartStop += () => StartStopClick(null, null);
			_trayIcon.Logs += () => ExecutedOpenLogCommand(null, null);
			_trayIcon.Show(this);

			MnuTargetPlatform.Visibility = Environment.Is64BitOperatingSystem ? Visibility.Visible : Visibility.Hidden;

			Mouse.OverrideCursor = null;
		}