2024-10-07 15:15:18 +08:00
|
|
|
|
|
2024-09-30 22:20:02 +08:00
|
|
|
|
using Net462DllTest.Signal;
|
|
|
|
|
|
using Net462DllTest.ViewModel;
|
2024-09-30 02:45:49 +08:00
|
|
|
|
using Serein.Library.Api;
|
2024-09-27 10:30:19 +08:00
|
|
|
|
using Serein.Library.Attributes;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
2024-09-30 22:20:02 +08:00
|
|
|
|
namespace Net462DllTest
|
2024-09-27 10:30:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
public partial class FromWorkBenchView : Form
|
|
|
|
|
|
{
|
2024-09-30 02:45:49 +08:00
|
|
|
|
private FromWorkBenchViewModel ViewModel;
|
|
|
|
|
|
|
2024-10-07 15:15:18 +08:00
|
|
|
|
|
2024-09-30 02:45:49 +08:00
|
|
|
|
public FromWorkBenchView(IFlowEnvironment env)
|
2024-09-27 10:30:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
2024-10-10 10:45:53 +08:00
|
|
|
|
ViewModel = env.IOC.Get<FromWorkBenchViewModel>();
|
|
|
|
|
|
if (ViewModel is null)
|
2024-09-27 10:30:19 +08:00
|
|
|
|
{
|
2024-10-07 15:15:18 +08:00
|
|
|
|
Console.WriteLine("创建对象并注入依赖项");
|
|
|
|
|
|
ViewModel = env.IOC.Instantiate<FromWorkBenchViewModel>();
|
2024-09-27 10:30:19 +08:00
|
|
|
|
}
|
2024-10-07 15:15:18 +08:00
|
|
|
|
BindData();
|
2024-09-27 10:30:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-07 15:15:18 +08:00
|
|
|
|
private void BindData()
|
2024-09-27 10:30:19 +08:00
|
|
|
|
{
|
2024-10-07 15:15:18 +08:00
|
|
|
|
textBoxPlcInfo.DataBindings.Add(nameof(textBoxPlcInfo.Text), ViewModel, nameof(ViewModel.DeviceInfo), false, DataSourceUpdateMode.OnPropertyChanged);
|
|
|
|
|
|
textBoxSpaceNum.DataBindings.Add(nameof(textBoxSpaceNum.Text), ViewModel, nameof(ViewModel.SpcaeNumber), false, DataSourceUpdateMode.OnPropertyChanged);
|
|
|
|
|
|
|
|
|
|
|
|
listBoxCommand.DataSource = Enum.GetValues(typeof(CommandSignal));
|
|
|
|
|
|
listBoxCommand.DataBindings.Add(nameof(listBoxCommand.SelectedItem), ViewModel, nameof(ViewModel.SelectedSignal), false, DataSourceUpdateMode.OnPropertyChanged);
|
|
|
|
|
|
listBoxCommand.SelectedIndexChanged += (s, e) => listBoxCommand.DataBindings[nameof(listBoxCommand.SelectedItem)].WriteValue();
|
2024-09-27 10:30:19 +08:00
|
|
|
|
|
2024-10-07 15:15:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
private void FromWorkBenchView_Load(object sender, EventArgs e)
|
2024-09-27 10:30:19 +08:00
|
|
|
|
{
|
2024-10-07 15:15:18 +08:00
|
|
|
|
|
2024-09-27 10:30:19 +08:00
|
|
|
|
}
|
2024-10-07 15:15:18 +08:00
|
|
|
|
|
2024-10-10 10:45:53 +08:00
|
|
|
|
private void FromWorkBenchView_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
|
{
|
2024-10-10 16:49:37 +08:00
|
|
|
|
ViewModel.CommandCloseForm?.Execute();
|
2024-10-10 10:45:53 +08:00
|
|
|
|
}
|
2024-10-07 15:15:18 +08:00
|
|
|
|
|
2024-10-10 10:45:53 +08:00
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewModel.CommandGetParkingSpace.Execute();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
ViewModel.CommandViewPlcInfo.Execute();
|
|
|
|
|
|
}
|
2024-09-27 10:30:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|