private void listDevices_SelectedIndexChanged(object sender, EventArgs e) { if (listDevices.SelectedItems.Count == 0) { return; } var devSettings = Program.settings.Device.Find(x => x.DeviceID == (string)listDevices.SelectedItems[0].Tag); if (devSettings == null) { trackBrightness.Value = 0; trackHue.Value = 0; trackSaturation.Value = 0; pictureModded.Image = new Bitmap(Properties.Resources._66_100_highDPI); checkHideDevice.Checked = false; return; } trackBrightness.Value = devSettings.Brightness; trackHue.Value = devSettings.Hue; trackSaturation.Value = devSettings.Saturation; if (pictureModded.Image != null) { pictureModded.Image.Dispose(); } pictureModded.Image = DeviceIcons.ChangeColors(new Bitmap(Properties.Resources._66_100_highDPI), trackHue.Value, trackSaturation.Value / 100f, trackBrightness.Value / 100f); checkHideDevice.Checked = devSettings.HideFromList; }
private void SetTrayIcons() { Settings.CDevice devSettings = null; if (listDevices.SelectedItems.Count > 0) { devSettings = Program.settings.Device.Find(x => { var dev = listDevices.SelectedItems[0]; return(x.DeviceID == dev.Tag.ToString()); }); } if (devSettings == null || (devSettings.Hue == 0 && devSettings.Saturation == 0 && devSettings.Brightness == 0)) { ActiveTrayIcons = DefaultTrayIcons; return; } var newIcons = DefaultTrayIcons.Select(icon => DeviceIcons.ChangeColors(icon.ToBitmap(), devSettings.Hue, devSettings.Saturation / 100f, devSettings.Brightness / 100f)).Select(bmp => Icon.FromHandle(bmp.GetHicon())).ToList(); ActiveTrayIcons = newIcons; IconChanged(this, EventArgs.Empty); }
private void trackBarsHSB_Scroll(object sender, EventArgs e) { if (pictureModded.Image != null) { pictureModded.Image.Dispose(); } pictureModded.Image = DeviceIcons.ChangeColors(new Bitmap(Properties.Resources._66_100_highDPI), trackHue.Value, trackSaturation.Value / 100f, trackBrightness.Value / 100f); }
private void listDevices_SelectedIndexChanged_1(object sender, EventArgs e) { if (listDevices.SelectedItems.Count == 0) { return; } var devSettings = Program.settings.Device.Find(x => x.DeviceID == (string)listDevices.SelectedItems[0].Tag); if (devSettings == null) { trackBrightness.Value = 0; trackHue.Value = 0; trackSaturation.Value = 0; pictureModded.Image = new Bitmap(Properties.Resources._66_100_highDPI); checkHideDevice.Checked = false; checkCustomName.Checked = false; textCustomName.Enabled = false; textCustomName.Clear(); checkEnableAsMultimediaOnStartup.Checked = false; checkEnableAsCommunicationsOnStartup.Checked = false; return; } trackBrightness.Value = devSettings.Brightness; trackHue.Value = devSettings.Hue; trackSaturation.Value = devSettings.Saturation; pictureModded.Image?.Dispose(); pictureModded.Image = DeviceIcons.ChangeColors(new Bitmap(Properties.Resources._66_100_highDPI), trackHue.Value, trackSaturation.Value / 100f, trackBrightness.Value / 100f); checkHideDevice.Checked = devSettings.HideFromList; checkCustomName.Checked = devSettings.UseCustomName; textCustomName.Text = devSettings.CustomName; checkEnableAsMultimediaOnStartup.Checked = devSettings.DefaultMultimediaDevice; checkEnableAsCommunicationsOnStartup.Checked = devSettings.DefaultCommunicationsDevice; }
private void trackBarsHSB_Scroll() { pictureModded.Image?.Dispose(); pictureModded.Image = DeviceIcons.ChangeColors(new Bitmap(Properties.Resources._66_100_highDPI), trackHue.Value, trackSaturation.Value / 100f, trackBrightness.Value / 100f); }