/*
   绑定视图：MainPopupBox.xaml
   文件说明：自定义工具栏业务层
*/

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Messaging;
using MWSDomain.ViewDialog.Step;
using System.Collections.ObjectModel;

namespace MWSDomain.ViewModel.Step
{
    /// <summary>
    /// 辅助窗口
    /// </summary>
    public class PopBoxViewModel : ViewModelBase
    {
        public PopBoxViewModel()
        {
            pupBoxModelsl = new ObservableCollection<PupBoxModel>();
            this.GetBoxModels();
        }

        #region 功能集合

        /// <summary>
        /// 获取默认定义
        /// </summary>
        private void GetBoxModels()
        {
            pupBoxModelsl.Add(new PupBoxModel() { KindName = "Settings", Name = "系统设置", ApplyCommand = this.StepCommand });
            pupBoxModelsl.Add(new PupBoxModel() { KindName = "CommentMultipleOutline", Name = "消息通知", ApplyCommand = this.NoticeCommand });
        }

        private ObservableCollection<PupBoxModel> pupBoxModelsl;

        public ObservableCollection<PupBoxModel> PupBoxModels
        {
            get { return pupBoxModelsl; }
        }

        #endregion 功能集合

        #region ICommand

        public RelayCommand StepCommand { get; } = new RelayCommand(() => Step());

        public RelayCommand NoticeCommand { get; } = new RelayCommand(() => OpenNotice());

        #endregion ICommand

        #region ICommand 实现

        public static void Min()
        {
            Messenger.Default.Send("", "MinWindow");
        }

        /// <summary>
        /// 系统设置
        /// </summary>
        private static void Step()
        {
        }

        /// <summary>
        /// 消息通知
        /// </summary>
        public static async void OpenNotice()
        {
            NoticeViewModel view = new NoticeViewModel();
            var Dialog = new NoticeViewDlg();
            Dialog.BindViewModel(view);
            await Dialog.ShowDialog(null, null);
        }

        #endregion ICommand 实现
    }

    /// <summary>
    /// 首页辅助弹出窗口功能定义
    /// </summary>
    public class PupBoxModel : ViewModelBase
    {
        private string kindName;
        private string name;

        /// <summary>
        /// 字体代码[显示LOGO]
        /// </summary>
        public string KindName
        {
            get { return kindName; }
            set { kindName = value; RaisePropertyChanged(); }
        }

        /// <summary>
        /// 功能名称
        /// </summary>
        public string Name
        {
            get { return name; }
            set
            {
                name = value; RaisePropertyChanged();
            }
        }

        public RelayCommand ApplyCommand { get; set; }
    }
}