internal static void SafeAction(Action action, string textInfo = "")
        {
            if (string.IsNullOrEmpty(textInfo))
            {
                textInfo = "Перехвачена ошибка выполнения.\nДетальную информацию можно найти в событиях Windows.";
            }

            try
            {
                action();
            }
            catch (PingConnectionException ex)
            {
                using (EventLog eventLog = new EventLog("Application"))
                {
                    eventLog.Source = "Application";
                    eventLog.WriteEntry(
                        SafeBase.GetMessageException(ex),
                        EventLogEntryType.Warning);
                }
            }
            catch (Exception ex)
            {
                using (EventLog eventLog = new EventLog("Application"))
                {
                    eventLog.Source = "Application";
                    eventLog.WriteEntry(
                        SafeBase.GetMessageException(ex),
                        EventLogEntryType.Warning);
                }
                MessageBox.Show(textInfo);
            }
        }
        internal static T SafeAction(Func <T> action)
        {
            try
            {
                return(action.Invoke());
            }
            catch (Exception ex)
            {
                using (EventLog eventLog = new EventLog("Application"))
                {
                    eventLog.Source = "Application";
                    eventLog.WriteEntry(
                        SafeBase.GetMessageException(ex),
                        EventLogEntryType.Warning);
                }
                MessageBox.Show("Перехвачена ошибка выполнения.\nДетальную информацию можно найти в событиях Windows.");

                return(default);