public void SelectPrinter(string printerName) { try { if (this.availablePrinterNames.Contains(printerName) && !string.IsNullOrEmpty(printerName)) { this.selectedPrinterName = printerName; OnPrinterChanged?.Invoke(this.selectedPrinterName); var printLog = Language.I.Text("printer_selected", "Printer selected and this printer will be used when next start!"); SafeFireLoging(printLog); WritPrinterName(printerName); } else { SafeFireLoging(Language.I.Text("invalid_printer", "Printer was invalid!")); } } catch (Exception ex) { SafeFireLoging(Language.I.Text("invalid_printer", "Printer was invalid!")); HttpServer.Logger.Log(ex.ToString()); } }
public void SelectPrinter(string printerName) { try { if (this.availablePrinterNames.Contains(printerName) && !string.IsNullOrEmpty(printerName)) { this.selectedPrinterName = printerName; OnPrinterChanged?.Invoke(this.selectedPrinterName); SafeFireLoging("打印机被选中" + printerName + " 已写入配置文件,下次启动将使用此打印机"); WritPrinterName(printerName); } else { SafeFireLoging("无效打印机名称"); } } catch (Exception ex) { SafeFireLoging("更新统计信息失败:" + ex.Message); HttpServer.Logger.Log(ex.ToString()); } }
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { // Add code to handle the SettingsSaving event here. PrinterChanged.Invoke(); }