Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public DateTime Time()
 {
     return(remoteInterface.Time());
 }