// Turn on/off screen and check system status private void mCheckSystemWorker_DoWork(object sender, DoWorkEventArgs e) { if (!mCheckSystemStatus) { return; } var status = new SystemStatus(); e.Result = status; // Check connection if (!Starting && mAicMessageListener != null) { bool connectionOk = mAicMessageListener.CheckConnection(); if (!connectionOk) { mAicMessageListener.Disconnect(); } } // Check internet and printer status.ConnectedToInternet = Network.IsConnectedToInternet(); status.PrinterServerOk = PrintHelper.CheckPrintServer(mAlarmPrinter.ServerName); if (status.PrinterServerOk) { status.PrinterOk = PrintHelper.CheckPrinter(mAlarmPrinter.ServerName, mAlarmPrinter.PrinterName); } }
// Check printer private void CheckPrinterButton_Click(object sender, RoutedEventArgs e) { string printServer = string.IsNullOrEmpty(PrintServerBox.Text) ? null : PrintServerBox.Text; bool ok = PrintHelper.CheckPrinter(printServer, PrinterNameBox.Text); if (ok) { MessageBox.Show("Die Verbindung zum Drucker ist in Ordnung.", "AIC"); } else { MessageBox.Show("Es besteht keine Verbindung zum Drucker", "AIC", MessageBoxButton.OK, MessageBoxImage.Error); } }