Ejemplo n.º 1
0
Archivo: Form1.cs Proyecto: WssIDs/TKP
        private void button1_Click(object sender, EventArgs e)
        {
            DateTime Start     = DateTime.Now;
            var      atlPRType = Type.GetTypeFromProgID("ATL_PR_1.MyMath.1");

            if (atlPRType != null)
            {
                var obj = Activator.CreateInstance(atlPRType);

                if (obj != null)
                {
                    IMyMath myMath = (IMyMath)obj;

                    txtZ.Text = (myMath.Add(Convert.ToDouble(txtX.Text), Convert.ToDouble(txtY.Text))).ToString();


                    for (int i = 0; i < ITERATIONS; i++)
                    {
                        myMath.Add(Convert.ToDouble(txtX.Text), Convert.ToDouble(txtY.Text));
                    }

                    txtTime1.Text = ((DateTime.Now - Start).TotalSeconds).ToString();
                }
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            ChannelFactory <IMyMath> factory = new ChannelFactory <IMyMath>(new NetTcpBinding(), new EndpointAddress("http://127.0.0.1/MyMath"));  // Канали - абстракція, шлях передачі повідомлень  . Транспортні  , протокольні
            IMyMath channel = factory.CreateChannel();
            int     result  = channel.Add(10, 30);

            Console.WriteLine("Result = " + result);
            Console.ReadLine();
            factory.Close();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            ChannelFactory <IMyMath> factory = new ChannelFactory <IMyMath>(new BasicHttpBinding(),
                                                                            new EndpointAddress("http://localhost/MyMath"));

            IMyMath channel = factory.CreateChannel();

            int result = channel.Add(5, 3);

            Console.WriteLine("result: {0}", result);

            Console.ReadLine();
            factory.Close();
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            ChannelFactory <IMyMath> factory = new ChannelFactory <IMyMath>(
                new WSHttpBinding(),
                new EndpointAddress("http://localhost/MyMath/EndP1"));

            IMyMath chanell = factory.CreateChannel();
            int     result  = chanell.Add(21, 13);

            Console.WriteLine("result: {0}", result);
            Console.WriteLine("Push any key for exit");
            Console.ReadKey();
            factory.Close();
        }
Ejemplo n.º 5
0
        //以下是被强制代理的所有方法

        public int Add(int a, int b)
        {
            return(math.Add(a, b));
        }