Skip to content

Switch property change code generator #18

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
17 changes: 1 addition & 16 deletions AppBroker.Core/AppBroker.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,14 @@
<EnablePreviewFeatures>True</EnablePreviewFeatures>
<LangVersion>preview</LangVersion>
<GenerateRequiresPreviewFeaturesAttribute>False</GenerateRequiresPreviewFeaturesAttribute>

<!--<IncludePackageReferencesDuringMarkupCompilation>true</IncludePackageReferencesDuringMarkupCompilation>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>GeneratedFiles</CompilerGeneratedFilesOutputPath>-->
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2-beta1" />
<PackageReference Include="NonSucking.Framework.Serialization" Version="0.1.0.66-alpha" />
<PackageReference Include="System.Runtime.Experimental" Version="6.0.2" />
<ProjectReference Include="..\AppBroker.Generators\AppBroker.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>

<!--<ItemGroup>
<Folder Include="GeneratedFiles\AppBroker.Generators\" />
<Folder Include="GeneratedFiles\AppBroker.Generators\AppBroker.Generators.NotifyPropertyChangedGenerator\" />
</ItemGroup>-->

<!--<Target Name="RemoveSourceGeneratedFiles" BeforeTargets="BeforeBuild">
<ItemGroup>
<Compile Remove="GeneratedFiles\**" />
</ItemGroup>
</Target>-->

</Project>
24 changes: 14 additions & 10 deletions AppBroker.Core/Devices/Device.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using AppBroker.Core.DynamicUI;
using CommunityToolkit.Mvvm.ComponentModel;

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;

namespace AppBroker.Core.Devices;

public abstract class ConnectionDevice : Device
public abstract partial class ConnectionDevice : Device
{
[ObservableProperty]
private bool isConnected;

public abstract bool IsConnected { get; set; }
protected ConnectionDevice(long nodeId) : base(nodeId)
{
IsConnected = true;
Expand All @@ -18,21 +18,25 @@ protected ConnectionDevice(long nodeId) : base(nodeId)
public override void Reconnect(ByteLengthList parameter) => IsConnected = true;
}

public abstract class Device
public abstract partial class Device : ObservableObject
{
public IReadOnlyCollection<string> TypeNames { get; }

[JsonIgnore]
public List<Subscriber> Subscribers { get; } = new List<Subscriber>();

public abstract long Id { get; set; }
[ObservableProperty]
private long id;

public abstract string TypeName { get; set; }
[ObservableProperty]
private string typeName;

[JsonIgnore]
public abstract bool ShowInApp { get; set; }
[ObservableProperty]
private bool showInApp;

public abstract string FriendlyName { get; set; }
[ObservableProperty]
private string friendlyName;

[JsonIgnore]
public bool Initialized { get; set; }
Expand Down Expand Up @@ -77,6 +81,6 @@ public void SendDataToAllSubscribers()
sendLastDataTimer.Change(250, Timeout.Infinite);
}

public virtual void StopDevice() {}
public virtual void StopDevice() { }
public virtual void Reconnect(ByteLengthList parameter) { }
}
17 changes: 0 additions & 17 deletions AppBroker.Core/Devices/WorkflowDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,15 @@ namespace AppBroker.Core.Devices;



[ClassPropertyChangedAppbroker]
[RequiresPreviewFeatures]
public abstract partial class WorkflowDevice<TPropertySignaler, TDeviceSignaler> : ConnectionDevice
where TPropertySignaler : IWorkflowPropertySignaler
where TDeviceSignaler : IWorkflowDeviceSignaler
{
[AddOverride]
private long id;
[AddOverride]
private string typeName;
[AddOverride]
private bool showInApp;
[AddOverride]
private string friendlyName;
[AddOverride]
private bool isConnected;

public WorkflowDevice(long nodeId) : base(nodeId)
{
Initialized = false;
id = nodeId;
typeName = GetType().Name;
isConnected = true;
Logger = NLog.LogManager.GetCurrentClassLogger();
Logger = Logger.WithProperty(nameof(Id), Id);
friendlyName = "";
}

protected virtual void OnPropertyChanging<T>(ref T field, T value, [CallerMemberName] string? propertyName = "")
Expand Down
34 changes: 0 additions & 34 deletions AppBroker.Generators.Test/AppBroker.Generators.Test.csproj

This file was deleted.

83 changes: 0 additions & 83 deletions AppBroker.Generators.Test/GeneratorStartTest.cs

This file was deleted.

49 changes: 0 additions & 49 deletions AppBroker.Generators/AppBroker.Generators.csproj

This file was deleted.

Loading