public bool Connect(string host, int port) { bool connected = false; try { remoteInterface = (IRemoteInterface)Activator.GetObject(typeof(IRemoteInterface), new UriBuilder("http", host, port, "/IMIServer").ToString()); remoteInterface.Time(); connected = true; } catch (Exception e) { Console.WriteLine("Failed to connect, error {0}", e.Message); remoteInterface = null; } return(connected); }
public bool Connect() { connected = false; try { remoteInterface = (IRemoteInterface)Activator.GetObject(typeof(IRemoteInterface), new UriBuilder("http", config.HostName, config.Port, "/IMIServer").ToString()); DateTime serverTime = remoteInterface.Time(); timeDiff = serverTime - DateTime.Now; connected = true; OnConnectStateChanged(); } catch (Exception) { remoteInterface = null; throw; } return(connected); }
public DateTime Time() { return(remoteInterface.Time()); }