diff --git a/4eac0733-0a64-4c41-a024-157e17e6276c.cake b/4eac0733-0a64-4c41-a024-157e17e6276c.cake new file mode 100644 index 0000000000..944cbe2555 --- /dev/null +++ b/4eac0733-0a64-4c41-a024-157e17e6276c.cake @@ -0,0 +1,2 @@ +#module nuget:?package=Cake.DotNetTool.Module&version=0.2.0 +#tool dotnet:?package=nbgv&version=2.3.125 diff --git a/samples/stylecop.json b/samples/stylecop.json deleted file mode 100644 index 354a60c6e4..0000000000 --- a/samples/stylecop.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", - "settings": { - "documentationRules": { - "companyName": ".NET Foundation", - "documentationCulture": "en-US", - "documentInterfaces": true, - "documentInternalElements": false, - "copyrightText": "Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for more information.", - "xmlHeader": true - }, - "orderingRules": { - "elementOrder": [ - "kind", - "constant", - "accessibility", - "static", - "readonly" - ], - "systemUsingDirectivesFirst": true, - "usingDirectivesPlacement": "outsideNameSpace" - }, - "maintainabilityRules": { - "topLevelTypes": ["class"] - } - } -} \ No newline at end of file diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/ReactiveUI.Samples.Testing.SimpleViewModels.sln b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/ReactiveUI.Samples.Testing.SimpleViewModels.sln deleted file mode 100644 index eaec104c26..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/ReactiveUI.Samples.Testing.SimpleViewModels.sln +++ /dev/null @@ -1,51 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Samples.Testing.SimpleViewModels", "src\ReactiveUI.Samples.Testing.SimpleViewModels\ReactiveUI.Samples.Testing.SimpleViewModels.csproj", "{3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests", "src\ReactiveUI.Samples.Testing.SimpleViewModels.Tests\ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests.csproj", "{CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Debug|x64.ActiveCfg = Debug|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Debug|x64.Build.0 = Debug|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Debug|x86.ActiveCfg = Debug|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Debug|x86.Build.0 = Debug|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Release|Any CPU.Build.0 = Release|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Release|x64.ActiveCfg = Release|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Release|x64.Build.0 = Release|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Release|x86.ActiveCfg = Release|Any CPU - {3BD3E9A3-BDF2-4F8F-A635-76B125CCCD9B}.Release|x86.Build.0 = Release|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Debug|x64.ActiveCfg = Debug|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Debug|x64.Build.0 = Debug|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Debug|x86.ActiveCfg = Debug|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Debug|x86.Build.0 = Debug|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Release|Any CPU.Build.0 = Release|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Release|x64.ActiveCfg = Release|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Release|x64.Build.0 = Release|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Release|x86.ActiveCfg = Release|Any CPU - {CECE0F04-2D7F-476E-8D0D-8EBC9FEAF598}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A01B622A-B041-46C4-8B61-76F2D9F62477} - EndGlobalSection -EndGlobal diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/CalculatorViewModelTest.cs b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/CalculatorViewModelTest.cs deleted file mode 100644 index ee83d73fbc..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/CalculatorViewModelTest.cs +++ /dev/null @@ -1,31 +0,0 @@ -using ReactiveUI.Samples.Testing.SimpleViewModels; -using Xunit; - -namespace ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests -{ - /// - /// A few sample unit tests. Note how simple they are: since the concept of time - /// is not involved we do not have to model it in our unit tests. We test these almost - /// as if they were a non ReactiveUI object. - /// - public class CalculatorViewModelTest - { - [Fact] - public void TestTypingStringGetsError() - { - var fixture = new CalculatorViewModel(); - fixture.InputText = "hi"; - Assert.Equal("Error", fixture.ErrorText); - Assert.Equal("", fixture.ResultText); - } - - [Fact] - public void TestTypingInteger() - { - var fixture = new CalculatorViewModel(); - fixture.InputText = "50"; - Assert.Equal("", fixture.ErrorText); - Assert.Equal("100", fixture.ResultText); - } - } -} diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests.csproj b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests.csproj deleted file mode 100644 index c5ffddf033..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests.csproj +++ /dev/null @@ -1,13 +0,0 @@ - - - netcoreapp2.2;net461 - - - - - - - - - - \ No newline at end of file diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/WebCallViewModelTest.cs b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/WebCallViewModelTest.cs deleted file mode 100644 index f34d1580ec..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/WebCallViewModelTest.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Microsoft.Reactive.Testing; -using ReactiveUI.Samples.Testing.SimpleViewModels; -using ReactiveUI.Testing; -using System.Reactive.Linq; -using Xunit; - -namespace ReactiveUI.Samples.Testing.SimpleViewModelsUnitTests -{ - /// - /// The web call ViewModel is time dependent. There is the webservice time and there - /// is the time that one waits for the user to stop typing. We could wait 800 ms, and test - /// that way. Or we can time travel with some nifty tools from the System.Reactive.Testing - /// namespace. - /// - public class WebCallViewModelTest - { - /// - /// Make sure no webservice call is send off until 800 ms have passed. - /// - [Fact] - public void TestNothingTill800ms() - { - // Run a test scheduler to put time under our control. - new TestScheduler().With(s => - { - var fixture = new WebCallViewModel(new immediateWebService()); - fixture.InputText = "hi"; - - // Run the clock forward to 800 ms. At that point, nothing should have happened. - s.AdvanceToMs(799); - Assert.Equal("", fixture.ResultText); - - // Run the clock 1 tick past and the result should show up. - s.AdvanceToMs(801); - Assert.Equal("result hi", fixture.ResultText); - }); - } - - /// - /// User types something, pauses, then types something again. - /// - [Fact] - public void TestDelayAfterUpdate() - { - // Run a test scheduler to put time under our control. - new TestScheduler().With(s => - { - var fixture = new WebCallViewModel(new immediateWebService()); - fixture.InputText = "hi"; - - // Run the clock forward 300 ms, where they type again. - s.AdvanceToMs(300); - fixture.InputText = "there"; - - // Now, at 800, there should be nothing! - s.AdvanceToMs(799); - Assert.Equal("", fixture.ResultText); - - // But, at 800+300+1, our result should appear! - s.AdvanceToMs(800 + 300 + 1); - Assert.Equal("result there", fixture.ResultText); - }); - } - - /// - /// This dummy webservice takes zero time so we can isolate the timing tests for - /// the typing above. - /// - class immediateWebService : IWebCaller - { - public System.IObservable GetResult(string searchItems) - { - return Observable.Return("result " + searchItems); - } - } - - } -} diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/app.config b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/app.config deleted file mode 100644 index b079014c10..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels.Tests/app.config +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/CalculatorViewModel.cs b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/CalculatorViewModel.cs deleted file mode 100644 index 620851b011..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/CalculatorViewModel.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.Reactive.Linq; - -namespace ReactiveUI.Samples.Testing.SimpleViewModels -{ - /// - /// A view model with some straight forward calculations. There are no - /// async operations involve, nor are there any delays or other time related - /// calls. - /// Operation: The user enters text into the input text field. - /// If the text doesn't contain numbers, then an error message is shown in the ErrorText field - /// Otherwise the number x2 is shown in the ResultText field. - /// The ErrorText and ResultText fields should be empty when nothing is in InputText. - /// - public class CalculatorViewModel : ReactiveObject - { - private readonly ObservableAsPropertyHelper _ErrorText; - private readonly ObservableAsPropertyHelper _ResultText; - - public string InputText - { - get => _InputText; - set => this.RaiseAndSetIfChanged(ref _InputText, value); - } - string _InputText; - - public string ErrorText => _ErrorText.Value; - - public string ResultText => _ResultText.Value; - - public CalculatorViewModel() - { - var haveInput = this.WhenAny(x => x.InputText, x => x.Value) - .Where(x => !string.IsNullOrEmpty(x)); - - // Convert into a stream of parsed integers, or null if we fail. - var parsedIntegers = haveInput - .Select(x => int.TryParse(x, out var val) ? (int?)val : null); - - // Now, the error text - parsedIntegers - .Select(x => x.HasValue ? "" : "Error") - .ToProperty(this, x => x.ErrorText, out _ErrorText); - - // And the result, which is *2 of the input. - parsedIntegers - .Select(x => x.HasValue ? (x.Value * 2).ToString() : "") - .ToProperty(this, x => x.ResultText, out _ResultText); - } - } -} diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/IWebCaller.cs b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/IWebCaller.cs deleted file mode 100644 index 2c0da619e5..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/IWebCaller.cs +++ /dev/null @@ -1,15 +0,0 @@ - -using System; -namespace ReactiveUI.Samples.Testing.SimpleViewModels -{ - public interface IWebCaller - { - /// - /// Return the web service call string result given the input. - /// Can take an indeterminate amount of time. - /// - /// - /// - IObservable GetResult(string searchItems); - } -} diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/ReactiveUI.Samples.Testing.SimpleViewModels.csproj b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/ReactiveUI.Samples.Testing.SimpleViewModels.csproj deleted file mode 100644 index 1a2ab07063..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/ReactiveUI.Samples.Testing.SimpleViewModels.csproj +++ /dev/null @@ -1,8 +0,0 @@ - - - netstandard2.0 - - - - - \ No newline at end of file diff --git a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/WebCallViewModel.cs b/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/WebCallViewModel.cs deleted file mode 100644 index a87874867a..0000000000 --- a/samples/testing/ReactiveUI.Samples.Testing.SimpleViewModels/src/ReactiveUI.Samples.Testing.SimpleViewModels/WebCallViewModel.cs +++ /dev/null @@ -1,52 +0,0 @@ - -using System; -using System.Reactive; -using System.Reactive.Linq; - -namespace ReactiveUI.Samples.Testing.SimpleViewModels -{ - /// - /// A class that simulates a call to a web service, which is expected to - /// take some time. We also do some work so that we don't flood the - /// web service each time the user updates the input. - /// - public class WebCallViewModel : ReactiveObject - { - private readonly ObservableAsPropertyHelper _ResultTextOAPH; - private string _InputText; - - public string InputText - { - get => _InputText; - set => this.RaiseAndSetIfChanged(ref _InputText, value); - } - - public string ResultText => _ResultTextOAPH.Value; - - public ReactiveCommand DoWebCall { get; } - - /// - /// Setup the lookup logic, and use the interface to do the web call. - /// - /// - public WebCallViewModel(IWebCaller caller) - { - // Do a search when nothing new has been entered for 800 ms and it isn't - // an empty string... and don't search for the same thing twice. - - var newSearchNeeded = this.WhenAny(p => p.InputText, x => x.Value) - .Throttle(TimeSpan.FromMilliseconds(800), RxApp.TaskpoolScheduler) - .DistinctUntilChanged() - .Where(x => !string.IsNullOrWhiteSpace(x)); - - DoWebCall = ReactiveCommand.CreateFromObservable(x => caller.GetResult(x)); - - newSearchNeeded.InvokeCommand(DoWebCall); - - // The results are stuffed into the property, on the proper thread - // (ToProperty takes care of that) when done. We never want the property to - // be null, so we give it an initial value of "". - DoWebCall.ToProperty(this, x => x.ResultText, out _ResultTextOAPH, ""); - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo.sln b/samples/winforms/getting-started/ReactiveDemo.sln deleted file mode 100644 index 7af377a105..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo.sln +++ /dev/null @@ -1,43 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28010.2003 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUIDemo", "ReactiveDemo\ReactiveUIDemo.csproj", "{6E814355-0A7D-4CAA-BA94-06A451E9EC68}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI", "..\..\..\src\ReactiveUI\ReactiveUI.csproj", "{EA20B8E2-5B2D-4ABA-AA3B-5912DAD9759C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Wpf", "..\..\..\src\ReactiveUI.Wpf\ReactiveUI.Wpf.csproj", "{993CB02D-666A-4304-9BE3-CF6D1A0C8136}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUI.Winforms", "..\..\..\src\ReactiveUI.Winforms\ReactiveUI.Winforms.csproj", "{EA9A51E7-4854-4593-A272-10D4824FD2A7}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {6E814355-0A7D-4CAA-BA94-06A451E9EC68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6E814355-0A7D-4CAA-BA94-06A451E9EC68}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6E814355-0A7D-4CAA-BA94-06A451E9EC68}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6E814355-0A7D-4CAA-BA94-06A451E9EC68}.Release|Any CPU.Build.0 = Release|Any CPU - {EA20B8E2-5B2D-4ABA-AA3B-5912DAD9759C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EA20B8E2-5B2D-4ABA-AA3B-5912DAD9759C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EA20B8E2-5B2D-4ABA-AA3B-5912DAD9759C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EA20B8E2-5B2D-4ABA-AA3B-5912DAD9759C}.Release|Any CPU.Build.0 = Release|Any CPU - {993CB02D-666A-4304-9BE3-CF6D1A0C8136}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {993CB02D-666A-4304-9BE3-CF6D1A0C8136}.Debug|Any CPU.Build.0 = Debug|Any CPU - {993CB02D-666A-4304-9BE3-CF6D1A0C8136}.Release|Any CPU.ActiveCfg = Release|Any CPU - {993CB02D-666A-4304-9BE3-CF6D1A0C8136}.Release|Any CPU.Build.0 = Release|Any CPU - {EA9A51E7-4854-4593-A272-10D4824FD2A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EA9A51E7-4854-4593-A272-10D4824FD2A7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EA9A51E7-4854-4593-A272-10D4824FD2A7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EA9A51E7-4854-4593-A272-10D4824FD2A7}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {D4A4A79B-20F4-41EC-BADF-141BA15D261F} - EndGlobalSection -EndGlobal diff --git a/samples/winforms/getting-started/ReactiveDemo/App.config b/samples/winforms/getting-started/ReactiveDemo/App.config deleted file mode 100644 index ecdcf8a54d..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/samples/winforms/getting-started/ReactiveDemo/AppViewModel.cs b/samples/winforms/getting-started/ReactiveDemo/AppViewModel.cs deleted file mode 100644 index b945b0eb4b..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/AppViewModel.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reactive.Linq; -using System.Threading; -using System.Threading.Tasks; -using NuGet.Configuration; -using NuGet.Protocol; -using NuGet.Protocol.Core.Types; -using ReactiveUI; - -namespace ReactiveDemo -{ - // AppViewModel is where we will describe the interaction of our application. - // We can describe the entire application in one class since it's very small now. - // Most ViewModels will derive off ReactiveObject, while most Model classes will - // most derive off INotifyPropertyChanged - public class AppViewModel : ReactiveObject - { - // In ReactiveUI, this is the syntax to declare a read-write property - // that will notify Observers, as well as WPF, that a property has - // changed. If we declared this as a normal property, we couldn't tell - // when it has changed! - private string _searchTerm; - public string SearchTerm - { - get => _searchTerm; - set => this.RaiseAndSetIfChanged(ref _searchTerm, value); - } - - // Here's the interesting part: In ReactiveUI, we can take IObservables - // and "pipe" them to a Property - whenever the Observable yields a new - // value, we will notify ReactiveObject that the property has changed. - // - // To do this, we have a class called ObservableAsPropertyHelper - this - // class subscribes to an Observable and stores a copy of the latest value. - // It also runs an action whenever the property changes, usually calling - // ReactiveObject's RaisePropertyChanged. - private readonly ObservableAsPropertyHelper> _searchResults; - public IEnumerable SearchResults => _searchResults.Value; - - // Here, we want to create a property to represent when the application - // is performing a search (i.e. when to show the "spinner" control that - // lets the user know that the app is busy). We also declare this property - // to be the result of an Observable (i.e. its value is derived from - // some other property) - private readonly ObservableAsPropertyHelper _isAvailable; - public bool IsAvailable => _isAvailable.Value; - - public AppViewModel() - { - // Creating our UI declaratively - // - // The Properties in this ViewModel are related to each other in different - // ways - with other frameworks, it is difficult to describe each relation - // succinctly; the code to implement "The UI spinner spins while the search - // is live" usually ends up spread out over several event handlers. - // - // However, with ReactiveUI, we can describe how properties are related in a - // very organized clear way. Let's describe the workflow of what the user does - // in this application, in the order they do it. - - // We're going to take a Property and turn it into an Observable here - this - // Observable will yield a value every time the Search term changes, which in - // the XAML, is connected to the TextBox. - // - // We're going to use the Throttle operator to ignore changes that happen too - // quickly, since we don't want to issue a search for each key pressed! We - // then pull the Value of the change, then filter out changes that are identical, - // as well as strings that are empty. - // - // We then do a SelectMany() which starts the task by converting Task> - // into IObservable>. If subsequent requests are made, the - // CancellationToken is called. We then ObservableOn the main thread, - // everything up until this point has been running on a separate thread due - // to the Throttle(). - // - // We then use a ObservableAsPropertyHelper and the ToProperty() method to allow - // us to have the latest results that we can expose through the property to the View. - _searchResults = this - .WhenAnyValue(x => x.SearchTerm) - .Throttle(TimeSpan.FromMilliseconds(800)) - .Select(term => term?.Trim()) - .DistinctUntilChanged() - .Where(term => !string.IsNullOrWhiteSpace(term)) - .SelectMany(SearchNuGetPackages) - .ObserveOn(RxApp.MainThreadScheduler) - .ToProperty(this, x => x.SearchResults); - - // We subscribe to the "ThrownExceptions" property of our OAPH, where ReactiveUI - // marshals any exceptions that are thrown in SearchNuGetPackages method. - // See the "Error Handling" section for more information about this. - _searchResults.ThrownExceptions.Subscribe(error => { /* Handle errors here */ }); - - // A helper method we can use for Visibility or Spinners to show if results are available. - // We get the latest value of the SearchResults and make sure it's not null. - _isAvailable = this - .WhenAnyValue(x => x.SearchResults) - .Select(searchResults => searchResults != null) - .ToProperty(this, x => x.IsAvailable); - } - - // Here we search NuGet packages using the NuGet.Client library. Ideally, we should - // extract such code into a separate service, say, INuGetSearchService, but let's - // try to avoid overcomplicating things at this time. - private async Task> SearchNuGetPackages(string term, CancellationToken token) - { - var providers = new List>(); - providers.AddRange(Repository.Provider.GetCoreV3()); // Add v3 API support - var package = new PackageSource("https://api.nuget.org/v3/index.json"); - var source = new SourceRepository(package, providers); - - var filter = new SearchFilter(false); - var resource = await source.GetResourceAsync(token).ConfigureAwait(false); - var metadata = await resource.SearchAsync(term, filter, 0, 10, null, token).ConfigureAwait(false); - return metadata.Select(x => new NugetDetailsViewModel(x)); - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/ListBoxItemConverter.cs b/samples/winforms/getting-started/ReactiveDemo/ListBoxItemConverter.cs deleted file mode 100644 index 2238c2a3cc..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/ListBoxItemConverter.cs +++ /dev/null @@ -1,52 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using DynamicData.Binding; -using ReactiveUI; -using ReactiveUI.Winforms; - -namespace ReactiveDemo -{ - public class ListBoxItemConverter : IBindingTypeConverter - { - public int GetAffinityForObjects(Type fromType, Type toType) - { - if (toType != typeof(Control.ControlCollection)) - { - return 0; - } - - if (fromType.GetInterface("IEnumerable") == null) - { - return 0; - } - - return 10; - } - - public bool TryConvert(object @from, Type toType, object conversionHint, out object result) - { - var enumerable = (IEnumerable)from; - - if (enumerable == null) - { - result = null; - return false; - } - - var viewModelControlHosts = new List(); - - foreach (var viewModel in enumerable) - { - viewModelControlHosts.Add(new ViewModelControlHost { ViewModel = viewModel, Dock = DockStyle.Top }); - } - - result = viewModelControlHosts; - return true; - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/MainWindow.Designer.cs b/samples/winforms/getting-started/ReactiveDemo/MainWindow.Designer.cs deleted file mode 100644 index 0c1d2d15d6..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/MainWindow.Designer.cs +++ /dev/null @@ -1,109 +0,0 @@ -namespace ReactiveDemo -{ - partial class MainWindow - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label1 = new System.Windows.Forms.Label(); - this.searchTextBox = new System.Windows.Forms.TextBox(); - this.searchResultsListBox = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.AutoSize = true; - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.375F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 79.625F)); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.searchTextBox, 1, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 1; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 25F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 25); - this.tableLayoutPanel1.TabIndex = 0; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Dock = System.Windows.Forms.DockStyle.Fill; - this.label1.Location = new System.Drawing.Point(3, 0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(157, 25); - this.label1.TabIndex = 0; - this.label1.Text = "Search For:"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight; - // - // searchTextBox - // - this.searchTextBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.searchTextBox.Location = new System.Drawing.Point(166, 3); - this.searchTextBox.Name = "searchTextBox"; - this.searchTextBox.Size = new System.Drawing.Size(631, 20); - this.searchTextBox.TabIndex = 1; - // - // searchResultsListBox - // - this.searchResultsListBox.AutoScroll = true; - this.searchResultsListBox.ColumnCount = 1; - this.searchResultsListBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.searchResultsListBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.searchResultsListBox.Location = new System.Drawing.Point(0, 25); - this.searchResultsListBox.Name = "searchResultsListBox"; - this.searchResultsListBox.RowCount = 1; - this.searchResultsListBox.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.searchResultsListBox.Size = new System.Drawing.Size(800, 425); - this.searchResultsListBox.TabIndex = 1; - // - // MainWindow - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Controls.Add(this.searchResultsListBox); - this.Controls.Add(this.tableLayoutPanel1); - this.Name = "MainWindow"; - this.Text = "ReactiveUI WPF NuGet Demo"; - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.TextBox searchTextBox; - private System.Windows.Forms.TableLayoutPanel searchResultsListBox; - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/MainWindow.cs b/samples/winforms/getting-started/ReactiveDemo/MainWindow.cs deleted file mode 100644 index 628fc9baa4..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/MainWindow.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Reactive.Disposables; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ReactiveUI; -using ReactiveUI.Winforms; - -namespace ReactiveDemo -{ - public partial class MainWindow : Form, IViewFor - { - public MainWindow() - { - InitializeComponent(); - - ViewModel = new AppViewModel(); - - // We create our bindings here. These are the code behind bindings which allow - // type safety. The bindings will only become active when the Window is being shown. - // We register our subscription in our disposableRegistration, this will cause - // the binding subscription to become inactive when the Window is closed. - // The disposableRegistration is a CompositeDisposable which is a container of - // other Disposables. We use the DisposeWith() extension method which simply adds - // the subscription disposable to the CompositeDisposable. - this.WhenActivated(disposableRegistration => - { - this.OneWayBind(ViewModel, - viewModel => viewModel.IsAvailable, - view => view.searchResultsListBox.Visible) - .DisposeWith(disposableRegistration); - - this.OneWayBind(ViewModel, - viewModel => viewModel.SearchResults, - view => view.searchResultsListBox.Controls, - vmToViewConverterOverride: new ListBoxItemConverter()) - .DisposeWith(disposableRegistration); - - this.Bind(ViewModel, - viewModel => viewModel.SearchTerm, - view => view.searchTextBox.Text) - .DisposeWith(disposableRegistration); - }); - } - - object IViewFor.ViewModel - { - get => ViewModel; - set => ViewModel = (AppViewModel)value; - } - - public AppViewModel ViewModel { get; set; } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/MainWindow.resx b/samples/winforms/getting-started/ReactiveDemo/MainWindow.resx deleted file mode 100644 index 1af7de150c..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/MainWindow.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.Designer.cs b/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.Designer.cs deleted file mode 100644 index 8c3e01561a..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.Designer.cs +++ /dev/null @@ -1,131 +0,0 @@ -namespace ReactiveDemo -{ - partial class NugetDetailsView - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.iconImage = new System.Windows.Forms.PictureBox(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.descriptionRun = new System.Windows.Forms.Label(); - this.titleRun = new System.Windows.Forms.LinkLabel(); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.iconImage)).BeginInit(); - this.tableLayoutPanel1.SuspendLayout(); - this.SuspendLayout(); - // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.iconImage); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.tableLayoutPanel1); - this.splitContainer1.Size = new System.Drawing.Size(150, 150); - this.splitContainer1.TabIndex = 0; - // - // iconImage - // - this.iconImage.Dock = System.Windows.Forms.DockStyle.Fill; - this.iconImage.Location = new System.Drawing.Point(0, 0); - this.iconImage.MaximumSize = new System.Drawing.Size(200, 200); - this.iconImage.Name = "iconImage"; - this.iconImage.Size = new System.Drawing.Size(50, 150); - this.iconImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; - this.iconImage.TabIndex = 0; - this.iconImage.TabStop = false; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.ColumnCount = 1; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.descriptionRun, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.titleRun, 0, 0); - this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(96, 150); - this.tableLayoutPanel1.TabIndex = 0; - // - // descriptionRun - // - this.descriptionRun.AutoSize = true; - this.descriptionRun.Location = new System.Drawing.Point(3, 20); - this.descriptionRun.Name = "descriptionRun"; - this.descriptionRun.Size = new System.Drawing.Size(35, 13); - this.descriptionRun.TabIndex = 1; - this.descriptionRun.Text = "label2"; - // - // titleRun - // - this.titleRun.AutoSize = true; - this.titleRun.Location = new System.Drawing.Point(3, 0); - this.titleRun.Name = "titleRun"; - this.titleRun.Size = new System.Drawing.Size(55, 13); - this.titleRun.TabIndex = 2; - this.titleRun.TabStop = true; - this.titleRun.Text = "linkLabel1"; - // - // NugetDetailsView - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.splitContainer1); - this.Name = "NugetDetailsView"; - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); - this.splitContainer1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.iconImage)).EndInit(); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.ResumeLayout(false); - - } - - #endregion - - private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.PictureBox iconImage; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label descriptionRun; - private System.Windows.Forms.LinkLabel titleRun; - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.cs b/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.cs deleted file mode 100644 index f6e4c2fdb0..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System.Reactive.Disposables; -using ReactiveUI; -using ReactiveUI.Winforms; - -namespace ReactiveDemo -{ - public partial class NugetDetailsView : ReactiveUserControl - { - public NugetDetailsView() - { - InitializeComponent(); - - this.WhenActivated(disposableRegistration => - { - // Our 4th parameter we convert from Url into a BitmapImage. - // This is an easy way of doing value conversion using ReactiveUI binding. - this.OneWayBind(ViewModel, - viewModel => viewModel.IconUrl, - view => view.iconImage.ImageLocation) - .DisposeWith(disposableRegistration); - - this.OneWayBind(ViewModel, - viewModel => viewModel.Title, - view => view.titleRun.Text) - .DisposeWith(disposableRegistration); - - this.OneWayBind(ViewModel, - viewModel => viewModel.Description, - view => view.descriptionRun.Text) - .DisposeWith(disposableRegistration); - - this.BindCommand(ViewModel, - viewModel => viewModel.OpenPage, - view => view.titleRun) - .DisposeWith(disposableRegistration); - }); - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.resx b/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.resx deleted file mode 100644 index 1af7de150c..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsView.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsViewModel.cs b/samples/winforms/getting-started/ReactiveDemo/NugetDetailsViewModel.cs deleted file mode 100644 index b87b9bb7b2..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/NugetDetailsViewModel.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using System.Diagnostics; -using System.Reactive; -using NuGet.Protocol.Core.Types; -using ReactiveUI; - -namespace ReactiveDemo -{ - // This class wraps out NuGet model object into a ViewModel and allows - // us to have a ReactiveCommand to open the NuGet package URL. - public class NugetDetailsViewModel : ReactiveObject - { - private readonly IPackageSearchMetadata _metadata; - private readonly Uri _defaultUrl; - - public NugetDetailsViewModel(IPackageSearchMetadata metadata) - { - _metadata = metadata; - _defaultUrl = new Uri("https://git.io/fAlfh"); - OpenPage = ReactiveCommand.Create(() => { Process.Start(ProjectUrl.ToString()); }); - } - - public Uri IconUrl => _metadata.IconUrl ?? _defaultUrl; - public string Description => _metadata.Description; - public Uri ProjectUrl => _metadata.ProjectUrl; - public string Title => _metadata.Title; - - // ReactiveCommand allows us to execute logic without exposing any of the - // implementation details with the View. The generic parameters are the - // input into the command and it's output. In our case we don't have any - // input or output so we use Unit which in Reactive speak means a void type. - public ReactiveCommand OpenPage { get; } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/Program.cs b/samples/winforms/getting-started/ReactiveDemo/Program.cs deleted file mode 100644 index 0fcf46ed1f..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/Program.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using System.Windows.Forms; -using ReactiveUI; -using Splat; - -namespace ReactiveDemo -{ - internal static class Program - { - /// - /// The main entry point for the application. - /// - [STAThread] - static void Main() - { - // A helper method that will register all classes that derive off IViewFor - // into our dependency injection container. ReactiveUI uses Splat for it's - // dependency injection by default, but you can override this if you like. - Locator.CurrentMutable.RegisterViewsForViewModels(Assembly.GetCallingAssembly()); - - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - Application.Run(new MainWindow()); - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/Properties/AssemblyInfo.cs b/samples/winforms/getting-started/ReactiveDemo/Properties/AssemblyInfo.cs deleted file mode 100644 index c028173939..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ReactiveUI.Demo")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ReactiveUI.Demo")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6e814355-0a7d-4caa-ba94-06a451e9ec68")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/winforms/getting-started/ReactiveDemo/Properties/Resources.Designer.cs b/samples/winforms/getting-started/ReactiveDemo/Properties/Resources.Designer.cs deleted file mode 100644 index 2932ac732c..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ReactiveDemo.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ReactiveDemo.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/Properties/Resources.resx b/samples/winforms/getting-started/ReactiveDemo/Properties/Resources.resx deleted file mode 100644 index af7dbebbac..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/samples/winforms/getting-started/ReactiveDemo/Properties/Settings.Designer.cs b/samples/winforms/getting-started/ReactiveDemo/Properties/Settings.Designer.cs deleted file mode 100644 index a98cf411af..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ReactiveDemo.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/samples/winforms/getting-started/ReactiveDemo/Properties/Settings.settings b/samples/winforms/getting-started/ReactiveDemo/Properties/Settings.settings deleted file mode 100644 index 39645652af..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/samples/winforms/getting-started/ReactiveDemo/ReactiveUIDemo.csproj b/samples/winforms/getting-started/ReactiveDemo/ReactiveUIDemo.csproj deleted file mode 100644 index 20804e561e..0000000000 --- a/samples/winforms/getting-started/ReactiveDemo/ReactiveUIDemo.csproj +++ /dev/null @@ -1,115 +0,0 @@ - - - - - Debug - AnyCPU - {6E814355-0A7D-4CAA-BA94-06A451E9EC68} - WinExe - ReactiveDemo - ReactiveUI.Demo - v4.7.2 - 512 - true - true - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - Form - - - MainWindow.cs - - - UserControl - - - NugetDetailsView.cs - - - - - - MainWindow.cs - - - NugetDetailsView.cs - - - ResXFileCodeGenerator - Resources.Designer.cs - Designer - - - True - Resources.resx - True - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - True - Settings.settings - True - - - - - - - - 4.2.0 - - - 4.2.0 - - - - - {ea9a51e7-4854-4593-a272-10d4824fd2a7} - ReactiveUI.Winforms - - - {ea20b8e2-5b2d-4aba-aa3b-5912dad9759c} - ReactiveUI - - - - \ No newline at end of file diff --git a/samples/wpf/ReactiveUI.Samples.Routing/App.xaml b/samples/wpf/ReactiveUI.Samples.Routing/App.xaml deleted file mode 100644 index 7694880172..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/App.xaml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - diff --git a/samples/wpf/ReactiveUI.Samples.Routing/App.xaml.cs b/samples/wpf/ReactiveUI.Samples.Routing/App.xaml.cs deleted file mode 100644 index 8b689cc0fb..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/App.xaml.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Linq; -using System.Reactive; -using System.Windows; -using ReactiveUI.Samples.Routing.Interactions; -using ReactiveUI.Samples.Routing.ViewModels; - -namespace ReactiveUI.Samples.Routing -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App : Application - { - public App() - { - MessageInteractions.ShowMessage.RegisterHandler(context => - { - MessageBox.Show(context.Input); - context.SetOutput(Unit.Default); - }); - } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Interactions/MessageInteractions.cs b/samples/wpf/ReactiveUI.Samples.Routing/Interactions/MessageInteractions.cs deleted file mode 100644 index 6b04a9981d..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Interactions/MessageInteractions.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reactive; -using System.Text; -using System.Threading.Tasks; - -namespace ReactiveUI.Samples.Routing.Interactions -{ - public static class MessageInteractions - { - public static Interaction ShowMessage { get; } = new Interaction(); - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/MainWindow.xaml b/samples/wpf/ReactiveUI.Samples.Routing/MainWindow.xaml deleted file mode 100644 index 83a49e3c0d..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/MainWindow.xaml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - diff --git a/samples/wpf/ReactiveUI.Samples.Routing/MainWindow.xaml.cs b/samples/wpf/ReactiveUI.Samples.Routing/MainWindow.xaml.cs deleted file mode 100644 index 4feb7892d4..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/MainWindow.xaml.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using ReactiveUI.Samples.Routing.ViewModels; - -namespace ReactiveUI.Samples.Routing -{ - /// - /// Interaction logic for MainWindow.xaml - /// - public partial class MainWindow : Window - { - public AppBootstrapper AppBootstrapper { get; protected set; } - - public MainWindow() - { - InitializeComponent(); - - AppBootstrapper = new AppBootstrapper(); - DataContext = AppBootstrapper; - } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Properties/AssemblyInfo.cs b/samples/wpf/ReactiveUI.Samples.Routing/Properties/AssemblyInfo.cs deleted file mode 100644 index f9f44a9506..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Windows; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("ReactiveUI.Samples.Routing")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("ReactiveUI.Samples.Routing")] -[assembly: AssemblyCopyright("Copyright © 2012")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -//In order to begin building localizable applications, set -//CultureYouAreCodingWith in your .csproj file -//inside a . For example, if you are using US english -//in your source files, set the to en-US. Then uncomment -//the NeutralResourceLanguage attribute below. Update the "en-US" in -//the line below to match the UICulture setting in the project file. - -//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - - -[assembly: ThemeInfo( - ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located - //(used if a resource is not found in the page, - // or application resource dictionaries) - ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located - //(used if a resource is not found in the page, - // app, or any theme specific resource dictionaries) -)] - - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Resources.Designer.cs b/samples/wpf/ReactiveUI.Samples.Routing/Properties/Resources.Designer.cs deleted file mode 100644 index f700b328ce..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Resources.Designer.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.32559 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ReactiveUI.Samples.Routing.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ReactiveUI.Samples.Routing.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Resources.resx b/samples/wpf/ReactiveUI.Samples.Routing/Properties/Resources.resx deleted file mode 100644 index af7dbebbac..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Resources.resx +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Settings.Designer.cs b/samples/wpf/ReactiveUI.Samples.Routing/Properties/Settings.Designer.cs deleted file mode 100644 index 3b20fd9d89..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Settings.Designer.cs +++ /dev/null @@ -1,26 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.32559 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace ReactiveUI.Samples.Routing.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Settings.settings b/samples/wpf/ReactiveUI.Samples.Routing/Properties/Settings.settings deleted file mode 100644 index 033d7a5e9e..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Properties/Settings.settings +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/samples/wpf/ReactiveUI.Samples.Routing/ReactiveUI.Samples.Routing101.csproj b/samples/wpf/ReactiveUI.Samples.Routing/ReactiveUI.Samples.Routing101.csproj deleted file mode 100644 index 9588e34284..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/ReactiveUI.Samples.Routing101.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Debug - AnyCPU - {996C151B-7AAF-4C5C-A786-52DF9C251A73} - WinExe - ReactiveUI.Samples.Routing - ReactiveUI.Samples.Routing - v4.7.2 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - true - true - ..\..\..\src\analyzers.ruleset - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - MSBuild:Compile - Designer - - - - - - - - - - SecondView.xaml - - - WelcomeView.xaml - - - MSBuild:Compile - Designer - - - App.xaml - Code - - - MainWindow.xaml - Code - - - Designer - MSBuild:Compile - - - MSBuild:Compile - Designer - - - - - - - - - - - - - - - - - - - - - - 9.11.3 - - - - \ No newline at end of file diff --git a/samples/wpf/ReactiveUI.Samples.Routing/ReactiveUI.Samples.Routing101.sln b/samples/wpf/ReactiveUI.Samples.Routing/ReactiveUI.Samples.Routing101.sln deleted file mode 100644 index 53f3aa1914..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/ReactiveUI.Samples.Routing101.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.438 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReactiveUI.Samples.Routing101", "ReactiveUI.Samples.Routing101.csproj", "{996C151B-7AAF-4C5C-A786-52DF9C251A73}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {996C151B-7AAF-4C5C-A786-52DF9C251A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {996C151B-7AAF-4C5C-A786-52DF9C251A73}.Debug|Any CPU.Build.0 = Debug|Any CPU - {996C151B-7AAF-4C5C-A786-52DF9C251A73}.Release|Any CPU.ActiveCfg = Release|Any CPU - {996C151B-7AAF-4C5C-A786-52DF9C251A73}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3BF0882A-B32C-4148-BF22-59C8406C0CAD} - EndGlobalSection -EndGlobal diff --git a/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/AppBootstrapper.cs b/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/AppBootstrapper.cs deleted file mode 100644 index aa976ec017..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/AppBootstrapper.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using ReactiveUI.Samples.Routing.Views; -using Splat; - -namespace ReactiveUI.Samples.Routing.ViewModels -{ - /* COOLSTUFF: What is the AppBootstrapper? - * - * The AppBootstrapper is like a ViewModel for the WPF Application class. - * Since Application isn't very testable (just like Window / UserControl), - * we want to create a class we can test. Since our application only has - * one "screen" (i.e. a place we present Routed Views), we can also use - * this as our IScreen. - * - * An IScreen is a ViewModel that contains a Router - practically speaking, - * it usually represents a Window (or the RootFrame of a WinRT app). We - * should technically create a MainWindowViewModel to represent the IScreen, - * but there isn't much benefit to split those up unless you've got multiple - * windows. - * - * AppBootstrapper is a good place to implement a lot of the "global - * variable" type things in your application. It's also the place where - * you should configure your IoC container. And finally, it's the place - * which decides which View to Navigate to when the application starts. - */ - - public class AppBootstrapper : ReactiveObject, IScreen - { - public RoutingState Router { get; private set; } - - public AppBootstrapper(IMutableDependencyResolver dependencyResolver = null, RoutingState testRouter = null) - { - Router = testRouter ?? new RoutingState(); - dependencyResolver = dependencyResolver ?? Locator.CurrentMutable; - - // Bind - RegisterParts(dependencyResolver); - - // TODO: This is a good place to set up any other app - // startup tasks, like setting the logging level - LogHost.Default.Level = LogLevel.Debug; - - // Navigate to the opening page of the application - Router.Navigate.Execute(new WelcomeViewModel(this)); - } - - private void RegisterParts(IMutableDependencyResolver dependencyResolver) - { - dependencyResolver.RegisterConstant(this, typeof(IScreen)); - - dependencyResolver.Register(() => new WelcomeView(), typeof(IViewFor)); - dependencyResolver.Register(() => new SecondView(), typeof(IViewFor)); - } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/SecondViewModel.cs b/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/SecondViewModel.cs deleted file mode 100644 index 6b22df2e01..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/SecondViewModel.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reactive; -using System.Text; -using System.Threading.Tasks; - -namespace ReactiveUI.Samples.Routing.ViewModels -{ - public class SecondViewModel : ReactiveObject, IRoutableViewModel - { - public SecondViewModel(IScreen hostScreen) - { - HostScreen = hostScreen; - - this.Back = HostScreen.Router.NavigateBack; - } - - public string UrlPathSegment => "Second"; - public IScreen HostScreen { get; } - - public ReactiveCommand Back { get; } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/WelcomeViewModel.cs b/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/WelcomeViewModel.cs deleted file mode 100644 index aaa3765c54..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/ViewModels/WelcomeViewModel.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Reactive; -using ReactiveUI; -using System.Reactive.Linq; -using System.Reactive.Disposables; -using ReactiveUI.Samples.Routing.Interactions; - -namespace ReactiveUI.Samples.Routing.ViewModels -{ - // It's usually a good idea to create an interface for every ViewModel and - // reference that instead of the implementation. This makes creating fake - // versions or design-time versions of ViewModels much easier. - public interface IWelcomeViewModel : IRoutableViewModel - { - ReactiveCommand HelloWorld { get; } - ReactiveCommand NavigateToSecond { get; } - } - - public class WelcomeViewModel : ReactiveObject, IWelcomeViewModel - { - /* COOLSTUFF: What is UrlPathSegment - * - * Imagine that the router state is like the path of the URL - what - * would the path look like for this particular page? Maybe it would be - * the current user's name, or an "id". In this case, it's just a - * constant. You can get the whole path via - * IRoutingState.GetUrlForCurrentRoute. - */ - public string UrlPathSegment { - get { return "welcome"; } - } - - public IScreen HostScreen { get; protected set; } - - public ReactiveCommand HelloWorld { get; protected set; } - - public ReactiveCommand NavigateToSecond { get; } - - /* COOLSTUFF: Why the Screen here? - * - * Every RoutableViewModel has a pointer to its IScreen. This is really - * useful in a unit test runner, because you can create a dummy screen, - * invoke Commands / change Properties, then test to see if you navigated - * to the correct new screen - */ - public WelcomeViewModel(IScreen screen) - { - HostScreen = screen; - - /* COOLSTUFF: Where's the Execute handler? - * - * We want this command to display a MessageBox. However, - * displaying a MessageBox is a very View'y thing to do. Instead, - * the ViewModel is going to create the ReactiveCommand and the - * *View* is going to Subscribe to it. That way, we can test in - * the Unit Test runner that HelloWorld is Execute'd at the right - * times, but still display the MessageBox when the code runs - * normally, - */ - - HelloWorld = ReactiveCommand.CreateFromObservable(() => MessageInteractions.ShowMessage.Handle("It works!!!")); - NavigateToSecond = ReactiveCommand.CreateFromTask(async () => await HostScreen.Router.Navigate.Execute(new SecondViewModel(HostScreen)).Select(_ => Unit.Default)); - - this.WhenNavigatedTo(()=> Bar()); - } - - private IDisposable Bar() - { - return Disposable.Create(() => Foo()); - } - - private void Foo() - { - if (true) { } - } - } -} diff --git a/samples/wpf/ReactiveUI.Samples.Routing/Views/SecondView.xaml b/samples/wpf/ReactiveUI.Samples.Routing/Views/SecondView.xaml deleted file mode 100644 index 8fb65e6ad9..0000000000 --- a/samples/wpf/ReactiveUI.Samples.Routing/Views/SecondView.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - -