Ejemplo n.º 1
0
        /* Public Control Methods*/
        //Music control

        //this function must be called every time settings are changed.
        public void updateSettings(bool updateDb)
        {
            this.Invoke((MethodInvoker) delegate()
            {
                if (Properties.Settings.Default.vpTs3)
                {
                    vm.subscribeApp(TS3_APPNAME);
                }
                else
                {
                    vm.unsubscribeApp(TS3_APPNAME);
                }
                if (Properties.Settings.Default.vpDiscord)
                {
                    vm.subscribeApp(DISCORD_APPNAME);
                }
                else
                {
                    vm.unsubscribeApp(DISCORD_APPNAME);
                }
                if (Properties.Settings.Default.vpSkype)
                {
                    vm.subscribeApp(SKYPE_APPNAME);
                }
                else
                {
                    vm.unsubscribeApp(SKYPE_APPNAME);
                }

                volumeTrackBar.Value = Properties.Settings.Default.volume;
                mp.setVolume(Properties.Settings.Default.volume);
                volumeLabel.Text = volumeTrackBar.Value / 10 + "%";

                if (Properties.Settings.Default.vpOn)
                {
                    vm.startListening();
                    cmdVp.Image = Properties.Resources.vp_on;
                }
                else
                {
                    vm.stopListening();
                    cmdVp.Image = Properties.Resources.vp_off;
                }

                if (Properties.Settings.Default.overlayOn)
                {
                    overlayForm.Hide();
                    overlayForm.showOverlay(Properties.Settings.Default.overlayClickable);
                }
                else
                {
                    overlayForm.Hide();
                }
                if (Properties.Settings.Default.songMatchOn)
                {
                    cmdSongMatchToggle.Image = Properties.Resources.songmatch_on;
                    matcherForm.updateTrackList(mp.LoadedPlaylist.TrackList);
                    matcherForm.startMatching();
                }
                else
                {
                    cmdSongMatchToggle.Image = Properties.Resources.songmatch_off;
                    matcherForm.stopMatching();
                }

                if (updateDb)
                {
                    dbListBox.Items.Clear();
                    List <Track> tracks = dbAdapter.getAllTracks();
                    dbPaths             = new string[tracks.Count];
                    int i = 0;
                    foreach (Track t in tracks)
                    {
                        dbPaths[i] = t.Path;
                        dbListBox.Items.Add(t.Name);
                        i++;
                    }
                }
            });
        }