Ejemplo n.º 1
0
 private void faxServer_OnOutgoingJobChanged(FaxServer faxServer, string jobId,
                                             FaxJobStatus jobStatus)
 {
     // Of course you can do whatever you wish here. This is the method that
     // subscribes to the event with a JobStatus object
     string output = string.Format("Outgoing Job Changed -> {0}{1}{2}",
                                   jobId, Environment.NewLine, GetJobStatusOutput(jobStatus));
     // you could process the FaxJobStatus object how ever you wish here
     // I raised another event from this listener class with the output data
     // for other client code to listen to.
 }
Ejemplo n.º 2
0
        private static void PrintFaxStatus(FaxJobStatus faxJobStatus)
        {
            if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesDIALING)
            {
                Console.WriteLine("Dialing...");
            }

            if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesTRANSMITTING)
            {
                Console.WriteLine("Sending Fax...");
            }

            if (faxJobStatus.Status == FAX_JOB_STATUS_ENUM.fjsCOMPLETED &&
                faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesCALL_COMPLETED)
            {
                Console.WriteLine("Fax is sent successfully.");
            }
        }
Ejemplo n.º 3
0
    private string GetJobStatusOutput(FaxJobStatus jobStatus)
    {
        StringBuilder sb = new StringBuilder();

        sb.AppendLine("\tDeviceID: " + jobStatus.DeviceId.ToString());
        sb.AppendLine("\tCurrent Page: " + jobStatus.CurrentPage.ToString());
        sb.AppendLine("\tExt. Status Code: " + jobStatus.ExtendedStatusCode.ToString());
        sb.AppendLine("\tExt. Status: " + jobStatus.ExtendedStatus);
        sb.AppendLine("\tJob Type: " + jobStatus.JobType.ToString());
        sb.AppendLine("\tRetries: " + jobStatus.Retries.ToString());
        sb.AppendLine("\tSize: " + jobStatus.Size.ToString());
        sb.AppendLine("\tStatus: " + jobStatus.Status.ToString());
        sb.AppendLine("\tStart: " + jobStatus.TransmissionStart.ToShortTimeString());
        if (jobStatus.ExtendedStatusCode != FAX_JOB_EXTENDED_STATUS_ENUM.fjesTRANSMITTING)
        {
            sb.AppendLine("\tStop: " + jobStatus.TransmissionEnd.ToShortTimeString());
        }
        sb.AppendLine("\tTSID: " + jobStatus.TSID);

        return(sb.ToString());
    }
Ejemplo n.º 4
0
 private static void faxServer_OnOutgoingJobChanged(FaxServer pFaxServer, string bstrJobId, FaxJobStatus pJobStatus)
 {
     Console.WriteLine("OnOutgoingJobChanged event fired. A fax is changed to the outgoing queue.");
     pFaxServer.Folders.OutgoingQueue.Refresh();
     PrintFaxStatus(pJobStatus);
 }
Ejemplo n.º 5
0
 private static void faxServer_OnOutgoingJobChanged(FaxServer pFaxServer, string bstrJobId, FaxJobStatus pJobStatus)
 {
     //  MessageBox.Show(" A fax is changed to the outgoing queue.  --  "+ pJobStatus);
     pFaxServer.Folders.OutgoingQueue.Refresh();
     PrintFaxStatus(pJobStatus);
 }
        private void PrintFaxStatus(FaxJobStatus faxJobStatus)
        {
            this.Dispatcher.Invoke((Action)(() =>
            {
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesRECEIVING)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device is receiving a fax." + Environment.NewLine)));
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesPARTIALLY_RECEIVED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The incoming fax was partially received. Some (but not all) of the pages are available." + Environment.NewLine)));
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesNO_DIAL_TONE)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device has encountered a fatal protocol error. Please check your fax line connection." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesNO_ANSWER)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The receiving device did not answer the call." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesNOT_FAX_CALL)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device received a call that was a data call or a voice call." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesNONE)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("No extended status value Fax Call None..." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesLINE_UNAVAILABLE)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device is not available because it is in use by another application." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesINITIALIZING)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device is initializing a call." + Environment.NewLine)));
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesFATAL_ERROR)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device has encountered a fatal protocol error: To resolve the issue please connect your modem driver and if required install driver software for your modem. If your are connecting your modem to this computer for the first time please restart your computer." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesDISCONNECTED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The sender or the caller disconnected the fax call." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesCALL_DELAYED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device delayed a fax call because the sending device received a busy signal multiple times. The device cannot retry the call because dialing restrictions exist. (Some countries/regions restrict the number of retry attempts when a number is busy.)" + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesCALL_BLACKLISTED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device could not complete a call because the telephone number was blocked or reserved; emergency numbers such as 911 are blocked." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesCALL_ABORTED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The call was aborted." + Environment.NewLine)));
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesBUSY)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device encountered a busy signal." + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                    return;
                }

                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesDIALING)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device is dialing a fax number." + Environment.NewLine)));
                }
                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesHANDLED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The fax service processed the outbound fax; the fax service provider will transmit the fax." + Environment.NewLine)));
                }

                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesBAD_ADDRESS)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device dialed an invalid fax number." + Environment.NewLine)));
                }

                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesTRANSMITTING)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The device is sending a fax." + Environment.NewLine)));
                }

                if (faxJobStatus.Status == FAX_JOB_STATUS_ENUM.fjsCOMPLETED && faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesCALL_COMPLETED)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("Fax is sent successfully" + Environment.NewLine)));
                    FindAndKillProcess("WFS");
                }

                if (faxJobStatus.ExtendedStatusCode == FAX_JOB_EXTENDED_STATUS_ENUM.fjesPROPRIETARY)
                {
                    faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("The ExtendedStatusCode property specifies a code describing the job's extended status." + Environment.NewLine)));
                }
            }));
        }
 private void faxServer_OnOutgoingJobChanged(FaxServer pFaxServer, string bstrJobId, FaxJobStatus pJobStatus)
 {
     this.Dispatcher.Invoke((Action)(() =>
     {
         faxStatusTextBox.Document.Blocks.Add(
             new Paragraph(
                 new Run("OnOutgoingJobChanged event fired. A fax is changed to the outgoing queue." +
                         Environment.NewLine)));
         pFaxServer.Folders.OutgoingQueue.Refresh();
         PrintFaxStatus(pJobStatus);
     }));
 }