示例#1
0
        /// <exception cref="System.InvalidOperationExcetion"></exception>
        public bool IsUpdateAvailable()
        {
            var feedManager = new FeedManager(this.publicKey);

            var newVersions = feedManager.GetNewVersions(feedUrl, version);

            if (newVersions == null)
                throw new InvalidOperationException("Unable to load feed data.");

            return newVersions.Any();
        }
示例#2
0
        /// <exception cref="System.InvalidOperationExcetion"></exception>
        public bool IsUpdateAvailable()
        {
            var feedManager = new FeedManager(this.publicKey);

            var newVersions = feedManager.GetNewVersions(feedUrl, version);

            if (newVersions == null)
            {
                throw new InvalidOperationException("Unable to load feed data.");
            }

            return(newVersions.Any());
        }
示例#3
0
        public StatusDialog UpdateApplication(EventWaitHandle asyncHandle)
        {
            var feedManager = new FeedManager(this.publicKey);
            var newVersions = feedManager.GetNewVersions(feedUrl, this.context.ApplicationVersion);

            if (dialog == null)
            {
                this.dialog          = new StatusDialog();
                this.dialog.AppTitle = this.context.ApplicationTitle;

                this.dialogAdapter = new StatusDialogAdapter(dialog);
            }

            worker = new UpdateWorker(
                () =>
            {
                var downloadManager = new DownloadManager(this.context, dialogAdapter);
                var files           = downloadManager.DownloadFiles(newVersions);

                var installer = new InstallationManager(this.context, new TraceLogger());
                foreach (var file in files.OrderBy(f => f.Key))
                {
                    installer.Install(file.Value, file.Key);
                }
            });

            worker.WorkCompleted += (object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
                                    =>
            {
                if (dialog != null)
                {
                    dialog.Close();
                    dialog.Dispose();

                    dialogAdapter = null;
                    dialog        = null;
                }

                if (asyncHandle != null)
                {
                    asyncHandle.Set();
                }
            };

            worker.Start();

            return(this.dialog);
        }
示例#4
0
        public StatusDialog UpdateApplication(EventWaitHandle asyncHandle)
        {
            var feedManager = new FeedManager(this.publicKey);
            var newVersions = feedManager.GetNewVersions(feedUrl, this.context.ApplicationVersion);

            if (dialog == null)
            {
                this.dialog = new StatusDialog();
                this.dialog.AppTitle = this.context.ApplicationTitle;

                this.dialogAdapter = new StatusDialogAdapter(dialog);
            }

            worker = new UpdateWorker(
                () =>
                {
                    var downloadManager = new DownloadManager(this.context, dialogAdapter);
                    var files = downloadManager.DownloadFiles(newVersions);

                    var installer = new InstallationManager(this.context, new TraceLogger());
                    foreach (var file in files.OrderBy(f => f.Key))
                    {
                        installer.Install(file.Value, file.Key);
                    }
                });

            worker.WorkCompleted += (object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
                =>
                {
                    if (dialog != null)
                    {
                        dialog.Close();
                        dialog.Dispose();

                        dialogAdapter = null;
                        dialog = null;
                    }

                    if (asyncHandle != null)
                    {
                        asyncHandle.Set();
                    }
                };

            worker.Start();

            return this.dialog;
        }