/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _watchers_IssueFound(object sender, PrinterIssueEventArgs e) { LogHelper.LogDebug(); try { if (e != null) { PrinterTrouble pt = e.Issue; LogHelper.LogDebug(pt.Issue()); if (pt != PrinterTrouble.None) { APIWrapper.PrinterIssue(e.PrinterName, pt); Notifier.Error(string.Format("Document can't be printed because of printer issue : {1}.{0}Administration has been notified about this issue.", Environment.NewLine, pt.Issue())); } else { if (!string.IsNullOrWhiteSpace(e.Status)) { //Notifier.Error(string.Format("Document can't be printed because of printer issue : {1}", Environment.NewLine, e.Status)); } } } } catch (Exception ex) { Notifier.Error(ex); } }
private void OnIssueFound(PrinterIssueEventArgs e) { EventHandler <PrinterIssueEventArgs> handler = IssueFound; if (handler != null) { handler(this, e); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void _watchers_IssueFound(object sender, PrinterIssueEventArgs e) { LogHelper.LogDebug(); try { // check the event args if (e != null) { LogHelper.LogDebug(e.Issue.Issue()); if (e.Issue != PrinterTrouble.None) { // notify about issue via API APIWrapper.PrinterIssue(Environment.MachineName, Environment.UserName, e.PrinterName, e.Issue); // show error message to user WPFNotifier.Error(string.Format("Document can't be printed because of printer issue : {1}.{0}Administration has been notified about this issue.", Environment.NewLine, e.Issue.Issue())); } } } catch (Exception ex) { WPFNotifier.Error(ex); } }
void watcher_IssueFound(object sender, PrinterIssueEventArgs e) { OnIssueFound(e); }