|
|
@ -27,12 +27,17 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
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; |
|
|
@ -40,7 +45,16 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
|
|
|
|
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) |
|
|
|