Beispiel #1
0
        private static void RegisterFSP(FaxServer faxServer)
        {
            var providerVersion = Convert.ToUInt32(FSPConfig.ProviderVersion, 16);

            faxServer.RegisterDeviceProvider(FSPConfig.ProviderGuid, FSPConfig.ProviderName, FSPConfig.ProviderPath, "", (int)providerVersion);
            Console.WriteLine("Registering fax provider {0} {1} {2} {3}", FSPConfig.ProviderGuid, FSPConfig.ProviderName, FSPConfig.ProviderPath, FSPConfig.ProviderVersion);
        }
Beispiel #2
0
 public void Close()
 {
     if (_fs != null)
     {
         _fs.CloseServer();
         _fs = null;
     }
 }
Beispiel #3
0
        public static void FaxDocument(string server, string document, string receiver, string receiverName, string sender)
        {
            FaxServer faxServer = new FaxServer();
            FaxDoc    doc       = null;
            int       response  = -11;

            try
            {
                faxServer.Connect(server);
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to connect to server: " + e.Message);
            }

            try
            {
                doc = (FaxDoc)faxServer.CreateDocument(document);
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to create document: " + e.Message);
            }

            try
            {
                doc.FaxNumber     = receiver;
                doc.RecipientName = receiverName;
                doc.DisplayName   = sender;
            }
            catch (Exception e)
            {
                Console.WriteLine("Unable to assign Fax Properties: " + e.Message);
            }


            try
            {
                response = doc.Send();
                Console.WriteLine(response + " Send successfully");
            }
            catch (Exception e)
            {
                Console.WriteLine(response + e.Message);
            }

            try
            {
                faxServer.Disconnect();
            }
            catch (Exception e)
            {
                Console.WriteLine("Error during disconnect from server: " + e.Message);
            }

            Console.WriteLine("Done");
            Console.ReadKey();
        }
 private void faxServer_OnOutgoingJobRemoved(FaxServer pFaxServer, string bstrJobId)
 {
     this.Dispatcher.Invoke((Action)(() =>
     {
         faxStatusTextBox.Document.Blocks.Add(
             new Paragraph(
                 new Run("OnOutgoingJobRemoved event fired. Fax job is removed to outbound queue." +
                         Environment.NewLine)));
     }));
 }
 private void faxServer_OnOutgoingJobAdded(FaxServer pFaxServer, string bstrJobId)
 {
     this.Dispatcher.Invoke((Action)(() =>
     {
         faxStatusTextBox.Document.Blocks.Add(
             new Paragraph(
                 new Run("OnOutgoingJobAdded event fired. A fax is added to the outgoing queue. Please wait...." +
                         Environment.NewLine)));
     }));
 }
 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.
 }
 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);
     }));
 }
