Пример #1
0
        private void AtomManagerInstance_ConnectedLocation(object sender, ConnectedLocationEventArgs e)
        {
            try
            {
                var location = atomManagerInstance.GetConnectedLocation();

                if (location != null)
                {
                    ConnectionDialog += $"IP: {location.Ip} {Environment.NewLine}";

                    if (location.Country != null)
                    {
                        ConnectionDialog += $"Country: {location.Country.Name} {Environment.NewLine}";
                    }

                    if (location.City != null)
                    {
                        ConnectionDialog += $"City: {location.City.Name} {Environment.NewLine}";
                    }
                }
            }
            catch (Exception ex)
            {
                ConnectionDialog += ex.Message + Environment.NewLine;

                if (ex.InnerException != null && !string.IsNullOrEmpty(ex.InnerException.Message) && !string.IsNullOrWhiteSpace(ex.InnerException.Message))
                {
                    ConnectionDialog += ex.InnerException.Message + Environment.NewLine;

                    if (ex.InnerException.InnerException != null && string.IsNullOrWhiteSpace(ex.InnerException.InnerException.Message))
                    {
                        ConnectionDialog += ex.InnerException.InnerException.Message + Environment.NewLine;
                    }
                    else
                    {
                        ConnectionDialog += "No other inner exception message" + Environment.NewLine;
                    }
                }
            }
        }