Skip to content

Commit 510d73c

Browse files
Update WinForms to remove ControlObservable (#3964)
<!-- Please be sure to read the [Contribute](https://github.com/reactiveui/reactiveui#contribute) section of the README --> **What kind of change does this PR introduce?** <!-- Bug fix, feature, docs update, ... --> Fix for #3885 **What is the current behavior?** <!-- You can also link to an open issue here. --> #3885 **What is the new behavior?** <!-- If this is a feature change --> This Removes ObserveOn and SubscribeOn extensions that are included with System.Reactive 6.0.1 **What might this PR break?** None expected **Please check if the PR fulfills these requirements** - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been added / updated (for bug fixes / features) **Other information**: Co-authored-by: Glenn <[email protected]>
1 parent 65c76a9 commit 510d73c

13 files changed

+9
-28
lines changed

src/ReactiveUI.Tests/Platforms/winforms/Mocks/FakeWinformViewModel.cs

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6+
using System.Windows.Forms;
7+
68
namespace ReactiveUI.Tests.Winforms;
79

810
/// <summary>

src/ReactiveUI.Winforms/ActivationForViewFetcher.cs

+3-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
using System.Globalization;
77
using System.Reflection;
8-
using System.Windows.Forms;
98

109
namespace ReactiveUI.Winforms;
1110

@@ -87,17 +86,13 @@ public IObservable<bool> GetActivationForView(IActivatableView view)
8786
return Observable<bool>.Empty;
8887
}
8988

90-
private static bool GetIsDesignMode(Control control)
91-
{
92-
var isDesignMode = LicenseManager.UsageMode == LicenseUsageMode.Designtime || control.Site?.DesignMode == true || control.Parent?.Site?.DesignMode == true;
93-
94-
return isDesignMode;
95-
}
89+
private static bool GetIsDesignMode(Control control) =>
90+
LicenseManager.UsageMode == LicenseUsageMode.Designtime || control.Site?.DesignMode == true || control.Parent?.Site?.DesignMode == true;
9691

9792
private bool GetCachedIsDesignMode(Control control)
9893
{
9994
_isDesignModeCache ??= GetIsDesignMode(control);
10095

10196
return _isDesignModeCache.Value;
10297
}
103-
}
98+
}

src/ReactiveUI.Winforms/ContentControlBindingHook.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>
@@ -37,4 +35,4 @@ public bool ExecuteHook(object? source, object target, Func<IObservedChange<obje
3735

3836
return true;
3937
}
40-
}
38+
}

src/ReactiveUI.Winforms/CreatesWinformsCommandBinding.cs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
// See the LICENSE file in the project root for full license information.
55

66
using System.Reflection;
7-
using System.Windows.Forms;
87
using System.Windows.Input;
98

109
namespace ReactiveUI.Winforms;

src/ReactiveUI.Winforms/GlobalUsings.cs

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@
1212
global using System.Reactive.Disposables;
1313
global using System.Reactive.Linq;
1414
global using System.Threading;
15+
global using System.Windows.Forms;
1516
global using Splat;

src/ReactiveUI.Winforms/PanelSetMethodBindingConverter.cs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>

src/ReactiveUI.Winforms/ReactiveUI.Winforms.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</ItemGroup>
2121

2222
<ItemGroup>
23-
<Compile Include="..\ReactiveUI.Wpf\Rx\**\*.cs" LinkBase="Rx" Exclude="..\ReactiveUI.Wpf\Rx\**\Dispatcher*.cs;..\ReactiveUI.Wpf\Rx\Internal\*.cs;..\ReactiveUI.Wpf\Rx\Concurrency\*.cs" />
23+
<Compile Include="..\ReactiveUI.Wpf\Rx\**\*.cs" LinkBase="Rx" Exclude="..\ReactiveUI.Wpf\Rx\**\Dispatcher*.cs;..\ReactiveUI.Wpf\Rx\Internal\*.cs;..\ReactiveUI.Wpf\Rx\Concurrency\*.cs;..\ReactiveUI.Wpf\Rx\Linq\ControlObservable.cs" />
2424
</ItemGroup>
2525

2626
<ItemGroup Condition="$(TargetFramework) == 'net462' or $(TargetFramework.EndsWith('-windows10.0.17763.0'))">

src/ReactiveUI.Winforms/ReactiveUserControl.cs

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>
@@ -49,4 +47,4 @@ protected override void Dispose(bool disposing)
4947

5048
base.Dispose(disposing);
5149
}
52-
}
50+
}

src/ReactiveUI.Winforms/ReactiveUserControlNonGeneric.cs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>

src/ReactiveUI.Winforms/Registrations.cs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>

src/ReactiveUI.Winforms/RoutedViewHost.cs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>

src/ReactiveUI.Winforms/TableContentSetMethodBindingConverter.cs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>

src/ReactiveUI.Winforms/ViewModelViewHost.cs

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
// The .NET Foundation licenses this file to you under the MIT license.
44
// See the LICENSE file in the project root for full license information.
55

6-
using System.Windows.Forms;
7-
86
namespace ReactiveUI.Winforms;
97

108
/// <summary>

0 commit comments

Comments
 (0)