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(); }
public FaxSender() { try { faxServer = new FaxServer(); faxServer.Connect(Environment.MachineName); RegisterFaxServerEvents(); } catch (Exception ex) { Console.WriteLine(ex.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(); }
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; } }
public FaxServerListener(string faxServerMachineName) { faxServer = new FaxServer(); faxServer.Connect(faxServerMachineName); RegisterFaxServerEvents(); }