Beispiel #1
0
        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();
                }
            }
        }
Beispiel #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();
        }
Beispiel #3
0
    public static void Main()
    {
        CMyMathClass objCMyMathClass = new CMyMathClass();
        IMyMath      objIMyMath = (IMyMath)objCMyMathClass;
        int          num1 = 75, num2 = 25, sum, sub;

        sum = objIMyMath.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("Sum Of " + num1 + " And " + num2 + " Is " + sum);
        sub = objIMyMath.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("Subtraction Of " + num1 + " And " + num2 + " Is " + sub);
    }
    public static void Main()
    {
        CMyMathClass objCMyMathClass = new CMyMathClass();
        IMyMath      objIMyMath = (IMyMath)objCMyMathClass;    //explicit typecast
        int          num1 = 21, num2 = 11, sum, sub;

        sum = objIMyMath.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("Sum Of " + num1 + " And" + num2 + "Is: " + sum);

        sub = objIMyMath.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("Subtraction Of " + num1 + " And" + num2 + "Is: " + sub);
    }
Beispiel #5
0
    public static void Main()
    {
        CMyMathClass obj        = new CMyMathClass();
        IMyMath      objIMyMath = (IMyMath)obj;

        int num1 = 75, num2 = 45, sum, sub;

        sum = objIMyMath.SumOfTwoIntegers(num1, num2);
        Console.WriteLine("Sum of " + num1 + "and " + num2 + "is " + sum);
        sub = objIMyMath.SubtractionOfTwoIntegers(num1, num2);
        Console.WriteLine("Subtraction of " + num1 + "and " + num2 + "is " + sub);
        Console.ReadLine();
    }
Beispiel #6
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();
        }
Beispiel #7
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();
        }
Beispiel #8
0
 static MyMath()
 {
     SceneServer.Instance.UpdateManager.InitStaticImpl(typeof(MyMath), typeof(MyMathDefaultImpl),
                                                       o => { mImpl = (IMyMath)o; });
 }