예제 #1
0
        public FormSwitcher()
        {
            InitializeComponent();
            ledLeft.OldStyle = Program.settings.ColorVU;
            ledLeft.SetValue((float)0.1);
            ledRight.OldStyle = Program.settings.ColorVU;
            ledRight.SetValue((float)0.1);

            SetWindowTheme(listDevices.Handle, "explorer", null);

            using (var gr = CreateGraphics())
                DpiFactor = gr.DpiX / 96;
            var tile = new Size(listDevices.ClientSize.Width + 2, (int)(listDevices.TileSize.Height * DpiFactor));

            DeviceIcons.InitImageLists(DpiFactor);

            listDevices.TileSize       = tile;
            listDevices.Scroll        += VolBar.DoScroll;
            listDevices.LargeImageList = DeviceIcons.ActiveIcons;

            if (DpiFactor <= 1)
            {
                DefaultTrayIcons.Add(getIcon(Resources.mute));
                DefaultTrayIcons.Add(getIcon(Resources.zero));
                DefaultTrayIcons.Add(getIcon(Resources._1_33));
                DefaultTrayIcons.Add(getIcon(Resources._33_66));
                DefaultTrayIcons.Add(getIcon(Resources._66_100));
            }
            else
            {
                DefaultTrayIcons.Add(getIcon(Resources.mute_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources.zero_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._1_33_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._33_66_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._66_100_highDPI));
            }

            RenderType = Program.settings.DefaultDataFlow;
            RefreshDevices(RenderType);
            SetTrayIcons();

            VolBar.VolumeMuteChanged += IconChanged;
            VolBar.RegisterDevice(RenderType);
            EndPoints.NotifyClient.DefaultChanged += DefaultChanged;
            EndPoints.NotifyClient.DeviceAdded    += DeviceAdded;
            EndPoints.NotifyClient.DeviceRemoved  += DeviceRemoved;

            GlobalHotkeys.Handle = Handle;
            GlobalHotkeys.RegisterAll();

            ScrollVolume.VolumeScroll += ScrollTheVolume;
            ScrollVolume.RegisterVolScroll(Program.settings.VolumeScroll.Enabled);
        }
예제 #2
0
        public FormSwitcher()
        {
            InitializeComponent();

            IsWin10 = Environment.OSVersion.Version.Major == 10;
            if (IsWin10)
            {
                FormBorderStyle = FormBorderStyle.FixedToolWindow;
            }
            SetWindowTheme(listDevices.Handle, "explorer", null);

            ledLeft.OldStyle = Program.settings.ColorVU;
            ledLeft.SetValue((float)0.1);
            ledRight.OldStyle = Program.settings.ColorVU;
            ledRight.SetValue((float)0.1);

            DpiFactor = getScalingFactor();
            var tile = new Size(listDevices.ClientSize.Width + 2, (int)(listDevices.TileSize.Height * DpiFactor));

            DeviceIcons.InitImageLists(DpiFactor);

            listDevices.TileSize       = tile;
            listDevices.Scroll        += VolBar.DoScroll;
            ledLeft.DoScroll          += VolBar.DoScroll;
            ledRight.DoScroll         += VolBar.DoScroll;
            listDevices.LargeImageList = DeviceIcons.ActiveIcons;

            if (DpiFactor <= 1)
            {
                DefaultTrayIcons.Add(getIcon(Resources.mute));
                DefaultTrayIcons.Add(getIcon(Resources.zero));
                DefaultTrayIcons.Add(getIcon(Resources._1_33));
                DefaultTrayIcons.Add(getIcon(Resources._33_66));
                DefaultTrayIcons.Add(getIcon(Resources._66_100));
            }
            else
            {
                DefaultTrayIcons.Add(getIcon(Resources.mute_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources.zero_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._1_33_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._33_66_highDPI));
                DefaultTrayIcons.Add(getIcon(Resources._66_100_highDPI));
            }

            RenderType = Program.settings.DefaultDataFlow;
            RefreshDevices(RenderType);
            SetTrayIcons();

            VolBar.VolumeMuteChanged += IconChanged;
            VolBar.RegisterDevice(RenderType);

            EndPoints.NotifyClient.DefaultChanged += DefaultChanged;
            EndPoints.NotifyClient.DeviceAdded    += DeviceAdded;
            EndPoints.NotifyClient.DeviceRemoved  += DeviceRemoved;

            GlobalHotkeys.Handle = Handle;
            GlobalHotkeys.RegisterAll();

            ScrollVolume.VolumeScroll += ScrollTheVolume;
            ScrollVolume.RegisterVolScroll(Program.settings.VolumeScroll.Enabled);

            if (Program.settings.AlwaysVisible)
            {
                OpenAlwaysVisible();
            }
        }