Browse Source

Remove ReactiveUI usage from sample apps

pull/5060/head
Nikita Tsukanov 5 years ago
parent
commit
303b6c1586
  1. 27
      Avalonia.sln
  2. 2
      samples/BindingDemo/App.xaml.cs
  3. 3
      samples/BindingDemo/BindingDemo.csproj
  4. 4
      samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs
  5. 4
      samples/BindingDemo/ViewModels/IndeiErrorViewModel.cs
  6. 12
      samples/BindingDemo/ViewModels/MainWindowViewModel.cs
  7. 8
      samples/BindingDemo/ViewModels/NestedCommandViewModel.cs
  8. 4
      samples/BindingDemo/ViewModels/TestItem.cs
  9. 4
      samples/ControlCatalog.Desktop/Program.cs
  10. 2
      samples/ControlCatalog.NetCore/Program.cs
  11. 2
      samples/ControlCatalog/ControlCatalog.csproj
  12. 1
      samples/ControlCatalog/Pages/LabelsPage.axaml.cs
  13. 2
      samples/ControlCatalog/Pages/ListBoxPage.xaml
  14. 1
      samples/ControlCatalog/Pages/MenuPage.xaml.cs
  15. 4
      samples/ControlCatalog/Pages/NumericUpDownPage.xaml.cs
  16. 4
      samples/ControlCatalog/Pages/ScrollViewerPage.xaml.cs
  17. 4
      samples/ControlCatalog/Pages/TabControlPage.xaml.cs
  18. 14
      samples/ControlCatalog/ViewModels/ContextMenuPageViewModel.cs
  19. 6
      samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs
  20. 27
      samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs
  21. 28
      samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
  22. 14
      samples/ControlCatalog/ViewModels/MenuPageViewModel.cs
  23. 10
      samples/ControlCatalog/ViewModels/NotificationViewModel.cs
  24. 4
      samples/ControlCatalog/ViewModels/SplitViewPageViewModel.cs
  25. 16
      samples/ControlCatalog/ViewModels/TreeViewPageViewModel.cs
  26. 66
      samples/MiniMvvm/MiniCommand.cs
  27. 6
      samples/MiniMvvm/MiniMvvm.csproj
  28. 108
      samples/MiniMvvm/PropertyChangedExtensions.cs
  29. 26
      samples/MiniMvvm/ViewModelBase.cs
  30. 1
      samples/Previewer/Previewer.csproj
  31. 2
      samples/RenderDemo/App.xaml.cs
  32. 2
      samples/RenderDemo/MainWindow.xaml.cs
  33. 3
      samples/RenderDemo/RenderDemo.csproj
  34. 4
      samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs
  35. 17
      samples/RenderDemo/ViewModels/MainWindowViewModel.cs
  36. 2
      samples/Sandbox/Program.cs
  37. 1
      samples/Sandbox/Sandbox.csproj
  38. 2
      samples/VirtualizationDemo/Program.cs
  39. 4
      samples/VirtualizationDemo/ViewModels/ItemViewModel.cs
  40. 24
      samples/VirtualizationDemo/ViewModels/MainWindowViewModel.cs
  41. 3
      samples/VirtualizationDemo/VirtualizationDemo.csproj
  42. 2
      samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj
  43. 4
      samples/interop/Direct3DInteropSample/MainWindowViewModel.cs
  44. 6
      samples/interop/WindowsInteropTest/WindowsInteropTest.csproj
  45. 4
      src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj

27
Avalonia.sln

@ -230,6 +230,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MicroComGenerator", "src\to
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.MicroCom", "src\Avalonia.MicroCom\Avalonia.MicroCom.csproj", "{FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.MicroCom", "src\Avalonia.MicroCom\Avalonia.MicroCom.csproj", "{FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MiniMvvm", "samples\MiniMvvm\MiniMvvm.csproj", "{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}"
EndProject
Global Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13 src\Shared\RenderHelpers\RenderHelpers.projitems*{3c4c0cb4-0c0f-4450-a37b-148c84ff905f}*SharedItemsImports = 13
@ -2116,6 +2118,30 @@ Global
{FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhone.Build.0 = Release|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhone.Build.0 = Release|Any CPU
{FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU {FE2F3E5E-1E34-4972-8DC1-5C2C588E5ECE}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhone.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhone.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|Any CPU.Build.0 = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.ActiveCfg = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhone.Build.0 = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -2176,6 +2202,7 @@ Global
{909A8CBD-7D0E-42FD-B841-022AD8925820} = {8B6A8209-894F-4BA1-B880-965FD453982C} {909A8CBD-7D0E-42FD-B841-022AD8925820} = {8B6A8209-894F-4BA1-B880-965FD453982C}
{11BE52AF-E2DD-4CF0-B19A-05285ACAF571} = {9B9E3891-2366-4253-A952-D08BCEB71098} {11BE52AF-E2DD-4CF0-B19A-05285ACAF571} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{AEC9031E-06EA-4A9E-9E7F-7D7C719404DD} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637} {AEC9031E-06EA-4A9E-9E7F-7D7C719404DD} = {4ED8B739-6F4E-4CD4-B993-545E6B5CE637}
{BC594FD5-4AF2-409E-A1E6-04123F54D7C5} = {9B9E3891-2366-4253-A952-D08BCEB71098}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A} SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A}

2
samples/BindingDemo/App.xaml.cs

@ -1,7 +1,6 @@
using Avalonia; using Avalonia;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace BindingDemo namespace BindingDemo
{ {
@ -25,7 +24,6 @@ namespace BindingDemo
public static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>() => AppBuilder.Configure<App>()
.UsePlatformDetect() .UsePlatformDetect()
.UseReactiveUI()
.LogToTrace(); .LogToTrace();
} }
} }

3
samples/BindingDemo/BindingDemo.csproj

@ -6,12 +6,11 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" />
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> <ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" />
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> <ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\build\SampleApp.props" /> <Import Project="..\..\build\SampleApp.props" />
<Import Project="..\..\build\EmbedXaml.props" /> <Import Project="..\..\build\EmbedXaml.props" />
<Import Project="..\..\build\Rx.props" /> <Import Project="..\..\build\Rx.props" />
<Import Project="..\..\build\ReactiveUI.props" />
<Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" /> <Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" />
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> <Import Project="..\..\build\ReferenceCoreLibraries.props" />
<Import Project="..\..\build\BuildTargets.targets" /> <Import Project="..\..\build\BuildTargets.targets" />

