Files

50 lines
1.6 KiB
C#
Raw Permalink Normal View History

2026-04-18 18:14:12 +08:00
//using DateRecordView;
2026-04-21 10:35:43 +08:00
using Modbus.Device;
using System.Net.Sockets;
2026-04-18 18:14:12 +08:00
using System.Text;
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;
2026-04-21 10:35:43 +08:00
using .Services;
using .Services.Data;
2026-04-18 18:14:12 +08:00
using .Views;
namespace
{
public partial class MainWindow : Window
{
2026-04-21 16:39:29 +08:00
2026-04-18 18:14:12 +08:00
public MainWindow()
{
InitializeComponent();
2026-04-21 13:36:09 +08:00
ModbusHelper.Connect("192.168.1.10", 502); // 连接一次,全局生效
2026-04-18 18:14:12 +08:00
}
2026-04-22 14:45:50 +08:00
// 程序退出
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
//ModbusHelper.Dispose();
}
//private void GoTest(object s, RoutedEventArgs e) => MainFrame.Content = new Views.PageTest();
2026-04-22 16:02:37 +08:00
//private void GoRecord(object s, RoutedEventArgs e) => MainFrame.Content = new Views.RecordDate();
private void GoRecord(object s, RoutedEventArgs e) => MainFrame.Content = new Views.PageTest();
2026-04-22 14:45:50 +08:00
//private void GoView(object s, RoutedEventArgs e) => MainFrame.Content = new Views.RecordPage();
2026-04-18 18:14:12 +08:00
private void GoVisiPage(object s, RoutedEventArgs e) => MainFrame.Content = new Views.VisiData();
//NavigationService.Navigate(new Views.RecordDate()); 页面相互跳转
2026-04-22 14:45:50 +08:00
//private void ShowError(string msg) => MessageBox.Show(msg, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
2026-04-18 18:14:12 +08:00
}
}