Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Reactive generator #18

Merged
merged 3 commits into from
Dec 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<VersionPrefix>11.2.0.1</VersionPrefix>
<VersionPrefix>11.2.0.2</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Authors>Wiesław Šoltés</Authors>
<Company>Wiesław Šoltés</Company>
Expand All @@ -11,7 +11,7 @@
</PropertyGroup>
<PropertyGroup>
<AnalysisLevel>latest</AnalysisLevel>
<LangVersion>latest</LangVersion>
<LangVersion>13</LangVersion>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ resources:
variables:
BuildConfiguration: 'Release'
BuildPlatform: 'Any CPU'
PublishFramework: 'net8.0'
PublishFramework: 'net9.0'
PublishProject: 'BehaviorsTestApplication'
PublishRuntime: ''

Expand Down
2 changes: 1 addition & 1 deletion build/build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<IsPackable>False</IsPackable>
<NoWarn>CS0649;CS0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "9.0.100",
"rollForward": "latestMinor",
"allowPrerelease": true
}
Expand Down
16 changes: 15 additions & 1 deletion samples/BehaviorsTestApplication/BehaviorsTestApplication.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,34 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IsPackable>False</IsPackable>
<Nullable>enable</Nullable>
<PublishAot>true</PublishAot>
</PropertyGroup>

<PropertyGroup>
<UseBackingFields>true</UseBackingFields>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath>
</PropertyGroup>

<PropertyGroup>
<UseBackingFields>true</UseBackingFields>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" />
<PackageReference Include="Avalonia.Desktop" />
<PackageReference Include="Avalonia.Diagnostics" Condition="'$(Configuration)' == 'Debug'" />
<PackageReference Include="Avalonia.Themes.Fluent" />
<PackageReference Include="Avalonia.Fonts.Inter" />
<PackageReference Include="Avalonia.ReactiveUI" />
<PackageReference Include="ReactiveGenerator">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down
21 changes: 8 additions & 13 deletions samples/BehaviorsTestApplication/ViewModels/ItemViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
using System.Collections.ObjectModel;
using ReactiveUI;

namespace BehaviorsTestApplication.ViewModels;

public class ItemViewModel(string value) : ViewModelBase
public partial class ItemViewModel : ViewModelBase
{
private ObservableCollection<ItemViewModel>? _items;
private string? _value = value;

public string? Value
public ItemViewModel(string value)
{
get => _value;
set => this.RaiseAndSetIfChanged(ref _value, value);
_value = value;
}

public ObservableCollection<ItemViewModel>? Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
[Reactive]
public partial string? Value { get; set; }

[Reactive]
public partial ObservableCollection<ItemViewModel>? Items { get; set; }

public override string ToString() => _value ?? string.Empty;
}
26 changes: 7 additions & 19 deletions samples/BehaviorsTestApplication/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,18 @@

namespace BehaviorsTestApplication.ViewModels;

public class MainWindowViewModel : ViewModelBase
public partial class MainWindowViewModel : ViewModelBase
{
private int _value;
private int _count;
private double _position;
private ObservableCollection<ItemViewModel>? _items;

public int Count
{
get => _count;
set => this.RaiseAndSetIfChanged(ref _count, value);
}
[Reactive]
public partial int Count { get; set; }

public double Position
{
get => _position;
set => this.RaiseAndSetIfChanged(ref _position, value);
}
[Reactive]
public partial double Position { get; set; }

public ObservableCollection<ItemViewModel>? Items
{
get => _items;
set => this.RaiseAndSetIfChanged(ref _items, value);
}
[Reactive]
public partial ObservableCollection<ItemViewModel>? Items { get; set; }

public IObservable<int> Values { get; }

Expand Down
3 changes: 2 additions & 1 deletion samples/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
<PackageVersion Include="Avalonia.Fonts.Inter" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Browser" Version="$(AvaloniaVersion)" />
<PackageVersion Include="Avalonia.Headless.XUnit" Version="$(AvaloniaVersion)" />
<PackageVersion Include="ReactiveGenerator" Version="0.9.3" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="System.Reactive" Version="6.0.0" />
</ItemGroup>
</Project>
</Project>
2 changes: 1 addition & 1 deletion samples/DragAndDropSample/DragAndDropSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IsPackable>False</IsPackable>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion samples/DraggableDemo/DraggableDemo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<IsPackable>False</IsPackable>
<Nullable>enable</Nullable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<GenerateRuntimeConfigurationFiles>True</GenerateRuntimeConfigurationFiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Library</OutputType>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
<GenerateRuntimeConfigurationFiles>True</GenerateRuntimeConfigurationFiles>
Expand Down
Loading