示例#1
0
        /// <summary>
        /// Perform an update check at application start, but only daily, weekly or monthly depending on the users settings.
        /// </summary>
        /// <param name="callback">
        /// The callback.
        /// </param>
        public void PerformStartupUpdateCheck(Action <UpdateCheckInformation> callback)
        {
            if (UwpDetect.IsUWP())
            {
                return; // Disable Update checker if we are in a UWP container.
            }

            if (Portable.IsPortable() && !Portable.IsUpdateCheckEnabled())
            {
                return; // Disable Update Check for Portable Mode.
            }

            // Make sure it's running on the calling thread
            if (this.userSettingService.GetUserSetting <bool>(UserSettingConstants.UpdateStatus))
            {
                DateTime lastUpdateCheck = this.userSettingService.GetUserSetting <DateTime>(UserSettingConstants.LastUpdateCheckDate);
                int      checkFrequency  = this.userSettingService.GetUserSetting <int>(UserSettingConstants.DaysBetweenUpdateCheck) == 0 ? 7 : 30;

                if (DateTime.Now.Subtract(lastUpdateCheck).TotalDays > checkFrequency)
                {
                    this.userSettingService.SetUserSetting(UserSettingConstants.LastUpdateCheckDate, DateTime.Now);

                    this.CheckForUpdates(callback);
                }
            }
        }
示例#2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            OptionsTab[] tabs = value as OptionsTab[];
            if (tabs != null && UwpDetect.IsUWP())
            {
                return(tabs.Where(s => s != OptionsTab.Updates).ToArray());
            }

            return(value);
        }