//using BPA.Message.Kafka;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Concurrent;
using System.Threading;
using BPA.Message;
using System.Windows;
using Microsoft.Toolkit.Mvvm.Input;
using System.Reflection;
using HBLConsole.Service;
using HBLConsole.GVL;
using HBLConsole.Model;

namespace HBLConsole.ViewModel
{
    internal class MainViewModel : ViewModelBase
    {
        public MainViewModel()
        {
            DoNavChanged("MessageLogView");
            NavChangedCommand = new RelayCommand<object>(DoNavChanged);
            ThreadOperate.GetInstance.StartLong(new Action(() =>
            {
                InternetInfo.NetworkConnectState = UniversalHelper.GetInstance.GetNetworkState();
                NetworkConnectState = InternetInfo.NetworkConnectState;
                OrderCount = Json<MorkOrderPushPar>.Data.morkOrderPushes.Count;
                Thread.Sleep(1000);
            }), "界面状态监控");
        }


        #region Command
        public RelayCommand<object> NavChangedCommand { get; set; }
        #endregion

        #region 导航栏界面切换
        private void DoNavChanged(object obj)
        {
            Type type = Type.GetType($"HBLConsole.View.{obj.ToString()}");
            //if (type != null)
            //{
            ConstructorInfo cti = type?.GetConstructor(Type.EmptyTypes);
            MainContent = (FrameworkElement)cti?.Invoke(null);
            //WinNameDisplay = WinNameVisible(obj.ToString());
            //}

        }
        #endregion 

    }
}
