Avalonia Start
This commit is contained in:
24
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/Utils/BaseViewModel.cs
Normal file
24
LaDOSE.Src/LaDOSE.DesktopApp.Avalonia/Utils/BaseViewModel.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Avalonia.Utils;
|
||||
|
||||
public abstract class BaseViewModel : ReactiveObject, IRoutableViewModel,INotifyPropertyChanged
|
||||
{
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected void RaisePropertyChanged([CallerMemberName] string? propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
protected BaseViewModel(IScreen hostScreen, string? urlPathSegment)
|
||||
{
|
||||
UrlPathSegment = urlPathSegment;
|
||||
HostScreen = hostScreen;
|
||||
}
|
||||
|
||||
public string? UrlPathSegment { get; }
|
||||
public IScreen HostScreen { get; }
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace LaDOSE.DesktopApp.Avalonia.Utils
|
||||
{
|
||||
public static class CustomListExtension
|
||||
{
|
||||
public sealed class EqualityComparer<T> : IEqualityComparer<T> where T : class
|
||||
{
|
||||
private readonly Func<T, T, bool> _compare;
|
||||
|
||||
public EqualityComparer(Func<T, T, bool> c)
|
||||
{
|
||||
_compare = c;
|
||||
}
|
||||
|
||||
public bool Equals(T x, T y)
|
||||
{
|
||||
return _compare(x, y);
|
||||
}
|
||||
|
||||
public int GetHashCode(T obj)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user