//using DateRecordView; using Modbus.Device; using System.Net.Sockets; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using 头罩视野.Services; using 头罩视野.Services.Data; using 头罩视野.Views; namespace 头罩视野 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); ModbusHelper.Connect("192.168.1.10", 502); // 连接一次,全局生效 } // 程序退出 protected override void OnClosed(EventArgs e) { base.OnClosed(e); //ModbusHelper.Dispose(); } //private void GoTest(object s, RoutedEventArgs e) => MainFrame.Content = new Views.PageTest(); //private void GoRecord(object s, RoutedEventArgs e) => MainFrame.Content = new Views.RecordDate(); private void GoRecord(object s, RoutedEventArgs e) => MainFrame.Content = new Views.PageTest(); //private void GoView(object s, RoutedEventArgs e) => MainFrame.Content = new Views.RecordPage(); private void GoVisiPage(object s, RoutedEventArgs e) => MainFrame.Content = new Views.VisiData(); //NavigationService.Navigate(new Views.RecordDate()); 页面相互跳转 //private void ShowError(string msg) => MessageBox.Show(msg, "错误", MessageBoxButton.OK, MessageBoxImage.Error); } }