39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
using CORP_MAUI.Models;
|
|
|
|
namespace CORP_MAUI.ViewModels;
|
|
|
|
public class PostDetailsViewModel : INotifyPropertyChanged
|
|
{
|
|
public PostViewModel PostViewModel { get; }
|
|
public ObservableCollection<Comment> Comments { get; } = new();
|
|
|
|
private bool _isLoadingComments;
|
|
public bool IsLoadingComments
|
|
{
|
|
get => _isLoadingComments;
|
|
set
|
|
{
|
|
_isLoadingComments = value;
|
|
OnPropertyChanged();
|
|
OnPropertyChanged(nameof(IsNotLoadingComments));
|
|
}
|
|
}
|
|
|
|
public bool IsNotLoadingComments => !_isLoadingComments;
|
|
|
|
public PostDetailsViewModel(PostViewModel postViewModel)
|
|
{
|
|
PostViewModel = postViewModel;
|
|
}
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|