using CommunityToolkit.Mvvm.Input;
using MegaRobo.C00225155App.DevicesViews;
using MegaRobo.Contract;
using MegaRobo.WpfInfrastructure.Abstractions;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Input;

namespace MegaRobo.C00225155App.MenuViewModels
{
    public class MenuItems : INotifyPropertyChanged
    {
        private string _header;
        private string _iconSource;
        private ICommand _command;

        public string Header
        {
            get => _header;
            set
            {
                if (_header != value)
                {
                    _header = value;
                    OnPropertyChanged(nameof(Header));
                }
            }
        }

        public string IconSource
        {
            get => _iconSource;
            set
            {
                if (_iconSource != value)
                {
                    _iconSource = value;
                    OnPropertyChanged(nameof(IconSource));
                }
            }
        }

        public ICommand Command
        {
            get => _command;
            set
            {
                if (_command != value)
                {
                    _command = value;
                    OnPropertyChanged(nameof(Command));
                }
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
    }

    public class HardwareDevicesDebugViewModel : ViewModelBaseEx
    {
        private object _selectedMenuItem;

        public object SelectedMenuItem
        {
            get => _selectedMenuItem;
            set
            {
                if (_selectedMenuItem != value)
                {
                    _selectedMenuItem = value;
                    OnPropertyChanged(nameof(SelectedMenuItem));
                }
            }
        }

        public IList<MenuItems> MenuItemLists { get; set; }

        public override void Initialize(ICoreService coreService, string title, params object[] args)
        {
            base.Initialize(coreService, title, args);
        }

        protected override void LoadServices()
        {
            base.LoadServices();
            LoadMenu();
        }

        private void LoadMenu()
        {
            MenuItemLists = new List<MenuItems>()
            {
                //new MenuItems()
                //{
                //    Header = "移液枪",
                //    IconSource ="/DataBox;component/管理.png",
                //    Command = new RelayCommand(() =>
                //    {
                //        SelectedMenuItem=new HamiltonDebugView();
                //    })
                //},

                 new MenuItems()
                {
                    Header = "普瑞逊TS02称重",
                    IconSource ="/DataBox;component/管理.png",
                    Command = new RelayCommand(() =>
                    {
                        SelectedMenuItem=new Weight_TS02_View();
                    })
                },

                //   new MenuItems()
                //{
                //    Header = "高温震荡",
                //    IconSource ="/DataBox;component/管理.png",
                //    Command = new RelayCommand(() =>
                //    {
                //        SelectedMenuItem=new HighTemperatureShakeView();
                //    })
                //},

                //new MenuItems()
                //{
                //    Header = "低温磁力搅拌",
                //    IconSource ="/DataBox;component/管理.png",
                //    Command = new RelayCommand(() =>
                //    {
                //        SelectedMenuItem=new LowTemperatureMagneticStirView();
                //    })
                //},

               new MenuItems()
               {
                    Header="Labx",
                    IconSource="",
                    Command=new RelayCommand(() =>
                    {
                        SelectedMenuItem=new LabXToolView();
                    })
               },

            };
        }

    }
}
