Пример #1
0
        public static string DateTimeToLastUpdateTime(DateTime dateTime)
        {
            var startTime = dateTime;
            var endTime   = DateTime.UtcNow;
            var minutes   = (endTime - startTime).TotalMinutes;
            var hours     = (endTime - startTime).TotalHours;
            var days      = (endTime - startTime).TotalDays;

            if (minutes <= 120)
            {
                return($"{minutes:N0} {LanguageController.Translation("MINUTES")}");
            }

            if (hours <= 48)
            {
                return($"{hours:N0} {LanguageController.Translation("HOURS")}");
            }

            if (days <= 365)
            {
                return($"{days:N0} {LanguageController.Translation("DAYS")}");
            }

            return($"{LanguageController.Translation("OVER_A_YEAR")}");
        }
Пример #2
0
        private static bool GetItemListSourceUrlIfExist(ref string url)
        {
            if (string.IsNullOrEmpty(Settings.Default.ItemListSourceUrl))
            {
                url = Settings.Default.DefaultItemListSourceUrl;
                if (string.IsNullOrEmpty(url))
                {
                    return(false);
                }

                Settings.Default.ItemListSourceUrl = Settings.Default.DefaultItemListSourceUrl;
                MessageBox.Show(LanguageController.Translation("DEFAULT_ITEMLIST_HAS_BEEN_LOADED"), LanguageController.Translation("NOTE"));
            }
            return(true);
        }