예제 #1
0
        }         // TestGetDataUsingDataContract

        private static void TestShutdown(EzServiceClient proxy)
        {
            Console.WriteLine("Shutdown()...");
            string s = proxy.Shutdown();

            Console.WriteLine("Shutdown() = {0}", s);
        } // TestShutdown
예제 #2
0
        }         // TestOneAction

        private static void TestGetData(EzServiceClient proxy)
        {
            Console.WriteLine("GetData(12)...");
            string s = proxy.GetData(12);

            Console.WriteLine("GetData(12) = {0}", s);
        }         // TestGetData
예제 #3
0
        private static void Main(string[] args)
        {
            var c     = new EzServiceClient();
            var check = c.FraudChecker(25, FraudMode.FullCheck);

            xmlHelper.SerializeObject(check, "FraudChecker");
        }
예제 #4
0
        }         // TestGetData

        private static void TestGetDataUsingDataContract(EzServiceClient proxy)
        {
            Console.WriteLine("GetDataUsingDataContract({ true, 'str' })...");
            CompositeType ct = proxy.GetDataUsingDataContract(new CompositeType {
                BoolValue = true, StringValue = "str"
            });

            Console.WriteLine("GetDataUsingDataContract({{ true, 'str' }}) = {{ {0}, {1} }}", ct.BoolValue, ct.StringValue);
        }         // TestGetDataUsingDataContract
예제 #5
0
        }         // Main

        private static EzServiceClient TestOneAction(EzServiceClient proxy, Action <EzServiceClient> oAction)
        {
            if (proxy == null)
            {
                Console.WriteLine("Creating a proxy object...");

                proxy = new EzServiceClient();

                Console.WriteLine("Connecting a proxy object to service...");
                try {
                    proxy.Open();
                }
                catch (Exception e) {
                    Console.WriteLine("Failed to connect to the service: exception of type {1} caught: {0}", e.Message, e.GetType());
                    return(null);
                }         // try
            }             // if

            if (proxy.InnerChannel.State != CommunicationState.Opened)
            {
                Console.WriteLine("Cannot call the service: its state is {0}", proxy.InnerChannel.State);
                return(null);
            }             // if

            try {
                oAction(proxy);
            }
            catch (Exception e) {
                Console.WriteLine("GetData: exception of type {1} caught: {0}", e.Message, e.GetType());
            }             // try

            Console.WriteLine("After the call service state is {0}", proxy.InnerChannel.State);

            if (proxy.InnerChannel.State != CommunicationState.Opened)
            {
                return(null);
            }

            return(proxy);
        }         // TestOneAction
예제 #6
0
파일: Form1.cs 프로젝트: vijayamazon/ezbob
        private void Form1_Load(object sender, EventArgs e)
        {
            var  service = new EzServiceClient();
            Type type    = typeof(EzServiceClient);

            System.Reflection.MethodInfo[] methods = type.GetMethods();
            var methodsStr = new List <string>(30);

            methodsStr.AddRange(methods.Select(method => method.Name));
            methodsStr.Sort();
            ddlMethods.DataSource = methodsStr;

            //  ddlMethods.Text = "Name";
            //  ddlMethods.ValueMember = "Name";
            ddlMethods.PerformLayout();

            AutoCompleteStringCollection AutoCompleteMethods = new AutoCompleteStringCollection();

            for (int i = 0; i < methods.Length; i++)
            {
                AutoCompleteMethods.Add(methods[i].Name);
            }

            ddlMethods.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            ddlMethods.AutoCompleteSource       = AutoCompleteSource.ListItems;
            ddlMethods.AutoCompleteCustomSource = AutoCompleteMethods;

            SelectedMethod = ddlMethods.SelectedValue.ToString();

            //lblFbnclient.Text = TestMethod.Fbnclient.Endpoint.ListenUri.ToString();

            imgLoader.Visible   = true;
            pictureBox1.Visible = false;
            imgLoader.Text      = "";
            imgLoader.Refresh();
            var endpoints = LoadWindowHelper.LoadEndpointsFromConfig();

            EndPoint.Text = DEFAULT_ENDPOINT_IP_TEXT + endpoints[0].EndPointPath.Host;
        }
예제 #7
0
        static void Main(string[] args)
        {
            EzServiceClient proxy = null;

            var aryActions = new Action <EzServiceClient>[] {
                TestGetData, TestGetDataUsingDataContract, TestGetData, TestGetDataUsingDataContract
            };

            foreach (Action <EzServiceClient> oAction in aryActions)
            {
                proxy = TestOneAction(proxy, oAction);
            }

            Console.WriteLine("Strike Enter to quit or 'exit' to shutdown the service...");
            string sResponse = Console.ReadLine();

            if (sResponse == "exit")
            {
                TestOneAction(proxy, TestShutdown);
                Console.WriteLine("Strike Enter when ready...");
                Console.ReadLine();
            }     // if
        }         // Main