Exemplo n.º 1
0
        private async void DoStuffOwlClient()
        {
            if (relayClient == null)
            {
                relayClient = new StatusRelay.RelayClient();
            }

            OwlCommand c = new OwlCommand();

            c.Command = OwlCommand.Commands.RandomFull;


            if (!relayClient.IsConnected)
            {
                ExceptionDispatchInfo capturedException = null;
                try
                {
                    await relayClient.Open();
                }
                catch (Exception ex)
                {
                    capturedException = ExceptionDispatchInfo.Capture(ex);
                }

                string exMessage = String.Empty;

                if (capturedException != null)
                {
                    //await ExceptionHandler();
                    //capturedException.Throw();
                    exMessage += capturedException.SourceException.ToString();
                }

                if (!relayClient.IsConnected)
                {
                    //deferral.Complete();
                    TestButton.Content = "Bad: Relay Client connection is not open -- " + DateTime.Now.ToString() + " -- Error: " + exMessage;
                    return;
                }
            }
            //if we made it here, do the message
            await relayClient.SendOwlCommandAsync(c);
        }