public Bitmap CreateSprectrum(SpectrumEntry playerCode, int width, int height) { _visualHelper.Width = width; _visualHelper.Height = height; return _visualHelper.CreateSpectrum(playerCode.ID.ParseEnum<Spectrums>()); }
public override void BuildCompled() { _events.GetEvent<PlayerViewVisibleChanged, bool>().Subscribe(PlayerVisibleChanged); _events.GetEvent<RadioPlayerPlay, EventArgs>().Subscribe(Play); _events.GetEvent<RadioPlayerStop, EventArgs>().Subscribe(Stop); _currentSpectrum = _specrumProvider.SpectrumEntries.FirstOrDefault(e => e.Name == _radioEnvironment.Settings.LastSprecturm) ?? _specrumProvider.SpectrumEntries.First(); _sprectrumTimer = new DispatcherTimer(TimeSpan.FromMilliseconds(50), DispatcherPriority.Normal, UpdateSprectrum, SystemDispatcher); _sprectrumTimer.Stop(); CurrentDispatcher.Invoke(() => { SprectrumPicture = new SprectrumPictureBox {BackColor = Color.Black}; SprectrumPicture.Click += SprectrumPictureOnClick; }); }
public SpectumChoiceBox(SpectrumEntry currentSpectrum, ISpecrumProvider provider) { _currentSpectrums = currentSpectrum; _choice = currentSpectrum; var icon = RadioStreamerResources.RadioIcon; _dialog = new TaskDialog { WindowIcon = icon, MainIcon = TaskDialogIcon.Information, WindowTitle = RadioStreamerResources.SpectrumChoiceWindowLabel, MainInstruction = RadioStreamerResources.SpectrumChoiceMainInstruction }; _okButton = new TaskDialogButton(ButtonType.Ok); _dialog.Buttons.Add(_okButton); _dialog.Buttons.Add(new TaskDialogButton(ButtonType.Close)); foreach (var name in provider.SpectrumEntries) { var btn = new TaskDialogRadioButton {Text = name.Name}; _dialog.RadioButtons.Add(btn); _spectrumMapping[btn] = name; if (currentSpectrum.ID == name.ID) btn.Checked = true; } _dialog.RadioButtonClicked += DialogOnRadioButtonClicked; }
private void DialogOnRadioButtonClicked([NotNull] object sender, [NotNull] TaskDialogItemClickedEventArgs taskDialogItemClickedEventArgs) { var btn = taskDialogItemClickedEventArgs.Item as TaskDialogRadioButton; if (btn == null) return; _choice = _spectrumMapping[btn]; }
private void SprectrumPictureOnClick([NotNull] object sender, [NotNull] EventArgs eventArgs) { _currentSpectrum = new SpectumChoiceBox(_currentSpectrum, _specrumProvider).Show( System.Windows.Application.Current.MainWindow); _radioEnvironment.Settings.LastSprecturm = _currentSpectrum.ToString(); }