Example #1
0
        public FormMain()
        {
            InitializeComponent();

            _mmd.DevicesChanged       = OnDevicesChanged;
            _mmd.DefaultDeviceChanged = OnDefaultDeviceChanged;

            if (Properties.Settings.Default.IsUpgradeNeeded)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.IsUpgradeNeeded = false;
                Properties.Settings.Default.Save();
            }

            Rectangle rThis = new Rectangle(Properties.Settings.Default.MainLocation, this.Size);

            if (SystemInformation.VirtualScreen.IntersectsWith(rThis))
            {
                this.StartPosition = FormStartPosition.Manual;
                this.Location      = Properties.Settings.Default.MainLocation;
            }

            TaskbarManagerHelper.Init(this.Handle);
            TaskbarManagerHelper.ButtonClicked = (index) => { m_DeviceListPlayback.SetActiveDevice(index); };

            m_DeviceListPlayback.RefreshDeviceList  = (status) => { EnumDevices(status); };
            m_DeviceListRecording.RefreshDeviceList = (status) => { EnumDevices(status); };

            m_DeviceListPlayback.UpdateStatus  = (status) => { UpdateUI(status); m_volumeControlSpk.UpdateUI(); };
            m_DeviceListRecording.UpdateStatus = (status) => { UpdateUI(status); m_volumeControlMic.UpdateUI(); };

            m_DeviceListPlayback.AlternateColorPalette  = AlternateColorPalette.Cold;
            m_DeviceListRecording.AlternateColorPalette = AlternateColorPalette.Warm;

            m_volumeControlSpk.OnVolumeChanged = (volume) => { UpdateUI(null); UpdatePopupVolume(); };
            m_volumeControlMic.OnVolumeChanged = (volume) => { UpdateUI(null); };

            m_DeviceListPlayback.OnSortChanged = (group) => { UpdateTaskbarButtons(group); };

            _popupVolumeInfoWindow = new PopupVolumeInfoHelper(
                Properties.Settings.Default.PopupLocation,
                (volume) => { m_volumeControlSpk.Volume = volume; });

            this.Text = TITLE;
        }