public static void Main()
        {
            var firstPerson = new Person();
            var secondPerson = new Person();

            firstPerson = firstPerson.ConfigurePerson(25);
            secondPerson = secondPerson.ConfigurePerson(24);

            Console.WriteLine(firstPerson.ToString());
            Console.WriteLine(secondPerson.ToString());
        }
示例#2
0
    static void Main()
    {
        // initialize eCAL API
        Util.Initialize("Person Send C#");

        // print version info
        System.Console.WriteLine(String.Format("eCAL {0} ({1})\n", Util.GetVersion(), Util.GetDate()));

        // create a publisher (topic name "Hello", type "base:std::string", description "")
        var publisher = new ProtobufPublisher <People.Person>("person");

        // idle main thread
        int loop   = 0;
        var person = new People.Person
        {
            Id    = 0,
            Email = "*****@*****.**",
            Name  = "Max",
            Stype = People.Person.Types.SType.Female,
            Dog   = new Animal.Dog {
                Name = "Brandy"
            },
            House = new Environment.House {
                Rooms = 4
            }
        };

        while (Util.Ok())
        {
            // message to send
            person.Id = loop;
            loop++;

            // print message
            System.Console.WriteLine(String.Format("Sending:  {0}", person.ToString()));

            // send the content
            publisher.Send(person);

            // cool down
            System.Threading.Thread.Sleep(500);
        }

        // finalize eCAL API
        Util.Terminate();
    }