예제 #1
0
        static void Main(string[] args)
        {
            Tracing.Tracer            t = Tracing.Tracer.Instance;
            RightFAXServersSection    rightFAXServersSection    = ConfigurationManager.GetSection("RightFAXServers") as RightFAXServersSection;
            RightFAXServersCollection rightFAXServersCollection = rightFAXServersSection.RightFAXServers;
            MailBoxSection            mailBoxSection            = ConfigurationManager.GetSection("MailBoxes") as MailBoxSection;
            MailBoxCollection         mailBoxCollection         = mailBoxSection.MailBoxes;


            RightFAX rightFAX = new RightFAX();

            // iterate through the servers
            // and then inside, iterate through the mailboxes.

            foreach (RightFAXServersElement rfse in rightFAXServersCollection)
            {
                Console.WriteLine("RightFAXServersElement = " + rfse.ToString());
                rightFAX.Open(rfse.ServerName, rfse.UserName, rfse.Password);
                foreach (MailBoxElement mbe in mailBoxCollection)
                {
                    if (rfse.ServerName == mbe.ServerName)
                    {
                        rightFAX.ProcessMailBox(mbe);
                    }
                }
                rightFAX.Close();
            }
        }
예제 #2
0
        private void Process()
        {
            if (_monitor.Processing == false)
            {
                // we are not currently processing.
                return;
            }
            RightFAXServersSection    rightFAXServersSection    = ConfigurationManager.GetSection("RightFAXServers") as RightFAXServersSection;
            RightFAXServersCollection rightFAXServersCollection = rightFAXServersSection.RightFAXServers;
            MailBoxSection            mailBoxSection            = ConfigurationManager.GetSection("MailBoxes") as MailBoxSection;
            MailBoxCollection         mailBoxCollection         = mailBoxSection.MailBoxes;

            RightFAX rightFAX = new RightFAX();

            // iterate through the servers
            // and then inside, iterate through the mailboxes.

            foreach (RightFAXServersElement rfse in rightFAXServersCollection)
            {
                Trace.WriteLine("RightFAXServersElement = " + rfse.ToString());
                rightFAX.Open(rfse.ServerName, rfse.UserName, rfse.Password);
                foreach (MailBoxElement mbe in mailBoxCollection)
                {
                    if (_monitor.Processing == false)
                    {
                        // we are not currently processing.
                        rightFAX.Close();
                        return;
                    }
                    if (rfse.ServerName == mbe.ServerName)
                    {
                        rightFAX.ProcessMailBox(mbe);
                    }
                }
                rightFAX.Close();
            }
        }