Esempio n. 1
0
 private void volumeNotifyIcon_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         VolumeController.ToggleMute();
         UpdateIcon();
     }
 }
Esempio n. 2
0
        private Icon GetVolumeIcon()
        {
            if (VolumeController.IsMuted())
            {
                return(Properties.Resources.MuteIcon);
            }

            var vol = VolumeController.GetCurrentVolume();

            if (vol >= .90)
            {
                return(Properties.Resources.Level10Icon);
            }

            if (vol >= .80)
            {
                return(Properties.Resources.Level9Icon);
            }

            if (vol >= .70)
            {
                return(Properties.Resources.Level8Icon);
            }

            if (vol >= .60)
            {
                return(Properties.Resources.Level7Icon);
            }

            if (vol >= .50)
            {
                return(Properties.Resources.Level6Icon);
            }

            if (vol >= .40)
            {
                return(Properties.Resources.Level5Icon);
            }

            if (vol >= .30)
            {
                return(Properties.Resources.Level4Icon);
            }

            if (vol >= .20)
            {
                return(Properties.Resources.Level3Icon);
            }

            if (vol >= .10)
            {
                return(Properties.Resources.Level2Icon);
            }

            return(Properties.Resources.Level1Icon);
        }
Esempio n. 3
0
        private void Global_Hook_MouseWheel(object sender, MouseEventArgs e)
        {
            var iconLocation = NotifyIconInfo.GetNotifyIconLocation(volumeNotifyIcon);

            if (iconLocation.left <= Cursor.Position.X &&
                iconLocation.right >= Cursor.Position.Y &&
                iconLocation.top <= Cursor.Position.Y &&
                iconLocation.bottom >= Cursor.Position.Y)
            {
                if (e.Delta > 0)
                {
                    VolumeController.UpVolume();
                }
                else
                {
                    VolumeController.DownVolume();
                }

                UpdateIcon();
            }
        }