Esempio n. 1
0
        private void cmdCallWorkflowService_Click(object sender, EventArgs e)
        {
            //if the proxy isn't created or is for some reason not opened, create a new instance of the proxy
            if (proxy == null || proxy.State == System.ServiceModel.CommunicationState.Opened)
            {
                proxy = new SecuredServiceClient("SecuredEndpoint");
            }

            try
            {
                int response = proxy.AskQuestion(txtRet.Text).Value;
                txtAnswer.Text = response.ToString();
                MessageBox.Show("You have the magic character!");
            }
            catch (SecurityAccessDeniedException ex)
            {
                MessageBox.Show(
                    "Request Denied!  You must have the magic character (see Constants.cs) in your name in order to get an answer!"
                    + "\n\t" + ex.Message.ToString());
                txtAnswer.Text = "Denied";
            }
        }