Beispiel #8
0
 public FaxSender()
 {
     try
     {
         faxServer = new FaxServer();
         faxServer.Connect(Environment.MachineName);
         RegisterFaxServerEvents();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }
Beispiel #9
0
        public void Open(string serverName, string userName, string password)
        {
            // just incase it is already open, close it first and
            // destroy the _fs object.
            Close();

            _fs                           = new FaxServer();
            _fs.ServerName                = serverName;
            _fs.AuthorizationUserID       = userName;
            _fs.AuthorizationUserPassword = password;
            _fs.UseNTAuthentication       = BoolType.False;
            _fs.Protocol                  = CommunicationProtocolType.cpTCPIP;
            _fs.OpenServer();
        }
Beispiel #10
0
        /// <summary>
        /// Construtor padrao
        /// </summary>
        private FaxServerService()
        {
            try
            {
                faxServer                           = new FaxServer();
                faxServer.ServerName                = PropertiesUtil.getInstance().getProperties("rf_host");
                faxServer.UseNTAuthentication       = PropertiesUtil.getInstance().getProperties("rf_nt_authentication") == "true" ? BoolType.True : BoolType.False;
                faxServer.AuthorizationUserID       = PropertiesUtil.getInstance().getProperties("rf_login");
                faxServer.AuthorizationUserPassword = PropertiesUtil.getInstance().getProperties("rf_passwd");
                faxServer.Protocol                  = CommunicationProtocolType.cpTCPIP;

                ServerInfo serverInfo = faxServer.ServerInfo;
            }
            catch (Exception e)
            {
                Logger.LOGGER_ERROR("Não foi possível conectar ao servidor RightFax com as configuraçõe informadas: {0}".Replace("{0}", e.Message));
            }
        }
        private void SendFaxButton_OnClick(object sender, RoutedEventArgs e)
        {
            //Prepair Fax Info
            PrepairFaxData();

            try
            {
                faxServer = new FaxServer();
            }
            catch (Exception exception)
            {
                RegisterFaxService();
            }

            faxServer.Connect(Environment.MachineName);
            RegisterFaxServerEvents();
            SendFax();
        }
Beispiel #12
0
        public void FaxSender()
        {
            try
            {
                faxServer = new FaxServer();
                faxServer.Connect(Environment.MachineName);//Environment.MachineName

                //checking divice
                //  FaxDevices divece =faxServer.GetDevices();
                // rtd_log.Text += "Có 1 didivice " + divece.ItemById[0].DeviceName  + " - -  -   " + divece.ItemById[0].SendingNow.ToString();
                // rtd_log.Text+= divece.ToString() + " \n" + faxServer.Activity.IncomingMessages.ToString() + " \n" + faxServer.Activity.OutgoingMessages.ToString() + " \n" + faxServer.Activity.QueuedMessages.ToString()+ " \n" + faxServer.Activity.RoutingMessages.ToString() + "\n";
                RegisterFaxServerEvents();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
        }
Beispiel #13
0
        private static FaxDeviceProvider GetExistingFaxProvider(FaxServer faxServer)
        {
            FaxDeviceProvider existing = null;

            faxServer.GetDeviceProviders().Cast <FaxDeviceProvider>().ToList().ForEach(provider =>
            {
                Console.WriteLine("Existing fax provider {0} {1} {2} {3}", provider.UniqueName, provider.FriendlyName, provider.ImageName,
                                  string.Format("{0}.{1}.{2}.{3}", provider.MajorVersion, provider.MajorBuild, provider.MinorVersion, provider.MinorBuild));
                if (provider.UniqueName == FSPConfig.ProviderGuid)
                {
                    existing = provider;
                }
            });

            Console.WriteLine("{0} matching fax provider {1} {2} {3} {4}", existing != null ? "Found" : "No", FSPConfig.ProviderGuid,
                              existing != null ? existing.FriendlyName : FSPConfig.ProviderName,
                              existing != null ? existing.ImageName : FSPConfig.ProviderPath,
                              existing != null ?
                              string.Format("{0}.{1}.{2}.{3}", existing.MajorVersion, existing.MajorBuild, existing.MinorVersion, existing.MinorBuild) :
                              FSPConfig.ProviderVersion);

            return(existing);
        }
 private void faxServer_OnReceiptOptionsChange(FaxServer pFaxServer)
 {
     faxStatusTextBox.Document.Blocks.Add(
         new Paragraph(new Run("On Receipt Options Change." + Environment.NewLine)));
 }
Beispiel #15
0
 private static void UnregisterFSP(FaxServer faxServer, FaxDeviceProvider faxProvider)
 {
     faxServer.UnregisterDeviceProvider(FSPConfig.ProviderGuid);
     Console.WriteLine("Unregistering fax provider {0} {1} {2} {3}", FSPConfig.ProviderGuid, faxProvider.FriendlyName, faxProvider.ImageName,
                       string.Format("{0}.{1}.{2}.{3}", faxProvider.MajorVersion, faxProvider.MajorBuild, faxProvider.MinorVersion, faxProvider.MinorBuild));
 }
 private void faxServer_OnQueuesStatusChange(FaxServer pFaxServer, bool bOutgoingQueueBlocked,
                                             bool bOutgoingQueuePaused, bool bIncomingQueueBlocked)
 {
     faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("On Queues Status Change." + Environment.NewLine)));
 }
 private void faxServer_OnOutgoingMessageAdded(FaxServer pFaxServer, string bstrMessageId)
 {
     faxStatusTextBox.Document.Blocks.Add(
         new Paragraph(new Run("On Out going Message Added." + Environment.NewLine)));
 }
 private void faxServer_OnOutgoingArchiveConfigChange(FaxServer pFaxServer)
 {
     faxStatusTextBox.Document.Blocks.Add(
         new Paragraph(new Run("On Out going Archive Config Change." + Environment.NewLine)));
 }
 public FaxServerListener(string faxServerMachineName)
 {
     faxServer = new FaxServer();
     faxServer.Connect(faxServerMachineName);
     RegisterFaxServerEvents();
 }
 private void faxServer_OnOutboundRoutingGroupsConfigChange(FaxServer pFaxServer)
 {
     faxStatusTextBox.Document.Blocks.Add(
         new Paragraph(new Run("On Out bound Routing Groups Config Change." + Environment.NewLine)));
 }
Beispiel #21
0
 private static void faxServer_OnOutgoingJobRemoved(FaxServer pFaxServer, string bstrJobId)
 {
     MessageBox.Show(" Fax job is removed to outbound queue.");
 }
 private void faxServer_OnNewCall(FaxServer pFaxServer, int lCallId, int lDeviceId, string bstrCallerId)
 {
     faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("On New Call." + Environment.NewLine)));
 }
Beispiel #23
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);
 }
 private void faxServer_OnGeneralServerConfigChanged(FaxServer pFaxServer)
 {
     faxStatusTextBox.Document.Blocks.Add(
         new Paragraph(new Run("On General Server Config Changed." + Environment.NewLine)));
 }
 private void faxServer_OnDeviceStatusChange(FaxServer pFaxServer, int lDeviceId, bool bPoweredOff, bool bSending,
                                             bool bReceiving, bool bRinging)
 {
     faxStatusTextBox.Document.Blocks.Add(new Paragraph(new Run("On Device Status Change." + Environment.NewLine)));
 }
 private void faxServer_OnActivityLoggingConfigChange(FaxServer pFaxServer)
 {
     faxStatusTextBox.Document.Blocks.Add(
         new Paragraph(new Run("On Activity Logging Config Change." + Environment.NewLine)));
 }
Beispiel #27
0
 private static void faxServer_OnOutgoingJobAdded(FaxServer pFaxServer, string bstrJobId)
 {
     Console.WriteLine("OnOutgoingJobAdded event fired. A fax is added to the outgoing queue.");
 }
Beispiel #28
0
 private static void faxServer_OnOutgoingJobAdded(FaxServer pFaxServer, string bstrJobId)
 {
     //this.a = "  A fax is added to the outgoing queue. --  "+ bstrJobId);
 }
Beispiel #29
0
 private static void faxServer_OnOutgoingJobRemoved(FaxServer pFaxServer, string bstrJobId)
 {
     Console.WriteLine("OnOutgoingJobRemoved event fired. Fax job is removed to outbound queue.");
 }
Beispiel #30
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);
 }