Esempio n. 1
0
        /// <summary>
        /// Report the user status
        /// </summary>
        /// <param name="Status"></param>
        /// <returns></returns>
        public bool ReportUserStatus(MacomberMapCommunications.Messages.MM_Client_Status Status)
        {
            try
            {
                return(innerChannel.ReportUserStatus(Status));
            }
            catch (Exception ex)
            {
                MM_System_Interfaces.LogError(ex.Message);

                try
                {
                    if (ex.Message.IndexOf("aborted", StringComparison.OrdinalIgnoreCase) >= 0 || ex.Message.IndexOf("Faulted", StringComparison.OrdinalIgnoreCase) >= 0 && (!lastConnect.HasValue || (DateTime.Now - lastConnect.Value).TotalSeconds > 10))
                    {
                        // can we reconnect?
                        Exception error = null;
                        // this login method should reconnect us.
                        MM_Server_Interface.TryLogin(MM_Server_Interface.ServerName, MM_Server_Interface.ConnectionURI, MM_Server_Interface.UserName, MM_Server_Interface.Password, out error);
                        lastConnect = DateTime.Now;
                        if (error != null)
                        {
                            throw error;
                        }
                    }
                }
                catch (Exception exp)
                {
                    MM_System_Interfaces.LogError(exp.Message);
                }
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>Report the server name</summary>
        /// <returns></returns>
        public string ServerName()
        {
            try
            {
                return(innerChannel.ServerName());
            }
            catch (Exception ex)
            {
                MM_System_Interfaces.LogError(ex.Message);

                try
                {
                    if (ex.Message.IndexOf("aborted", StringComparison.OrdinalIgnoreCase) >= 0 || ex.Message.IndexOf("Faulted", StringComparison.OrdinalIgnoreCase) >= 0 && (!lastConnect.HasValue || (DateTime.Now - lastConnect.Value).TotalSeconds > 10))
                    {
                        // can we reconnect?
                        Exception error = null;
                        // this login method should reconnect us.
                        if (MM_Server_Interface.TryLogin(MM_Server_Interface.ServerName, MM_Server_Interface.ConnectionURI, MM_Server_Interface.UserName, MM_Server_Interface.Password, out error))
                        {
                            return(MM_Server_Interface.ServerName);
                        }
                        lastConnect = DateTime.Now;
                        if (error != null)
                        {
                            throw error;
                        }
                    }
                }
                catch (Exception exp)
                {
                    MM_System_Interfaces.LogError(exp.Message);
                }

                return("SERVER ERROR");
            }
        }