4
samples/BindingDemo/ViewModels/ExceptionErrorViewModel.cs

@ -1,9 +1,9 @@
using ReactiveUI; using MiniMvvm;
using System; using System;
namespace BindingDemo.ViewModels namespace BindingDemo.ViewModels
{ {
public class ExceptionErrorViewModel : ReactiveObject public class ExceptionErrorViewModel : ViewModelBase
{ {
private int _lessThan10; private int _lessThan10;

4
samples/BindingDemo/ViewModels/IndeiErrorViewModel.cs

@ -1,11 +1,11 @@
using ReactiveUI; using MiniMvvm;
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Collections; using System.Collections;
namespace BindingDemo.ViewModels namespace BindingDemo.ViewModels
{ {
public class IndeiErrorViewModel : ReactiveObject, INotifyDataErrorInfo public class IndeiErrorViewModel : ViewModelBase, INotifyDataErrorInfo
{ {
private int _maximum = 10; private int _maximum = 10;
private int _value; private int _value;

12
samples/BindingDemo/ViewModels/MainWindowViewModel.cs

@ -5,14 +5,14 @@ using System.Reactive;
using System.Reactive.Linq; using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Threading; using System.Threading;
using ReactiveUI; using MiniMvvm;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Metadata; using Avalonia.Metadata;
using Avalonia.Controls.Selection; using Avalonia.Controls.Selection;
namespace BindingDemo.ViewModels namespace BindingDemo.ViewModels
{ {
public class MainWindowViewModel : ReactiveObject public class MainWindowViewModel : ViewModelBase
{ {
private string _booleanString = "True"; private string _booleanString = "True";
private double _doubleValue = 5.0; private double _doubleValue = 5.0;
@ -32,13 +32,13 @@ namespace BindingDemo.ViewModels
Selection = new SelectionModel<TestItem> { SingleSelect = false }; Selection = new SelectionModel<TestItem> { SingleSelect = false };
ShuffleItems = ReactiveCommand.Create(() => ShuffleItems = MiniCommand.Create(() =>
{ {
var r = new Random(); var r = new Random();
Items.Move(r.Next(Items.Count), 1); Items.Move(r.Next(Items.Count), 1);
}); });
StringValueCommand = ReactiveCommand.Create<object>(param => StringValueCommand = MiniCommand.Create<object>(param =>
{ {
BooleanFlag = !BooleanFlag; BooleanFlag = !BooleanFlag;
StringValue = param.ToString(); StringValue = param.ToString();
@ -60,7 +60,7 @@ namespace BindingDemo.ViewModels
public ObservableCollection<TestItem> Items { get; } public ObservableCollection<TestItem> Items { get; }
public SelectionModel<TestItem> Selection { get; } public SelectionModel<TestItem> Selection { get; }
public ReactiveCommand<Unit, Unit> ShuffleItems { get; } public MiniCommand ShuffleItems { get; }
public string BooleanString public string BooleanString
{ {
@ -93,7 +93,7 @@ namespace BindingDemo.ViewModels
} }
public IObservable<DateTimeOffset> CurrentTimeObservable { get; } public IObservable<DateTimeOffset> CurrentTimeObservable { get; }
public ReactiveCommand<object, Unit> StringValueCommand { get; } public MiniCommand StringValueCommand { get; }
public DataAnnotationsErrorViewModel DataAnnotationsValidation { get; } = new DataAnnotationsErrorViewModel(); public DataAnnotationsErrorViewModel DataAnnotationsValidation { get; } = new DataAnnotationsErrorViewModel();
public ExceptionErrorViewModel ExceptionDataValidation { get; } = new ExceptionErrorViewModel(); public ExceptionErrorViewModel ExceptionDataValidation { get; } = new ExceptionErrorViewModel();

8
samples/BindingDemo/ViewModels/NestedCommandViewModel.cs

@ -1,18 +1,18 @@
using ReactiveUI; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using MiniMvvm;
namespace BindingDemo.ViewModels namespace BindingDemo.ViewModels
{ {
public class NestedCommandViewModel : ReactiveObject public class NestedCommandViewModel : ViewModelBase
{ {
public NestedCommandViewModel() public NestedCommandViewModel()
{ {
Command = ReactiveCommand.Create(() => { }); Command = MiniCommand.Create(() => { });
} }
public ICommand Command { get; } public ICommand Command { get; }

4
samples/BindingDemo/ViewModels/TestItem.cs

@ -1,8 +1,8 @@
using ReactiveUI; using MiniMvvm;
namespace BindingDemo.ViewModels namespace BindingDemo.ViewModels
{ {
public class TestItem : ReactiveObject public class TestItem : ViewModelBase
{ {
private string _stringValue = "String Value"; private string _stringValue = "String Value";
private string _detail; private string _detail;

4
samples/ControlCatalog.Desktop/Program.cs

@ -3,7 +3,6 @@ using System.Linq;
using Avalonia; using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Platform; using Avalonia.Platform;
using Avalonia.ReactiveUI;
namespace ControlCatalog namespace ControlCatalog
{ {
@ -19,8 +18,7 @@ namespace ControlCatalog
public static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>() => AppBuilder.Configure<App>()
.LogToTrace() .LogToTrace()
.UsePlatformDetect() .UsePlatformDetect();
.UseReactiveUI();
private static void ConfigureAssetAssembly(AppBuilder builder) private static void ConfigureAssetAssembly(AppBuilder builder)
{ {

2
samples/ControlCatalog.NetCore/Program.cs

@ -10,7 +10,6 @@ using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Dialogs; using Avalonia.Dialogs;
using Avalonia.Headless; using Avalonia.Headless;
using Avalonia.LogicalTree; using Avalonia.LogicalTree;
using Avalonia.ReactiveUI;
using Avalonia.Threading; using Avalonia.Threading;
namespace ControlCatalog.NetCore namespace ControlCatalog.NetCore
@ -118,7 +117,6 @@ namespace ControlCatalog.NetCore
AllowEglInitialization = true AllowEglInitialization = true
}) })
.UseSkia() .UseSkia()
.UseReactiveUI()
.UseManagedSystemDialogs() .UseManagedSystemDialogs()
.LogToTrace(); .LogToTrace();

2
samples/ControlCatalog/ControlCatalog.csproj

@ -24,8 +24,8 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" /> <ProjectReference Include="..\..\packages\Avalonia\Avalonia.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" />
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Controls.DataGrid\Avalonia.Controls.DataGrid.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Controls.DataGrid\Avalonia.Controls.DataGrid.csproj" />
<ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\build\BuildTargets.targets" /> <Import Project="..\..\build\BuildTargets.targets" />

1
samples/ControlCatalog/Pages/LabelsPage.axaml.cs

@ -2,7 +2,6 @@
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using ControlCatalog.Models; using ControlCatalog.Models;
using ReactiveUI;
namespace ControlCatalog.Pages namespace ControlCatalog.Pages
{ {

2
samples/ControlCatalog/Pages/ListBoxPage.xaml

@ -20,6 +20,6 @@
<ListBox Items="{Binding Items}" <ListBox Items="{Binding Items}"
Selection="{Binding Selection}" Selection="{Binding Selection}"
AutoScrollToSelectedItem="{Binding AutoScrollToSelectedItem}" AutoScrollToSelectedItem="{Binding AutoScrollToSelectedItem}"
SelectionMode="{Binding SelectionMode}"/> SelectionMode="{Binding SelectionMode^}"/>
</DockPanel> </DockPanel>
</UserControl> </UserControl>

1
samples/ControlCatalog/Pages/MenuPage.xaml.cs

@ -6,7 +6,6 @@ using System.Windows.Input;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using ControlCatalog.ViewModels; using ControlCatalog.ViewModels;
using ReactiveUI;
namespace ControlCatalog.Pages namespace ControlCatalog.Pages
{ {

4
samples/ControlCatalog/Pages/NumericUpDownPage.xaml.cs

@ -6,7 +6,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.Pages namespace ControlCatalog.Pages
{ {
@ -26,7 +26,7 @@ namespace ControlCatalog.Pages
} }
public class NumbersPageViewModel : ReactiveObject public class NumbersPageViewModel : ViewModelBase
{ {
private IList<FormatObject> _formats; private IList<FormatObject> _formats;
private FormatObject _selectedFormat; private FormatObject _selectedFormat;

4
samples/ControlCatalog/Pages/ScrollViewerPage.xaml.cs

@ -2,11 +2,11 @@ using System.Collections.Generic;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.Pages namespace ControlCatalog.Pages
{ {
public class ScrollViewerPageViewModel : ReactiveObject public class ScrollViewerPageViewModel : ViewModelBase
{ {
private bool _allowAutoHide; private bool _allowAutoHide;
private ScrollBarVisibility _horizontalScrollVisibility; private ScrollBarVisibility _horizontalScrollVisibility;

4
samples/ControlCatalog/Pages/TabControlPage.xaml.cs

@ -6,7 +6,7 @@ using Avalonia.Markup.Xaml;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using Avalonia.Platform; using Avalonia.Platform;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.Pages namespace ControlCatalog.Pages
{ {
@ -56,7 +56,7 @@ namespace ControlCatalog.Pages
return new Bitmap(assets.Open(new Uri(uri))); return new Bitmap(assets.Open(new Uri(uri)));
} }
private class PageViewModel : ReactiveObject private class PageViewModel : ViewModelBase
{ {
private Dock _tabPlacement; private Dock _tabPlacement;

14
samples/ControlCatalog/ViewModels/ContextMenuPageViewModel.cs

@ -3,7 +3,7 @@ using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
@ -12,9 +12,9 @@ namespace ControlCatalog.ViewModels
public Control View { get; set; } public Control View { get; set; }
public ContextMenuPageViewModel() public ContextMenuPageViewModel()
{ {
OpenCommand = ReactiveCommand.CreateFromTask(Open); OpenCommand = MiniCommand.CreateFromTask(Open);
SaveCommand = ReactiveCommand.Create(Save); SaveCommand = MiniCommand.Create(Save);
OpenRecentCommand = ReactiveCommand.Create<string>(OpenRecent); OpenRecentCommand = MiniCommand.Create<string>(OpenRecent);
MenuItems = new[] MenuItems = new[]
{ {
@ -44,9 +44,9 @@ namespace ControlCatalog.ViewModels
} }
public IReadOnlyList<MenuItemViewModel> MenuItems { get; set; } public IReadOnlyList<MenuItemViewModel> MenuItems { get; set; }
public ReactiveCommand<Unit, Unit> OpenCommand { get; } public MiniCommand OpenCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCommand { get; } public MiniCommand SaveCommand { get; }
public ReactiveCommand<string, Unit> OpenRecentCommand { get; } public MiniCommand OpenRecentCommand { get; }
public async Task Open() public async Task Open()
{ {

6
samples/ControlCatalog/ViewModels/ItemsRepeaterPageViewModel.cs

@ -2,11 +2,11 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Avalonia.Media; using Avalonia.Media;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
public class ItemsRepeaterPageViewModel : ReactiveObject public class ItemsRepeaterPageViewModel : ViewModelBase
{ {
private int _newItemIndex = 1; private int _newItemIndex = 1;
private int _newGenerationIndex = 0; private int _newGenerationIndex = 0;
@ -59,7 +59,7 @@ namespace ControlCatalog.ViewModels
})); }));
} }
public class Item : ReactiveObject public class Item : ViewModelBase
{ {
private double _height = double.NaN; private double _height = double.NaN;

27
samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs

@ -4,18 +4,18 @@ using System.Linq;
using System.Reactive; using System.Reactive;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Selection; using Avalonia.Controls.Selection;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
public class ListBoxPageViewModel : ReactiveObject public class ListBoxPageViewModel : ViewModelBase
{ {
private bool _multiple; private bool _multiple;
private bool _toggle; private bool _toggle;
private bool _alwaysSelected; private bool _alwaysSelected;
private bool _autoScrollToSelectedItem = true; private bool _autoScrollToSelectedItem = true;
private int _counter; private int _counter;
private ObservableAsPropertyHelper<SelectionMode> _selectionMode; private IObservable<SelectionMode> _selectionMode;
public ListBoxPageViewModel() public ListBoxPageViewModel()
{ {
@ -29,14 +29,13 @@ namespace ControlCatalog.ViewModels
x => x.Toggle, x => x.Toggle,
x => x.AlwaysSelected, x => x.AlwaysSelected,
(m, t, a) => (m, t, a) =>
(m ? SelectionMode.Multiple : 0) | (m ? Avalonia.Controls.SelectionMode.Multiple : 0) |
(t ? SelectionMode.Toggle : 0) | (t ? Avalonia.Controls.SelectionMode.Toggle : 0) |
(a ? SelectionMode.AlwaysSelected : 0)) (a ? Avalonia.Controls.SelectionMode.AlwaysSelected : 0));
.ToProperty(this, x => x.SelectionMode);
AddItemCommand = ReactiveCommand.Create(() => Items.Add(GenerateItem())); AddItemCommand = MiniCommand.Create(() => Items.Add(GenerateItem()));
RemoveItemCommand = ReactiveCommand.Create(() => RemoveItemCommand = MiniCommand.Create(() =>
{ {
var items = Selection.SelectedItems.ToList(); var items = Selection.SelectedItems.ToList();
@ -46,7 +45,7 @@ namespace ControlCatalog.ViewModels
} }
}); });
SelectRandomItemCommand = ReactiveCommand.Create(() => SelectRandomItemCommand = MiniCommand.Create(() =>
{ {
var random = new Random(); var random = new Random();
@ -60,7 +59,7 @@ namespace ControlCatalog.ViewModels
public ObservableCollection<string> Items { get; } public ObservableCollection<string> Items { get; }
public SelectionModel<string> Selection { get; } public SelectionModel<string> Selection { get; }
public SelectionMode SelectionMode => _selectionMode.Value; public IObservable<SelectionMode> SelectionMode => _selectionMode;
public bool Multiple public bool Multiple
{ {
@ -86,9 +85,9 @@ namespace ControlCatalog.ViewModels
set => this.RaiseAndSetIfChanged(ref _autoScrollToSelectedItem, value); set => this.RaiseAndSetIfChanged(ref _autoScrollToSelectedItem, value);
} }
public ReactiveCommand<Unit, Unit> AddItemCommand { get; } public MiniCommand AddItemCommand { get; }
public ReactiveCommand<Unit, Unit> RemoveItemCommand { get; } public MiniCommand RemoveItemCommand { get; }
public ReactiveCommand<Unit, Unit> SelectRandomItemCommand { get; } public MiniCommand SelectRandomItemCommand { get; }
private string GenerateItem() => $"Item {_counter++.ToString()}"; private string GenerateItem() => $"Item {_counter++.ToString()}";
} }

28
samples/ControlCatalog/ViewModels/MainWindowViewModel.cs

@ -5,11 +5,11 @@ using Avalonia.Controls.Notifications;
using Avalonia.Dialogs; using Avalonia.Dialogs;
using Avalonia.Platform; using Avalonia.Platform;
using System; using System;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
class MainWindowViewModel : ReactiveObject class MainWindowViewModel : ViewModelBase
{ {
private IManagedNotificationManager _notificationManager; private IManagedNotificationManager _notificationManager;
@ -27,22 +27,22 @@ namespace ControlCatalog.ViewModels
{ {
_notificationManager = notificationManager; _notificationManager = notificationManager;
ShowCustomManagedNotificationCommand = ReactiveCommand.Create(() => ShowCustomManagedNotificationCommand = MiniCommand.Create(() =>
{ {
NotificationManager.Show(new NotificationViewModel(NotificationManager) { Title = "Hey There!", Message = "Did you know that Avalonia now supports Custom In-Window Notifications?" }); NotificationManager.Show(new NotificationViewModel(NotificationManager) { Title = "Hey There!", Message = "Did you know that Avalonia now supports Custom In-Window Notifications?" });
}); });
ShowManagedNotificationCommand = ReactiveCommand.Create(() => ShowManagedNotificationCommand = MiniCommand.Create(() =>
{ {
NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information)); NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information));
}); });
ShowNativeNotificationCommand = ReactiveCommand.Create(() => ShowNativeNotificationCommand = MiniCommand.Create(() =>
{ {
NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error)); NotificationManager.Show(new Avalonia.Controls.Notifications.Notification("Error", "Native Notifications are not quite ready. Coming soon.", NotificationType.Error));
}); });
AboutCommand = ReactiveCommand.CreateFromTask(async () => AboutCommand = MiniCommand.CreateFromTask(async () =>
{ {
var dialog = new AboutAvaloniaDialog(); var dialog = new AboutAvaloniaDialog();
@ -51,12 +51,12 @@ namespace ControlCatalog.ViewModels
await dialog.ShowDialog(mainWindow); await dialog.ShowDialog(mainWindow);
}); });
ExitCommand = ReactiveCommand.Create(() => ExitCommand = MiniCommand.Create(() =>
{ {
(App.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).Shutdown(); (App.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).Shutdown();
}); });
ToggleMenuItemCheckedCommand = ReactiveCommand.Create(() => ToggleMenuItemCheckedCommand = MiniCommand.Create(() =>
{ {
IsMenuItemChecked = !IsMenuItemChecked; IsMenuItemChecked = !IsMenuItemChecked;
}); });
@ -153,16 +153,16 @@ namespace ControlCatalog.ViewModels
set { this.RaiseAndSetIfChanged(ref _isMenuItemChecked, value); } set { this.RaiseAndSetIfChanged(ref _isMenuItemChecked, value); }
} }
public ReactiveCommand<Unit, Unit> ShowCustomManagedNotificationCommand { get; } public MiniCommand ShowCustomManagedNotificationCommand { get; }
public ReactiveCommand<Unit, Unit> ShowManagedNotificationCommand { get; } public MiniCommand ShowManagedNotificationCommand { get; }
public ReactiveCommand<Unit, Unit> ShowNativeNotificationCommand { get; } public MiniCommand ShowNativeNotificationCommand { get; }
public ReactiveCommand<Unit, Unit> AboutCommand { get; } public MiniCommand AboutCommand { get; }
public ReactiveCommand<Unit, Unit> ExitCommand { get; } public MiniCommand ExitCommand { get; }
public ReactiveCommand<Unit, Unit> ToggleMenuItemCheckedCommand { get; } public MiniCommand ToggleMenuItemCheckedCommand { get; }
} }
} }

14
samples/ControlCatalog/ViewModels/MenuPageViewModel.cs

@ -4,7 +4,7 @@ using System.Reactive.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.VisualTree; using Avalonia.VisualTree;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
@ -13,9 +13,9 @@ namespace ControlCatalog.ViewModels
public Control View { get; set; } public Control View { get; set; }
public MenuPageViewModel() public MenuPageViewModel()
{ {
OpenCommand = ReactiveCommand.CreateFromTask(Open); OpenCommand = MiniCommand.CreateFromTask(Open);
SaveCommand = ReactiveCommand.Create(Save, Observable.Return(false)); SaveCommand = MiniCommand.Create(Save);
OpenRecentCommand = ReactiveCommand.Create<string>(OpenRecent); OpenRecentCommand = MiniCommand.Create<string>(OpenRecent);
var recentItems = new[] var recentItems = new[]
{ {
@ -65,9 +65,9 @@ namespace ControlCatalog.ViewModels
public IReadOnlyList<MenuItemViewModel> MenuItems { get; set; } public IReadOnlyList<MenuItemViewModel> MenuItems { get; set; }
public IReadOnlyList<MenuItemViewModel> RecentItems { get; set; } public IReadOnlyList<MenuItemViewModel> RecentItems { get; set; }
public ReactiveCommand<Unit, Unit> OpenCommand { get; } public MiniCommand OpenCommand { get; }
public ReactiveCommand<Unit, Unit> SaveCommand { get; } public MiniCommand SaveCommand { get; }
public ReactiveCommand<string, Unit> OpenRecentCommand { get; } public MiniCommand OpenRecentCommand { get; }
public async Task Open() public async Task Open()
{ {

10
samples/ControlCatalog/ViewModels/NotificationViewModel.cs

@ -1,6 +1,6 @@
using System.Reactive; using System.Reactive;
using Avalonia.Controls.Notifications; using Avalonia.Controls.Notifications;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
@ -8,12 +8,12 @@ namespace ControlCatalog.ViewModels
{ {
public NotificationViewModel(INotificationManager manager) public NotificationViewModel(INotificationManager manager)
{ {
YesCommand = ReactiveCommand.Create(() => YesCommand = MiniCommand.Create(() =>
{ {
manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today.")); manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today."));
}); });
NoCommand = ReactiveCommand.Create(() => NoCommand = MiniCommand.Create(() =>
{ {
manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit...")); manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
}); });
@ -22,9 +22,9 @@ namespace ControlCatalog.ViewModels
public string Title { get; set; } public string Title { get; set; }
public string Message { get; set; } public string Message { get; set; }
public ReactiveCommand<Unit, Unit> YesCommand { get; } public MiniCommand YesCommand { get; }
public ReactiveCommand<Unit, Unit> NoCommand { get; } public MiniCommand NoCommand { get; }
} }
} }

4
samples/ControlCatalog/ViewModels/SplitViewPageViewModel.cs

@ -1,10 +1,10 @@
using System; using System;
using Avalonia.Controls; using Avalonia.Controls;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
public class SplitViewPageViewModel : ReactiveObject public class SplitViewPageViewModel : ViewModelBase
{ {
private bool _isLeft = true; private bool _isLeft = true;
private int _displayMode = 3; //CompactOverlay private int _displayMode = 3; //CompactOverlay

16
samples/ControlCatalog/ViewModels/TreeViewPageViewModel.cs

@ -3,11 +3,11 @@ using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Reactive; using System.Reactive;
using Avalonia.Controls; using Avalonia.Controls;
using ReactiveUI; using MiniMvvm;
namespace ControlCatalog.ViewModels namespace ControlCatalog.ViewModels
{ {
public class TreeViewPageViewModel : ReactiveObject public class TreeViewPageViewModel : ViewModelBase
{ {
private readonly Node _root; private readonly Node _root;
private SelectionMode _selectionMode; private SelectionMode _selectionMode;
@ -19,16 +19,16 @@ namespace ControlCatalog.ViewModels
Items = _root.Children; Items = _root.Children;
SelectedItems = new ObservableCollection<Node>(); SelectedItems = new ObservableCollection<Node>();
AddItemCommand = ReactiveCommand.Create(AddItem); AddItemCommand = MiniCommand.Create(AddItem);
RemoveItemCommand = ReactiveCommand.Create(RemoveItem); RemoveItemCommand = MiniCommand.Create(RemoveItem);
SelectRandomItemCommand = ReactiveCommand.Create(SelectRandomItem); SelectRandomItemCommand = MiniCommand.Create(SelectRandomItem);
} }
public ObservableCollection<Node> Items { get; } public ObservableCollection<Node> Items { get; }
public ObservableCollection<Node> SelectedItems { get; } public ObservableCollection<Node> SelectedItems { get; }
public ReactiveCommand<Unit, Unit> AddItemCommand { get; } public MiniCommand AddItemCommand { get; }
public ReactiveCommand<Unit, Unit> RemoveItemCommand { get; } public MiniCommand RemoveItemCommand { get; }
public ReactiveCommand<Unit, Unit> SelectRandomItemCommand { get; } public MiniCommand SelectRandomItemCommand { get; }
public SelectionMode SelectionMode public SelectionMode SelectionMode
{ {

66
samples/MiniMvvm/MiniCommand.cs

@ -0,0 +1,66 @@
using System;
using System.Threading.Tasks;
using System.Windows.Input;
namespace MiniMvvm
{
public sealed class MiniCommand<T> : MiniCommand, ICommand
{
private readonly Action<T> _cb;
private bool _busy;
private Func<T, Task> _acb;
public MiniCommand(Action<T> cb)
{
_cb = cb;
}
public MiniCommand(Func<T, Task> cb)
{
_acb = cb;
}
private bool Busy
{
get => _busy;
set
{
_busy = value;
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
}
}
public override event EventHandler CanExecuteChanged;
public override bool CanExecute(object parameter) => !_busy;
public override async void Execute(object parameter)
{
if(Busy)
return;
try
{
Busy = true;
if (_cb != null)
_cb((T)parameter);
else
await _acb((T)parameter);
}
finally
{
Busy = false;
}
}
}
public abstract class MiniCommand : ICommand
{
public static MiniCommand Create(Action cb) => new MiniCommand<object>(_ => cb());
public static MiniCommand Create<TArg>(Action<TArg> cb) => new MiniCommand<TArg>(cb);
public static MiniCommand CreateFromTask(Func<Task> cb) => new MiniCommand<object>(_ => cb());
public abstract bool CanExecute(object parameter);
public abstract void Execute(object parameter);
public abstract event EventHandler CanExecuteChanged;
}
}

6
samples/MiniMvvm/MiniMvvm.csproj

@ -0,0 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<Import Project="..\..\build\Rx.props" />
</Project>

108
samples/MiniMvvm/PropertyChangedExtensions.cs

@ -0,0 +1,108 @@
using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reactive.Linq;
using System.Reflection;
namespace MiniMvvm
{
public static class PropertyChangedExtensions
{
class PropertyObservable<T> : IObservable<T>
{
private readonly INotifyPropertyChanged _target;
private readonly PropertyInfo _info;
public PropertyObservable(INotifyPropertyChanged target, PropertyInfo info)
{
_target = target;
_info = info;
}
class Subscription : IDisposable
{
private readonly INotifyPropertyChanged _target;
private readonly PropertyInfo _info;
private readonly IObserver<T> _observer;
public Subscription(INotifyPropertyChanged target, PropertyInfo info, IObserver<T> observer)
{
_target = target;
_info = info;
_observer = observer;
_target.PropertyChanged += OnPropertyChanged;
_observer.OnNext((T)_info.GetValue(_target));
}
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == _info.Name)
_observer.OnNext((T)_info.GetValue(_target));
}
public void Dispose()
{
_target.PropertyChanged -= OnPropertyChanged;
_observer.OnCompleted();
}
}
public IDisposable Subscribe(IObserver<T> observer)
{
return new Subscription(_target, _info, observer);
}
}
public static IObservable<TRes> WhenAnyValue<TModel, TRes>(this TModel model,
Expression<Func<TModel, TRes>> expr) where TModel : INotifyPropertyChanged
{
var l = (LambdaExpression)expr;
var ma = (MemberExpression)l.Body;
var prop = (PropertyInfo)ma.Member;
return new PropertyObservable<TRes>(model, prop);
}
public static IObservable<TRes> WhenAnyValue<TModel, T1, TRes>(this TModel model,
Expression<Func<TModel, T1>> v1,
Func<T1, TRes> cb
) where TModel : INotifyPropertyChanged
{
return model.WhenAnyValue(v1).Select(cb);
}
public static IObservable<TRes> WhenAnyValue<TModel, T1, T2, TRes>(this TModel model,
Expression<Func<TModel, T1>> v1,
Expression<Func<TModel, T2>> v2,
Func<T1, T2, TRes> cb
) where TModel : INotifyPropertyChanged =>
Observable.CombineLatest(
model.WhenAnyValue(v1),
model.WhenAnyValue(v2),
cb);
public static IObservable<ValueTuple<T1, T2>> WhenAnyValue<TModel, T1, T2>(this TModel model,
Expression<Func<TModel, T1>> v1,
Expression<Func<TModel, T2>> v2
) where TModel : INotifyPropertyChanged =>
model.WhenAnyValue(v1, v2, (a1, a2) => (a1, a2));
public static IObservable<TRes> WhenAnyValue<TModel, T1, T2, T3, TRes>(this TModel model,
Expression<Func<TModel, T1>> v1,
Expression<Func<TModel, T2>> v2,
Expression<Func<TModel, T3>> v3,
Func<T1, T2, T3, TRes> cb
) where TModel : INotifyPropertyChanged =>
Observable.CombineLatest(
model.WhenAnyValue(v1),
model.WhenAnyValue(v2),
model.WhenAnyValue(v3),
cb);
public static IObservable<ValueTuple<T1, T2, T3>> WhenAnyValue<TModel, T1, T2, T3>(this TModel model,
Expression<Func<TModel, T1>> v1,
Expression<Func<TModel, T2>> v2,
Expression<Func<TModel, T3>> v3
) where TModel : INotifyPropertyChanged =>
model.WhenAnyValue(v1, v2, v3, (a1, a2, a3) => (a1, a2, a3));
}
}

26
samples/MiniMvvm/ViewModelBase.cs

@ -0,0 +1,26 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Reactive.Joins;
using System.Runtime.CompilerServices;
namespace MiniMvvm
{
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
field = value;
RaisePropertyChanged(propertyName);
return true;
}
return false;
}
protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

1
samples/Previewer/Previewer.csproj

@ -8,7 +8,6 @@
<DependentUpon>%(Filename)</DependentUpon> <DependentUpon>%(Filename)</DependentUpon>
</Compile> </Compile>
<EmbeddedResource Include="**\*.xaml" /> <EmbeddedResource Include="**\*.xaml" />
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\build\SampleApp.props" /> <Import Project="..\..\build\SampleApp.props" />

2
samples/RenderDemo/App.xaml.cs

@ -1,7 +1,6 @@
using Avalonia; using Avalonia;
using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
namespace RenderDemo namespace RenderDemo
{ {
@ -32,7 +31,6 @@ namespace RenderDemo
OverlayPopups = true, OverlayPopups = true,
}) })
.UsePlatformDetect() .UsePlatformDetect()
.UseReactiveUI()
.LogToTrace(); .LogToTrace();
} }
} }

2
samples/RenderDemo/MainWindow.xaml.cs

@ -3,7 +3,7 @@ using Avalonia;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Markup.Xaml; using Avalonia.Markup.Xaml;
using RenderDemo.ViewModels; using RenderDemo.ViewModels;
using ReactiveUI; using MiniMvvm;
namespace RenderDemo namespace RenderDemo
{ {

3
samples/RenderDemo/RenderDemo.csproj

@ -9,12 +9,11 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" />
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> <ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" />
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> <ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\build\SampleApp.props" /> <Import Project="..\..\build\SampleApp.props" />
<Import Project="..\..\build\EmbedXaml.props" /> <Import Project="..\..\build\EmbedXaml.props" />
<Import Project="..\..\build\Rx.props" /> <Import Project="..\..\build\Rx.props" />
<Import Project="..\..\build\ReactiveUI.props" />
<Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" /> <Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" />
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> <Import Project="..\..\build\ReferenceCoreLibraries.props" />
<Import Project="..\..\build\BuildTargets.targets" /> <Import Project="..\..\build\BuildTargets.targets" />

4
samples/RenderDemo/ViewModels/AnimationsPageViewModel.cs

@ -1,10 +1,10 @@
using System; using System;
using ReactiveUI; using MiniMvvm;
using Avalonia.Animation; using Avalonia.Animation;
namespace RenderDemo.ViewModels namespace RenderDemo.ViewModels
{ {
public class AnimationsPageViewModel : ReactiveObject public class AnimationsPageViewModel : ViewModelBase
{ {
private bool _isPlaying = true; private bool _isPlaying = true;

17
samples/RenderDemo/ViewModels/MainWindowViewModel.cs

@ -1,11 +1,10 @@
using System.Reactive; using System.Reactive;
using System.Threading.Tasks; using System.Threading.Tasks;
using MiniMvvm;
using ReactiveUI;
namespace RenderDemo.ViewModels namespace RenderDemo.ViewModels
{ {
public class MainWindowViewModel : ReactiveObject public class MainWindowViewModel : ViewModelBase
{ {
private bool drawDirtyRects = false; private bool drawDirtyRects = false;
private bool drawFps = true; private bool drawFps = true;
@ -14,9 +13,9 @@ namespace RenderDemo.ViewModels
public MainWindowViewModel() public MainWindowViewModel()
{ {
ToggleDrawDirtyRects = ReactiveCommand.Create(() => DrawDirtyRects = !DrawDirtyRects); ToggleDrawDirtyRects = MiniCommand.Create(() => DrawDirtyRects = !DrawDirtyRects);
ToggleDrawFps = ReactiveCommand.Create(() => DrawFps = !DrawFps); ToggleDrawFps = MiniCommand.Create(() => DrawFps = !DrawFps);
ResizeWindow = ReactiveCommand.CreateFromTask(ResizeWindowAsync); ResizeWindow = MiniCommand.CreateFromTask(ResizeWindowAsync);
} }
public bool DrawDirtyRects public bool DrawDirtyRects
@ -43,9 +42,9 @@ namespace RenderDemo.ViewModels
set => this.RaiseAndSetIfChanged(ref height, value); set => this.RaiseAndSetIfChanged(ref height, value);
} }
public ReactiveCommand<Unit, bool> ToggleDrawDirtyRects { get; } public MiniCommand ToggleDrawDirtyRects { get; }
public ReactiveCommand<Unit, bool> ToggleDrawFps { get; } public MiniCommand ToggleDrawFps { get; }
public ReactiveCommand<Unit, Unit> ResizeWindow { get; } public MiniCommand ResizeWindow { get; }
private async Task ResizeWindowAsync() private async Task ResizeWindowAsync()
{ {

2
samples/Sandbox/Program.cs

@ -1,5 +1,4 @@
using Avalonia; using Avalonia;
using Avalonia.ReactiveUI;
namespace Sandbox namespace Sandbox
{ {
@ -9,7 +8,6 @@ namespace Sandbox
{ {
AppBuilder.Configure<App>() AppBuilder.Configure<App>()
.UsePlatformDetect() .UsePlatformDetect()
.UseReactiveUI()
.LogToTrace() .LogToTrace()
.StartWithClassicDesktopLifetime(args); .StartWithClassicDesktopLifetime(args);
} }

1
samples/Sandbox/Sandbox.csproj

@ -8,7 +8,6 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" />
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Controls.DataGrid\Avalonia.Controls.DataGrid.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Controls.DataGrid\Avalonia.Controls.DataGrid.csproj" />
</ItemGroup> </ItemGroup>

2
samples/VirtualizationDemo/Program.cs

@ -1,5 +1,4 @@
using Avalonia; using Avalonia;
using Avalonia.ReactiveUI;
namespace VirtualizationDemo namespace VirtualizationDemo
{ {
@ -8,7 +7,6 @@ namespace VirtualizationDemo
public static AppBuilder BuildAvaloniaApp() public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>() => AppBuilder.Configure<App>()
.UsePlatformDetect() .UsePlatformDetect()
.UseReactiveUI()
.LogToTrace(); .LogToTrace();
public static int Main(string[] args) public static int Main(string[] args)

4
samples/VirtualizationDemo/ViewModels/ItemViewModel.cs

@ -1,9 +1,9 @@
using System; using System;
using ReactiveUI; using MiniMvvm;
namespace VirtualizationDemo.ViewModels namespace VirtualizationDemo.ViewModels
{ {
internal class ItemViewModel : ReactiveObject internal class ItemViewModel : ViewModelBase
{ {
private string _prefix; private string _prefix;
private int _index; private int _index;

24
samples/VirtualizationDemo/ViewModels/MainWindowViewModel.cs

@ -5,13 +5,13 @@ using System.Reactive;
using Avalonia.Collections; using Avalonia.Collections;
using Avalonia.Controls; using Avalonia.Controls;
using Avalonia.Controls.Primitives; using Avalonia.Controls.Primitives;
using ReactiveUI;
using Avalonia.Layout; using Avalonia.Layout;
using Avalonia.Controls.Selection; using Avalonia.Controls.Selection;
using MiniMvvm;
namespace VirtualizationDemo.ViewModels namespace VirtualizationDemo.ViewModels
{ {
internal class MainWindowViewModel : ReactiveObject internal class MainWindowViewModel : ViewModelBase
{ {
private int _itemCount = 200; private int _itemCount = 200;
private string _newItemString = "New Item"; private string _newItemString = "New Item";
@ -26,15 +26,15 @@ namespace VirtualizationDemo.ViewModels
public MainWindowViewModel() public MainWindowViewModel()
{ {
this.WhenAnyValue(x => x.ItemCount).Subscribe(ResizeItems); this.WhenAnyValue(x => x.ItemCount).Subscribe(ResizeItems);
RecreateCommand = ReactiveCommand.Create(() => Recreate()); RecreateCommand = MiniCommand.Create(() => Recreate());
AddItemCommand = ReactiveCommand.Create(() => AddItem()); AddItemCommand = MiniCommand.Create(() => AddItem());
RemoveItemCommand = ReactiveCommand.Create(() => Remove()); RemoveItemCommand = MiniCommand.Create(() => Remove());
SelectFirstCommand = ReactiveCommand.Create(() => SelectItem(0)); SelectFirstCommand = MiniCommand.Create(() => SelectItem(0));
SelectLastCommand = ReactiveCommand.Create(() => SelectItem(Items.Count - 1)); SelectLastCommand = MiniCommand.Create(() => SelectItem(Items.Count - 1));
} }
public string NewItemString public string NewItemString
@ -90,11 +90,11 @@ namespace VirtualizationDemo.ViewModels
public IEnumerable<ItemVirtualizationMode> VirtualizationModes => public IEnumerable<ItemVirtualizationMode> VirtualizationModes =>
Enum.GetValues(typeof(ItemVirtualizationMode)).Cast<ItemVirtualizationMode>(); Enum.GetValues(typeof(ItemVirtualizationMode)).Cast<ItemVirtualizationMode>();
public ReactiveCommand<Unit, Unit> AddItemCommand { get; private set; } public MiniCommand AddItemCommand { get; private set; }
public ReactiveCommand<Unit, Unit> RecreateCommand { get; private set; } public MiniCommand RecreateCommand { get; private set; }
public ReactiveCommand<Unit, Unit> RemoveItemCommand { get; private set; } public MiniCommand RemoveItemCommand { get; private set; }
public ReactiveCommand<Unit, Unit> SelectFirstCommand { get; private set; } public MiniCommand SelectFirstCommand { get; private set; }
public ReactiveCommand<Unit, Unit> SelectLastCommand { get; private set; } public MiniCommand SelectLastCommand { get; private set; }
public void RandomizeSize() public void RandomizeSize()
{ {

3
samples/VirtualizationDemo/VirtualizationDemo.csproj

@ -6,12 +6,11 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" /> <ProjectReference Include="..\..\src\Avalonia.Diagnostics\Avalonia.Diagnostics.csproj" />
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" /> <ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" />
<ProjectReference Include="..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" /> <ProjectReference Include="..\MiniMvvm\MiniMvvm.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\build\SampleApp.props" /> <Import Project="..\..\build\SampleApp.props" />
<Import Project="..\..\build\EmbedXaml.props" /> <Import Project="..\..\build\EmbedXaml.props" />
<Import Project="..\..\build\Rx.props" /> <Import Project="..\..\build\Rx.props" />
<Import Project="..\..\build\ReactiveUI.props" />
<Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" /> <Import Condition="'$(TargetFramework)'=='net461'" Project="..\..\build\NetFX.props" />
<Import Project="..\..\build\ReferenceCoreLibraries.props" /> <Import Project="..\..\build\ReferenceCoreLibraries.props" />
<Import Project="..\..\build\BuildTargets.targets" /> <Import Project="..\..\build\BuildTargets.targets" />

2
samples/interop/Direct3DInteropSample/Direct3DInteropSample.csproj

@ -22,9 +22,9 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj" />
<ProjectReference Include="..\..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" /> <ProjectReference Include="..\..\..\src\Windows\Avalonia.Direct2D1\Avalonia.Direct2D1.csproj" />
<ProjectReference Include="..\..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" /> <ProjectReference Include="..\..\..\src\Windows\Avalonia.Win32\Avalonia.Win32.csproj" />
<ProjectReference Include="..\..\MiniMvvm\MiniMvvm.csproj" />
</ItemGroup> </ItemGroup>
<Import Project="..\..\..\build\Rx.props" /> <Import Project="..\..\..\build\Rx.props" />
<Import Project="..\..\..\build\ReferenceCoreLibraries.props" /> <Import Project="..\..\..\build\ReferenceCoreLibraries.props" />

4
samples/interop/Direct3DInteropSample/MainWindowViewModel.cs

@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using ReactiveUI; using MiniMvvm;
namespace Direct3DInteropSample namespace Direct3DInteropSample
{ {
public class MainWindowViewModel : ReactiveObject public class MainWindowViewModel : ViewModelBase
{ {
private double _rotationX; private double _rotationX;

6
samples/interop/WindowsInteropTest/WindowsInteropTest.csproj

@ -136,10 +136,6 @@
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> <Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
<Name>Avalonia.Layout</Name> <Name>Avalonia.Layout</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj">
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project>
<Name>Avalonia.ReactiveUI</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj"> <ProjectReference Include="..\..\..\src\Avalonia.Visuals\Avalonia.Visuals.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> <Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Avalonia.Visuals</Name> <Name>Avalonia.Visuals</Name>
@ -190,4 +186,4 @@
<Import Project="..\..\..\build\Rx.props" /> <Import Project="..\..\..\build\Rx.props" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\..\..\build\LegacyProject.targets" /> <Import Project="..\..\..\build\LegacyProject.targets" />
</Project> </Project>

4
src/Android/Avalonia.AndroidTestApplication/Avalonia.AndroidTestApplication.csproj

@ -127,10 +127,6 @@
<Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project> <Project>{42472427-4774-4c81-8aff-9f27b8e31721}</Project>
<Name>Avalonia.Layout</Name> <Name>Avalonia.Layout</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\src\Avalonia.ReactiveUI\Avalonia.ReactiveUI.csproj">
<Project>{6417b24e-49c2-4985-8db2-3ab9d898ec91}</Project>
<Name>Avalonia.ReactiveUI</Name>
</ProjectReference>
<ProjectReference Include="..\..\Avalonia.Visuals\Avalonia.Visuals.csproj"> <ProjectReference Include="..\..\Avalonia.Visuals\Avalonia.Visuals.csproj">
<Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project> <Project>{eb582467-6abb-43a1-b052-e981ba910e3a}</Project>
<Name>Avalonia.Visuals</Name> <Name>Avalonia.Visuals</Name>

Loading…
Cancel
Save