Open LTa2022 opened 10 months ago
Thanks, this is related to #196 and something I'm actively working on.
Basically source generators were upgraded to allow the IDE to take advantage of parallelism and registrations of interested items and stuff etc. I just need to change to take advantage of it.
Thanks a lot! Sticking to some manual FromEventPattern for now,
public static class UserControlEventsHelpers
{
public static IObservable<EventPattern<TArgs>> OnEvent<T, TArgs>(
this T btn,
string nameofevent)
{
return Observable.FromEventPattern<TArgs>(btn, nameofevent);
}
public static IObservable<MouseButtonEventArgs> OnClickEx(this ButtonBase btn)
{
return btn.OnEvent<ButtonBase, MouseButtonEventArgs>(nameof(ButtonBase.Click)).Select(x=>x.EventArgs);
}
public static IObservable<RoutedEventArgs> OnCheckedEx(this CheckBox control)
{
return control.OnEvent<CheckBox, RoutedEventArgs>(nameof(CheckBox.CheckedEvent)).Select(x => x.EventArgs);
}
public static IObservable<RoutedEventArgs> OnCheckedEx(this ToggleButton control)
{
return control.OnEvent<ToggleButton, RoutedEventArgs>(nameof(ToggleButton.CheckedEvent)).Select(x => x.EventArgs);
}
public static IObservable<RoutedEventArgs> OnUncheckedEx(this CheckBox control)
{
return control.OnEvent<CheckBox, RoutedEventArgs>(nameof(CheckBox.Unchecked)).Select(x => x.EventArgs);
}
public static IObservable<RoutedEventArgs> OnUncheckedEx(this ToggleButton control)
{
return control.OnEvent<ToggleButton, RoutedEventArgs>(nameof(ToggleButton.Unchecked)).Select(x => x.EventArgs);
}
public static IObservable<DragEventArgs> OnDropEx(this UIElement control)
{
return control.OnEvent<UIElement, DragEventArgs>(nameof(UIElement.DropEvent)).Select(x => x.EventArgs);
}
}
Hi, I create a fresh project, add referenes to ReactiveUI.WPF, System.Reactive, Fody and ReactiveMarbles.ObservableEvents.SourceGenerator. Then I create a new ViewModel and View. I add this.WhenActivated(d => and fill it up with 50x empty btnTest.Events().Click.Do((a) => {
I create a new class in an own namespace, with ctor, and a var asdf = ""; When I now rightlick > rename the variable and confirm, the refactoring times is multiplied by the Events() in all my Views. (takes around 20 sec in this example), same for the ctrl+. menu for finding namespaces, exporting methods, craeting events from xaml, I am basically already used to work without these features, took me half a year to troubleshoot my projects.. : )
Is there anythnig I can do about it ?
I am all up to date, PC is last year gaming top.
Thanks!