Skip to content

Remove InternalsVisibleTo from Avalonia.Base to ControlCatalog #14905

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

Merged
merged 1 commit into from
Mar 10, 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
17 changes: 9 additions & 8 deletions samples/MiniMvvm/MiniCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace MiniMvvm
{
public sealed class MiniCommand<T> : MiniCommand, ICommand
{
private readonly Action<T> _cb;
private readonly Action<T>? _cb;
private readonly Func<T, Task>? _acb;
private bool _busy;
private Func<T, Task> _acb;


public MiniCommand(Action<T> cb)
{
_cb = cb;
Expand All @@ -31,20 +31,21 @@ private bool Busy
}


public override event EventHandler CanExecuteChanged;
public override bool CanExecute(object parameter) => !_busy;
public override event EventHandler? CanExecuteChanged;

public override bool CanExecute(object? parameter) => !_busy;

public override async void Execute(object parameter)
public override async void Execute(object? parameter)
{
if(Busy)
return;
try
{
Busy = true;
if (_cb != null)
_cb((T)parameter);
_cb((T)parameter!);
else
await _acb((T)parameter);
await _acb!((T)parameter!);
}
finally
{
Expand Down
10 changes: 9 additions & 1 deletion samples/MiniMvvm/MiniMvvm.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Base\Avalonia.Base.csproj" />
<ProjectReference Include="../../src/Avalonia.Base/Avalonia.Base.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Include="../../src/Avalonia.Base/Reactive/**/*.cs" Exclude="../../src/Avalonia.Base/Reactive/AnonymousObserver.cs" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions samples/MiniMvvm/ViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ namespace MiniMvvm
{
public class ViewModelBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName] string propertyName = null)
public event PropertyChangedEventHandler? PropertyChanged;

protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
{
if (!EqualityComparer<T>.Default.Equals(field, value))
{
Expand All @@ -17,9 +18,8 @@ protected bool RaiseAndSetIfChanged<T>(ref T field, T value, [CallerMemberName]
}
return false;
}


protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)

protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
2 changes: 0 additions & 2 deletions src/Avalonia.Base/Avalonia.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@
<InternalsVisibleTo Include="Avalonia.Dialogs, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.Diagnostics, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="Avalonia.LinuxFramebuffer, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="MiniMvvm, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="ControlCatalog, PublicKey=$(AvaloniaPublicKey)" />
<InternalsVisibleTo Include="DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7" />
</ItemGroup>

Expand Down