Exemplo n.º 1
0
 public Nowplaying()
 {
     InitializeComponent();
     SongListBox.Children.Add(new NowplayingList());
     DataContext = MainViewModel.NowPlaying;
     // Слагаме максимума и минимума на плъзгача за времетраенето.
     MusicSlider.Maximum = !MediaViewModel.Player.NaturalDuration.HasTimeSpan ? 1d :
                           MediaViewModel.Player.NaturalDuration.TimeSpan.TotalSeconds;
     MusicSlider.Minimum = 0;
     // Свързваме NowPlaying с MediaViewModel.
     MediaViewModel.ConnectViewToViewModel(MusicSlider, VolumeSlider, SongTime);
 }
Exemplo n.º 2
0
        public void TestMethod_MediaViewModel()
        {
            var slider = MediaViewModel.SliderDragging;

            MediaViewModel.SliderDragging = true;

            MediaViewModel.ConnectViewToViewModel(new Slider(), new Slider(), new Label());
            MediaViewModel.Player_MediaFailed(null, null);
            MediaViewModel.SliderTimer_Tick(null, null);
            MediaViewModel.Player_MediaEnded(null, null);
            MediaViewModel.Player_MediaOpened(new MediaPlayer(), null);
            MediaViewModel.TimerPlay();
            MediaViewModel.Play();
            MediaViewModel.SetVolumeToPlayer();
            MediaViewModel.Stop();
            MediaViewModel.SaveVolume();
        }