BaseComm.BotConnection.Dispose C# (CSharp) Method

Dispose() public method

Cleanup resources associated with the connection.
public Dispose ( ) : void
return void
        public void Dispose()
        {
            communicator.destroy();
        }

Usage Example

Example #1
0
        static void Main(string[] args)
        {
            BotConnection botConn = null;
            while (true) {
                try {
                    var botToBase = new BotToBaseImpl();
                    botConn = new BotConnection(botToBase, "r2d2");
                    BaseToBotPrx bot = botConn.BotProxy;

                    while (true) {
                        Console.WriteLine("Choose a command:");
                        Console.WriteLine("  1. Play sound");
                        Console.WriteLine("  2. Move using XBox controller");
                        switch (Console.ReadKey(true).Key) {
                            case ConsoleKey.D1:
                                PlaySound(bot);
                                break;
                            case ConsoleKey.D2:
                                XboxControls(bot, botToBase);
                                break;
                        }
                    }

                } catch (Exception e) {
                    Console.Error.WriteLine(e.ToString());
                } finally {
                    if (botConn != null) { botConn.Dispose(); }
                }
            }
        }