Example #1
0
        public static void Run(string[] args)
        {
            int status = 0;

            try
            {
                using (Ice.Communicator ic = Ice.Util.initialize(ref args))
                {
                    Ice.ObjectPrx obj     = ic.stringToProxy("SimplePrinter:default -p 10000");
                    PrinterPrx    printer = PrinterPrxHelper.checkedCast(obj);
                    if (printer == null)
                    {
                        Console.WriteLine("Invalid proxy");
                    }

                    printer.printString("Hello ice");
                    Console.WriteLine("send ok");
                    Console.WriteLine("press any key to continue");
                    Console.Read();
                }
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex);
                status = 1;
            }
            Environment.Exit(status);
        }
Example #2
0
    public override int run(string[] args)
    {
        ObjectPrx  proxy   = communicator().stringToProxy(args[0]);
        PrinterPrx printer = PrinterPrxHelper.checkedCast(proxy);

        printer.write("Hello, World!");

        return(0);
    }
Example #3
0
    internal InitialI(Ice.ObjectAdapter adapter)
    {
        _simple = new Simple();
        _simple.message = "a message 4 u";

        _printer = new PrinterI();
        _printer.message = "Ice rulez!";
        _printerProxy = PrinterPrxHelper.uncheckedCast(adapter.addWithUUID(_printer));

        _derivedPrinter = new DerivedPrinterI();
        _derivedPrinter.message = _printer.message;
        _derivedPrinter.derivedMessage = "a derived message 4 u";
        adapter.addWithUUID(_derivedPrinter);
    }
Example #4
0
        public static PrinterPrx uncheckedCast(Ice.ObjectPrx b)
        {
            if (b == null)
            {
                return(null);
            }
            PrinterPrx r = b as PrinterPrx;

            if (r == null)
            {
                PrinterPrxHelper h = new PrinterPrxHelper();
                h.copyFrom__(b);
                r = h;
            }
            return(r);
        }
Example #5
0
        public static PrinterPrx checkedCast(Ice.ObjectPrx b, _System.Collections.Generic.Dictionary <string, string> ctx)
        {
            if (b == null)
            {
                return(null);
            }
            PrinterPrx r = b as PrinterPrx;

            if ((r == null) && b.ice_isA(ice_staticId(), ctx))
            {
                PrinterPrxHelper h = new PrinterPrxHelper();
                h.copyFrom__(b);
                r = h;
            }
            return(r);
        }
Example #6
0
        public static PrinterPrx checkedCast(Ice.ObjectPrx b)
        {
            if (b == null)
            {
                return(null);
            }
            PrinterPrx r = b as PrinterPrx;

            if ((r == null) && b.ice_isA(ice_staticId()))
            {
                PrinterPrxHelper h = new PrinterPrxHelper();
                h.copyFrom__(b);
                r = h;
            }
            return(r);
        }
Example #7
0
        public override int run(string[] args)
        {
            PrinterPrx printer = PrinterPrxHelper.checkedCast(communicator().propertyToProxy("Callback.CallbackServer"));

            if (printer == null)
            {
                System.Console.WriteLine("网络配置无效!");
                return(1);
            }

            string str = "Hello world";

            while (!string.IsNullOrEmpty(str))
            {
                printer.PrintString(str);
                str = Console.ReadLine();
            }

            return(0);
        }
Example #8
0
    public static int Main(string[] args)
    {
        int status = 0;

        Ice.Communicator ic = null;
        try
        {
            ic = Ice.Util.initialize(ref args);
            Ice.ObjectPrx obj     = ic.stringToProxy("SimplePrinter:default -h localhost -p 10000");
            PrinterPrx    printer = PrinterPrxHelper.checkedCast(obj);
            if (printer == null)
            {
                throw new ApplicationException("Invalid proxy");
            }

            printer.printString("Hello World!");
        }
        catch (Exception e)
        {
            Console.Error.WriteLine(e);
            status = 1;
        }
        if (ic != null)
        {
            try
            {
                ic.destroy();
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e);
                status = 1;
            }
        }
        return(status);
    }
Example #9
0
 public override void getPrinter(out Printer impl, out PrinterPrx proxy, Ice.Current current)
 {
     impl  = _printer;
     proxy = _printerProxy;
 }
Example #10
0
 public static void write__(IceInternal.BasicStream os__, PrinterPrx v__)
 {
     os__.writeProxy(v__);
 }
Example #11
0
 public static void write(global::Ice.OutputStream ostr, PrinterPrx v)
 {
     ostr.writeProxy(v);
 }
Example #12
0
 public override void getPrinter(out Printer impl, out PrinterPrx proxy, Ice.Current current)
 {
     impl = _printer;
     proxy = _printerProxy;
 }