protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         feedbackService.Dispose();
     }
     base.Dispose(disposing);
 }
        protected virtual void Dispose(bool disposing)
        {
            const string method = "Service Disposal";

            if (!_disposed)
            {
                if (disposing)
                {
                    if (EventSource.IsEnabled(Event.Trace))
                    {
                        EventSource.Raise(Event.Trace, method, "Disposing feedback service");
                    }

                    _service.Dispose();
                }
            }
            _disposed = true;
        }
Example #3
0
        static void Main(string[] args)
        {
            //Variables you may need to edit:
            //---------------------------------

            //True if you are using sandbox certificate, or false if using production
            bool sandbox = true;

            //Put your PKCS12 .p12 or .pfx filename here.
            // Assumes it is in the same directory as your app
            string p12File = "apn_developer_identity.p12";

            //This is the password that you protected your p12File
            //  If you did not use a password, set it as null or an empty string
            string p12FilePassword = "******";


            //Actual Code starts below:
            //--------------------------------

            //Get the filename assuming the file is in the same directory as this app
            string p12Filename = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, p12File);

            //Create the feedback service consumer
            FeedbackService service = new FeedbackService(sandbox, p12Filename, p12FilePassword);

            //Wireup the events
            service.Error    += new FeedbackService.OnError(service_Error);
            service.Feedback += new FeedbackService.OnFeedback(service_Feedback);

            //Run it.  This actually connects and receives the feedback
            // the Feedback event will fire for each feedback object
            // received from the server
            service.Run();

            Console.WriteLine("Done.");
            Console.WriteLine("Cleaning up...");

            //Clean up
            service.Dispose();

            Console.WriteLine("Press enter to exit...");
            Console.ReadLine();
        }