Exemplo n.º 1
0
        public MainPage()
        {
            InitializeComponent();

            ShowExceptionInWindow(() =>
                {
                    _EchoRiaService = new EchoRiaContext();
                    ButtonEchoRiaService.Click += (s, e) => ShowExceptionInWindow( () => _EchoRiaService.Echo(TextRequest.Text, a => UpdateResponse(a.Value), null));

                    _EchoWcfService = new EchoWcfServiceClient("BasicRelative");
                    _EchoWcfService.EchoCompleted += (s, e) => UpdateResponse(e.Result);
                    ButtonEchoWcfService.Click += (s, e) => _EchoWcfService.EchoAsync(TextRequest.Text);

                    _EchoDuplexService = new EchoDuplexServiceClient(new PollingDuplexHttpBinding(PollingDuplexMode.MultipleMessagesPerPoll), new EndpointAddress(_DuplexServicePath));
                    _EchoDuplexService.ReceiveReceived += (s, e) => UpdateResponse(e.value);
                    _EchoDuplexService.EchoCompleted += (s, e) => UpdateResponse(e.Result);
                    _EchoDuplexService.RegisterCompleted += (s, e) => UpdateResponse("Echo Duplex Service Register Status : " + e.Result.ToString());
                    _EchoDuplexService.UnRegisterCompleted += (s, e) => UpdateResponse("Echo Duplex Service Un-Register Status : " + e.Result.ToString());
                    ButtonEchoDuplexService.Click += (s, e) => ShowExceptionInWindow(() => _EchoDuplexService.EchoAsync(TextRequest.Text));
                    ButtonEchoDuplexServiceRegister.Click += (s, e) => ShowExceptionInWindow( () => _EchoDuplexService.RegisterAsync(TextRequest.Text));
                    ButtonEchoDuplexServiceUnRegister.Click += (s, e) => ShowExceptionInWindow( () => _EchoDuplexService.UnRegisterAsync(TextRequest.Text));
                });
        }
Exemplo n.º 2
0
 void ShowEchoWcfService()
 {
     EchoWcfServiceClient service = new EchoWcfServiceClient("BasicRelative");
     service.Endpoint.Behaviors.Add(_Log);
     Console.WriteLine("Echo Wcf Service Result : " + service.Echo("Hello"));
 }