Winleafs crashes when trying to add a process event
Closed this issue · 3 comments
Describe the bug
When trying to add a process event, I can get to the popup window that requests the process name and effect, but trying to confirm causes the program to crash. I have tried with a couple different processes.
To Reproduce
- Go to Add Schedule
- Click on the plus sign in the Events column
- Fill out popup window and click Add
Logs
System.InvalidOperationException: Sequence contains no elements
at System.Linq.ThrowHelper.ThrowNoElementsException()
at System.Linq.Enumerable.Max[TSource](IEnumerable1 source, Func
2 selector)
at Winleafs.Wpf.Views.Scheduling.EventUserControl.ProcessEventTriggerAdded(String processName, String effectName, Int32 brightness) in C:\Users\easy_\source\repos\winleafs\Winleafs\Winleafs.Wpf\Views\Scheduling\EventUserControl.xaml.cs:line 56
at Winleafs.Wpf.Views.Scheduling.AddProcessEventWindow.Add_Click(Object sender, RoutedEventArgs e) in C:\Users\easy_\source\repos\winleafs\Winleafs\Winleafs.Wpf\Views\Scheduling\AddProcessEventWindow.xaml.cs:line 45
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(Object sender, MouseButtonEventArgs e)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.ReRaiseEventAs(DependencyObject sender, RoutedEventArgs args, RoutedEvent newEvent)
at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler) System.Object:
Additional context
The end goal is to make Winleafs start the screen mirror ambilight automatically when I boot my computer up and turn off when I shut down. I have the program set to startup with Windows, but I have to manually select the effect and readjust brightness each time and then manually turn off before shutting down, or else the panels retain their last known colors seemingly indefinitely or until I click the power button.
Hey, thanks for the report! With the logs, the bug should be easy to fix, I will look at it tomorrow. If your goal is to automatically start screen mirror, you could also create a schedule that only has 1 time trigger, for example on monday at 1:00. That way, that effect will always be enabled.
Fixed in 1be0f58
See https://github.com/winleafs/Winleafs/releases/tag/v1.1.2 for the installer with the fix included