Skip to content

Commit

Permalink
remove line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nik9play committed Apr 24, 2022
1 parent 16ede72 commit 50fe1ee
Showing 1 changed file with 33 additions and 38 deletions.
71 changes: 33 additions & 38 deletions fos/Managers/TrayIconManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,58 +70,53 @@ public static void InitTrayIcon()

private static void OnMouseWheel(object sender, MouseEventArgs args)
{
var trayIconRectangle = GetRectangle();

if (trayIconRectangle.HasValue &&
args.Position.X > trayIconRectangle?.X &&
args.Position.X < trayIconRectangle.Value.X + trayIconRectangle.Value.Width &&
args.Position.Y > trayIconRectangle.Value.Y &&
args.Position.Y < trayIconRectangle.Value.Y + trayIconRectangle.Value.Height)
Application.Current.Dispatcher.Invoke(delegate
{
var multiplier = args.Delta > 0 ? 1 : -1;
var offset = multiplier * (int)SettingsController.Store.HotkeyStep;

var trayIconRectangle = GetRectangle();

if (trayIconRectangle.HasValue &&
args.Position.X > trayIconRectangle?.X &&
args.Position.X < trayIconRectangle.Value.X + trayIconRectangle.Value.Width &&
args.Position.Y > trayIconRectangle.Value.Y &&
args.Position.Y < trayIconRectangle.Value.Y + trayIconRectangle.Value.Height)
Application.Current.Dispatcher.Invoke(delegate
try
{
var multiplier = args.Delta > 0 ? 1 : -1;
var offset = multiplier * (int)SettingsController.Store.HotkeyStep;
if (SettingsController.Store.AllMonitorsModeEnabled)
{
var newBrightness = MainWindowViewModel.AllMonitorsBrightness + offset;

if (newBrightness < 0)
newBrightness = 0;

if (newBrightness > 100)
newBrightness = 100;

try
MainWindowViewModel.AllMonitorsBrightness = (uint)newBrightness;
}
else
{
if (SettingsController.Store.AllMonitorsModeEnabled)
foreach (var el in MainWindowViewModel.Monitors)
{
var newBrightness = MainWindowViewModel.AllMonitorsBrightness + offset;
var newBrightness = el.Brightness + offset;

if (newBrightness < 0)
newBrightness = 0;

if (newBrightness > 100)
newBrightness = 100;

MainWindowViewModel.AllMonitorsBrightness = (uint)newBrightness;
}
else
{

foreach (var el in MainWindowViewModel.Monitors)
{
var newBrightness = el.Brightness + offset;

if (newBrightness < 0)
newBrightness = 0;

if (newBrightness > 100)
newBrightness = 100;

el.SetBrightnessSlow((uint)newBrightness);
}

el.SetBrightnessSlow((uint)newBrightness);
}
}
catch
{
// ignored
}
});


}
catch
{
// ignored
}
});
}

public static Rect? GetRectangle()
Expand Down

0 comments on commit 50fe1ee

Please sign in to comment.