public MainPage()
        {
            InitializeComponent();

            EndpointAddress address = new EndpointAddress("http://localhost:2646/DuplexService.svc");

            PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll);

            DuplexServiceClient proxy = new DuplexServiceClient(binding, address);

            proxy.ReceiveReceived += (sender, args) =>
            {
                if (args.order.Status == OrderStatus.Completed)
                {
                    String reply = "";
                    reply = "Here is the completed order:\n";
                    foreach (var order in args.order.Payload)
                    {
                        reply += order + "\n";
                    }
                    MessageBox.Show(reply);
                }
                else
                {
                    MessageBox.Show("processing");
                }
            };
            proxy.OrderAsync("widget", 3);
        }
        public MainPage()
        {
            InitializeComponent();

            EndpointAddress address = new EndpointAddress("http://localhost:2646/DuplexService.svc");

            PollingDuplexHttpBinding binding = new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll);

            DuplexServiceClient proxy = new DuplexServiceClient(binding, address);

            proxy.ReceiveReceived += (sender, args) =>
                                         {
                                                if (args.order.Status == OrderStatus.Completed)
                                                {
                                                    String reply = "";
                                                    reply = "Here is the completed order:\n";
                                                    foreach (var order in args.order.Payload)
                                                    {
                                                        reply += order + "\n";
                                                    }
                                                    MessageBox.Show(reply);
                                                }
                                                else
                                                {
                                                    MessageBox.Show("processing");

                                                }
                                         };
            proxy.OrderAsync("widget", 3);
        }