using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using SlnMesnac.Config;
using SlnMesnac.Extensions;
using SlnMesnac.Serilog;
using SlnMesnac.WPF.Attribute;
using SlnMesnac.WPF.Page.IndexPage;
using System;
using System.Windows;

namespace SlnMesnac.WPF.ViewModel
{
    [RegisterAsSingletonAttribute]
    public class MainWindowViewModel: ViewModelBase
    {
        private readonly SerilogHelper _logger;
        private ProductionLineUserControl indexContent = new ProductionLineUserControl();
        private AppConfig _appConfig;

        public static Action ReturnHomeAction;
      
        public System.Windows.Controls.UserControl _content;

        public System.Windows.Controls.UserControl UserContent
        {
            get { return _content; }

            set
            {
                _content = value;
                RaisePropertyChanged(nameof(UserContent));
            }
        }

        #region 事件定义
        /// <summary>
        /// 界面跳转按钮事件
        /// </summary>
        public RelayCommand<object> ControlOnClickCommand { get; set; }

        /// <summary>
        /// 窗体控制
        /// </summary>
        public RelayCommand<object> FormControlCommand { get; set; }
        #endregion
        public MainWindowViewModel()
        { 
            _appConfig = App.ServiceProvider.GetService<AppConfig>();
            _logger = App.ServiceProvider.GetRequiredService<SerilogHelper>();
            UserContent = indexContent;
            ReturnHomeAction = () => UserContent = indexContent;
        }

    }
}
