using _20230724_MBJC_upperpc.Common;
using _20230724_MBJC_upperpc.Models;
using _20230724_MBJC_upperpc.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.Intrinsics.X86;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace _20230724_MBJC_upperpc.ViewModels
{
public class MainViewModel : NotifyBase
{
#region 事件
///
/// 主界面标签切换事件
///
public CommandBase NavChangedCommand { get; set; }
string Title_Name = ""; //设置当前显示的标题 1 浮标 2 接驳盒 3 系统控制 4 日志记录
#endregion
private FrameworkElement _pageContent;
public FrameworkElement PageContent
{
get { return _pageContent; }
set { _pageContent = value; this.DoNotify(); }
}
#region
private int myVar;
public int MyProperty
{
get { return myVar; }
set { myVar = value; }
}
private BeaconViewModel beacon1 = new BeaconViewModel();
public BeaconViewModel Beacon1
{
get { return beacon1; }
set { beacon1 = value; this.DoNotify(); }
}
public BeaconViewModel beacon2 = new BeaconViewModel();
public BeaconViewModel beacon3 = new BeaconViewModel();
public BeaconViewModel beacon4 = new BeaconViewModel();
public BeaconViewModel beacon5 = new BeaconViewModel();
public BeaconViewModel beacon6 = new BeaconViewModel();
public BeaconViewModel beacon7 = new BeaconViewModel() { Model_Visibility = 2 };
public BeaconViewModel beacon8 = new BeaconViewModel() { Model_Visibility = 2 };
#endregion
private ClientModel client = new ClientModel();
///
/// 连接基阵上位机软件的客户端
///
public ClientModel Client
{
get { return client; }
set { client = value; this.DoNotify(); }
}
///
/// 连接基阵上位机软件客户端的ip和端口号
///
public SocketInfo socketInfo = new SocketInfo()
{
IP = tools.GetAppSetting("BasicIP"),
Port = int.Parse(tools.GetAppSetting("BasicPort")),
};
//基阵客户端连接和断开的操作
public CommandBase ConnectCommand { get; set; }
public MainViewModel()
{
//进行与基阵上位机软件连接
Client.DoConnect(socketInfo);
this.NavChangedCommand = new CommandBase();
this.NavChangedCommand.DoExcute = new Action