public Appliance LoadAppliance() { try { Cursor.Current = Cursors.WaitCursor; _connection = new Connection(_server.GetIPAddress(), _port); _connection.Connect(); if (!_connection.IsConnected()) { Globals.GetDefaultLog().AddLogLine("Unable to connect to appliance..."); _connection.Stop(); Cursor.Current = Cursors.Default; } else { _connection.MessageReceivedEvent += new Connection.MessageReceivedHandler(this.messageReceived); _connection.ConnectionRegainedEvent += new Connection.ConnectionRegainedHandler(this.connectionRegained); PUC.Communication.Message msg = new SpecRequest(); _connection.Send(msg); } } catch (Exception) { Cursor.Current = Cursors.Default; } return(null); }
protected void connectionRegained(ConnectionEventArgs a) { try { PUC.Communication.Message msg = new SpecRequest(); _connection.Send(msg); } catch (Exception) { } }