using LiveChartsCore.Geo;
using SkiaSharp;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using SunlightCentralizedControlManagement_SCCM_.WindowsView;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using System.Xml.Linq;
using TouchSocket.Core;
using TouchSocket.Sockets;
using VncSharpWpf;
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
using static System.Net.WebRequestMethods;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
namespace SunlightCentralizedControlManagement_SCCM_.View
{
///
/// MonitorView.xaml 的交互逻辑
///
public partial class MonitorView : UserControl, INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
if (propertyName != null)
{
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
public MonitorView()
{
DataContext = this;
InitializeComponent();
CountDown();
machine= MainWindowViewModel.machine;
workOrder= MainWindowViewModel.workOrder;
dyelot= MainWindowViewModel.dyelot;
machin_LOG.Text = MainWindowViewModel.machin_LOG;
IsInteractive = false;
DATA_view();
}
private string machine;
private string workOrder;
private string dyelot;
private int machines_info=0;
public static string Sys_log;
public static DataTable Product_DAT = new DataTable();
public static bool Product_bool = false;
private void Griddata_SelectionChanged(object sender, SelectionChangedEventArgs e)//设备列表
{
if (rdp.IsConnected) rdp.Disconnect();
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
string mac_s = "800";
if (rownum != -1)//判断鼠标定位是否有效
{
mac_s = (Griddata.Columns[0].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
}
else { return; }
if ((mac_s != "800") && (mac_s != "801") && (mac_s != "802"))
{
Stop.IsHitTestVisible = true;
Paused.IsHitTestVisible = true;
Insert.IsHitTestVisible = false;
edit.IsHitTestVisible = false;
Resume.IsHitTestVisible = false;
Delete.IsHitTestVisible = false;
Jump.IsHitTestVisible = false;
DyeingMachine.IsHitTestVisible = true;
Curve.IsHitTestVisible = true;
Screen.IsHitTestVisible = true;
Receipt.IsHitTestVisible = true;
TechnologicalProcess_bool = true;
IsInteractive = false;
if (rownum != -1)//判断鼠标定位是否有效
{
machine = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
workOrder = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
dyelot = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
MainWindowViewModel.machine = machine;
MainWindowViewModel.workOrder = workOrder;
MainWindowViewModel.dyelot = dyelot;
MainWindowViewModel.machin_LOG = Properties.Resources.Machine + ":" + machine + " " + Properties.Resources.WorkOrder + ":" + workOrder;
machin_LOG.Text = MainWindowViewModel.machin_LOG;
}
}
else
{
MessageBox.Show(Properties.Resources.TMNR, "800", MessageBoxButton.OK, MessageBoxImage.Information); //
}
}
private void Gridstep_SelectionChanged(object sender, SelectionChangedEventArgs e)//步骤定位
{
TechnologicalProcess_bool = false;
int rownum = Gridstep.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
ID = (Gridstep.Columns[2].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第0列,
Numder = (Gridstep.Columns[3].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第1列,
P1 = (Gridstep.Columns[6].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第6列,
P2 = (Gridstep.Columns[7].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第7列,
P3 = (Gridstep.Columns[8].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第8列,
P4 = (Gridstep.Columns[9].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第9列,
P5 = (Gridstep.Columns[10].GetCellContent(Gridstep.Items[rownum]) as TextBlock).Text;//定位第10列,
}
}
private void MenuItem_LOCK_XML(object sender, RoutedEventArgs e)
{
if (!string.IsNullOrEmpty(machine))
{
bool mode = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First().Field("LOCK");
Dictionary dat_ = new Dictionary();
dat_.Clear();
if (!mode)
{
dat_.Add("NAME", "LOCK");
dat_.Add("VALUE", "True");
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "True");
}
else
{
dat_.Add("NAME", "LOCK");
dat_.Add("VALUE", "False");
MainWindowViewModel.Updata_Machines(MainWindowViewModel.Machines, "LOCK", "Name='" + machine + "'", "False");
}
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First();
int index = Convert.ToInt16(drEmployee.Field