using Caliburn.Micro;
using SFMVVM.EventModels;
using SFMVVM.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Input;

namespace SFMVVM.ViewModels
{
    public class ShellViewModel : Conductor<object>, INotifyPropertyChanged, IShellViewModel
    {
        private IEventAggregator _events;
        private PropertyGridViewModel _propertyGridViewModel;

        public ShellViewModel(IEventAggregator events, PropertyGridViewModel propertyGridViewModel)
        {
            _events = events;
            _propertyGridViewModel = propertyGridViewModel;
            _events.SubscribeOnPublishedThread(this);
        }

        //public ICommand DemoButton_Click
        //{
        //    get => new CommandHandler(true, () => _events.PublishOnUIThreadAsync(new RibbonBttnClick_DemoButton(), new CancellationToken()));
        //}

        public ICommand DemoButton_Click
        {
            get
            {
                ActivateItemAsync(_propertyGridViewModel, new CancellationToken());
                var output = new CommandHandler(true, () => _events.PublishOnUIThreadAsync(new RibbonBttnClick_DemoButton(), new CancellationToken()));
                return output;
            }
             
        }

    }
}
