Esempio n. 1
0
        private void Mute_Click(object sender, RoutedEventArgs e)
        {
            int muteStatus = muted ? 1 : 0;

            MM.SetVolume(spkrMuteControl, spkrComponent, muteStatus);
            muted = !muted;
        }
Esempio n. 2
0
        public MainWindow()
        {
            InitializeComponent();

            myControl.MediaPlayer.VlcLibDirectoryNeeded += OnVlcControlNeedsLibDirectory;
            myControl.MediaPlayer.EndInit();
            //cancellationtoken for the add methods running from a separate thread
            ct = cts.Token;
            //unmute, incase it's muted on startup
            int muteStatus = 0;

            MM.SetVolume(spkrMuteControl, spkrComponent, muteStatus);
            //set volume
            uint CurrVol = 0;

            // At this point, CurrVol gets assigned the volume
            waveOutGetVolume(IntPtr.Zero, out CurrVol);
            // Calculate the volume
            ushort CalcVol = (ushort)(CurrVol & 0x0000ffff);

            // Get the volume on a scale of 1 to 10 (to fit the trackbar)
            trackWave.Value = CalcVol / (ushort.MaxValue / 10);
            //load DB.  The first time is to replace a Load() method that I don't have.  The secon time is because if you don't it will add the first song to the top of the list
            ViewSource               = new CollectionViewSource();
            ViewSource2              = new CollectionViewSource();
            ViewSource.Source        = DBContext.AALists.ToList();
            ViewSource2.Source       = DBContext.AAPLists.ToList();
            ViewSource.Source        = DBContext.AALists.Local;
            ViewSource2.Source       = DBContext.AAPLists.Local;
            fulllistgrid.ItemsSource = ViewSource.View;
            playlistgrid.ItemsSource = ViewSource2.View;
            //just shortcuts
            AALists  = DBContext.AALists.Local;
            AAPLists = DBContext.AAPLists.Local;
            //add timechanged event to bind progress
            myControl.MediaPlayer.TimeChanged += TestOnTimeChanged;
            //add media changed event
            myControl.MediaPlayer.MediaChanged += MediaChanged;
            //media finished event
            myControl.MediaPlayer.EndReached += TrackDone;
            ViewSource2.SortDescriptions.Add(new SortDescription("order", ListSortDirection.Ascending));
            ViewSource2.View.Refresh();
            ViewSource.Filter  += new FilterEventHandler(SearchFilter);
            ViewSource2.Filter += new FilterEventHandler(SearchFilter2);
        }