Пример #1
0
        public AudioSwitcher()
        {
            InitializeComponent();

            try
            {
                //try make it look pretty
                SetWindowTheme(listBoxPlayback.Handle, "Explorer", null);
                SetWindowTheme(listBoxRecording.Handle, "Explorer", null);
            }
            catch
            {
            }

            //Set up the config
            ConfigurationWriter.ConfigWriter.SetPath(
                Path.Combine(Directory.GetParent(Assembly.GetEntryAssembly().Location).FullName,
                             Resources.ConfigurationFile));

            lblVersion.Text   = "Version: " + AssemblyVersion;
            lblCopyright.Text = AssemblyCopyright;
            lblCompany.Text   = AssemblyCompany;

            LoadSettings();

            RefreshRecordingDevices();
            RefreshPlaybackDevices();

            HotKeyManager.HotKeyPressed   += HotKeyManager_HotKeyPressed;
            hotKeyBindingSource.DataSource = HotKeyManager.HotKeys;

            if (ConfigurationSettings.CheckForUpdatesOnStartup || ConfigurationSettings.PollForUpdates >= 1)
            {
                var t = new Thread(CheckForUpdates);
                t.Start();
            }

            try
            {
                AudioDevice dev = AudioDeviceManager.GetAudioDevice(ConfigurationSettings.StartupPlaybackDeviceID);

                if (dev != null)
                {
                    dev.SetAsDefaultDevice();
                }

                dev = AudioDeviceManager.GetAudioDevice(ConfigurationSettings.StartupRecordingDeviceID);

                if (dev != null)
                {
                    dev.SetAsDefaultDevice();
                }
            }
            catch
            {
            }

            MinimizeFootprint();
        }