|
|
|
using SkiaSharp;
|
|
|
|
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Data;
|
|
|
|
using System.Linq;
|
|
|
|
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 static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// MachinesSet.xaml 的交互逻辑
|
|
|
|
/// </summary>
|
|
|
|
public partial class MachinesSet : UserControl
|
|
|
|
{
|
|
|
|
public MachinesSet()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
// 获取所有可用串口端口,并添加到comboBoxCOM
|
|
|
|
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
|
|
|
|
comboBoxCOM0.ItemsSource = ports;
|
|
|
|
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM");
|
|
|
|
}
|
|
|
|
|
|
|
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
|
|
|
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\SCCM.db"; //数据库路径
|
|
|
|
private readonly UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
|
|
|
|
private string SYS_machines = null;
|
|
|
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
Griddata.ItemsSource = MainWindowViewModel.Machines.DefaultView;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Griddata_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
|
|
{
|
|
|
|
int rownum = Griddata.SelectedIndex;//获取鼠标选中行并定义变量
|
|
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
|
|
{
|
|
|
|
comboBoxMachine.Text = (Griddata.Columns[1].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
|
|
TextMachineGroup.Text = (Griddata.Columns[2].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
|
|
|
IP.Text = (Griddata.Columns[3].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
|
|
|
PORT.Text = (Griddata.Columns[4].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
|
|
|
comboBoxCOM0.Text = (Griddata.Columns[5].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
|
|
|
BAUD.Text = (Griddata.Columns[6].GetCellContent(Griddata.Items[rownum]) as TextBlock).Text;//定位第列,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void Save_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
private void Delete_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
private void Test_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|