コード例 #1
0
        /// <summary>
        /// Manually check for updates (user selected in menuitem)
        ///
        /// Appcast files for automatic and manual updates are divided.
        /// If appcast for manual update is available AND version of manual update is newer - we should use appcast with manual update.
        /// Othervise - we are using 'original' appcast file for automatic updates.
        /// </summary>
        public static void CheckForUpdates(Foundation.NSObject sender)
        {
            lock (__locker)
            {
                Initialize();

                try
                {
                    string manualUrl = __originalFeedUrl.AbsoluteString.Replace(".xml", "_manualupdate.xml");

                    string verManual            = "";
                    bool   isManualInfoReceived = false;
                    System.Threading.Tasks.Task.Run(() =>
                    {
                        try { verManual = ManuallyGetUpdateVersion(manualUrl); }
                        catch { } // ignore all errors
                        finally { isManualInfoReceived = true; }
                    });

                    string verDefault = ManuallyGetUpdateVersion(__originalFeedUrl.AbsoluteString);

                    // parallel downloading appcasts
                    System.Threading.SpinWait.SpinUntil(() => isManualInfoReceived == true, 3000);

                    if (!string.IsNullOrEmpty(verManual) && !string.IsNullOrEmpty(verDefault))
                    {
                        Sparkle.SUStandardVersionComparator c = new Sparkle.SUStandardVersionComparator();
                        if (c.CompareVersion(verDefault, verManual) == Foundation.NSComparisonResult.Ascending)
                        {
                            __updater.FeedURL = new Foundation.NSUrl(manualUrl);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logging.Info(ex.ToString());
                }
                finally
                {
                    __updater.CheckForUpdates(sender);
                    __updater.FeedURL = __originalFeedUrl;
                }
            }
        }
コード例 #2
0
        void OnCheckForUpdates(object sender, EventArgs e)
        {
            var updater = new Sparkle.SUUpdater();

            updater.CheckForUpdates(this);
        }
コード例 #3
0
 partial void CheckForUpdatesHandler(NSObject sender)
 {
     suupdater.CheckForUpdates(sender);
 }