56 lines
2.1 KiB
C#
56 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
using YouTubeViewers.WPF.Commands;
|
|
using YouTubeViewers.WPF.Stores;
|
|
|
|
namespace YouTubeViewers.WPF.ViewModels
|
|
{
|
|
public class YouTubeViewersViewModel : ViewModelBase
|
|
{
|
|
public YouTubeViewersListingViewModel YouTubeViewersListingViewModel { get; }
|
|
public YouTubeViewersDetailsViewModel YouTubeViewersDetailsViewModel { get; }
|
|
|
|
|
|
private bool _IsLoading;
|
|
public bool IsLoading
|
|
{
|
|
get
|
|
{
|
|
return _IsLoading;
|
|
}
|
|
set
|
|
{
|
|
_IsLoading = value;
|
|
OnPropertyChanged(nameof(IsLoading));
|
|
}
|
|
}
|
|
|
|
public ICommand LoadYouTubeViewersCommand { get; }
|
|
public ICommand AddYouTubeViewersCommand { get; }
|
|
public YouTubeViewersViewModel(YouTubeViewersStore youTubeViewersStore, SelectedYouTubeViewerStore _selectedYouTubeViewerStore, ModalNavigationStore modalNavigationStore)
|
|
{
|
|
|
|
YouTubeViewersListingViewModel = new YouTubeViewersListingViewModel(youTubeViewersStore, _selectedYouTubeViewerStore, modalNavigationStore);
|
|
YouTubeViewersDetailsViewModel = new YouTubeViewersDetailsViewModel(_selectedYouTubeViewerStore);
|
|
LoadYouTubeViewersCommand = new LoadYouTubeViewersCommand(this,youTubeViewersStore);
|
|
AddYouTubeViewersCommand = new OpenAddYouTubeViewerCommand(youTubeViewersStore, modalNavigationStore);
|
|
}
|
|
|
|
public static YouTubeViewersViewModel LoadViewModel(
|
|
YouTubeViewersStore youTubeViewersStore,
|
|
SelectedYouTubeViewerStore selectedYouTubeViewerStore,
|
|
ModalNavigationStore modalNavigationStore)
|
|
{
|
|
YouTubeViewersViewModel viewModel = new YouTubeViewersViewModel(youTubeViewersStore, selectedYouTubeViewerStore, modalNavigationStore);
|
|
|
|
viewModel.LoadYouTubeViewersCommand.Execute(null);
|
|
|
|
return viewModel;
|
|
}
|
|
}
|
|
}
|