示例#1
0
        public async Task <MixItUpUpdateModel> GetLatestUpdate()
        {
            MixItUpUpdateModel update = await ChannelSession.Services.MixItUpService.GetLatestPublicUpdate();

            if (update != null)
            {
                if (ChannelSession.AppSettings.PreviewProgram)
                {
                    MixItUpUpdateModel previewUpdate = await ChannelSession.Services.MixItUpService.GetLatestPreviewUpdate();

                    if (previewUpdate != null && previewUpdate.SystemVersion >= update.SystemVersion)
                    {
                        update = previewUpdate;
                    }
                }

                if (ChannelSession.AppSettings.TestBuild)
                {
                    MixItUpUpdateModel testUpdate = await ChannelSession.Services.MixItUpService.GetLatestTestUpdate();

                    if (testUpdate != null && testUpdate.SystemVersion >= update.SystemVersion)
                    {
                        update = testUpdate;
                    }
                }
            }
            return(update);
        }
        private async Task <bool> DownloadZipArchive(MixItUpUpdateModel update)
        {
            this.DisplayText1             = "Downloading files...";
            this.IsOperationIndeterminate = false;
            this.OperationProgress        = 0;

            bool downloadComplete = false;

            WebClient client = new WebClient();

            client.DownloadProgressChanged += (s, e) =>
            {
                this.OperationProgress = e.ProgressPercentage;
            };

            client.DownloadFileCompleted += (s, e) =>
            {
                downloadComplete       = true;
                this.OperationProgress = 100;
            };

            client.DownloadFileAsync(new Uri(update.ZipArchiveLink), ZipDownloadFilePath);

            while (!downloadComplete)
            {
                await Task.Delay(1000);
            }

            client.Dispose();

            return(File.Exists(ZipDownloadFilePath));
        }
        public UpdateWindow(MixItUpUpdateModel update)
        {
            this.update = update;

            InitializeComponent();

            this.Initialize(this.StatusBar);
        }
        private async Task CheckForUpdates()
        {
            MixItUpUpdateModel latestUpdate = await ChannelSession.Services.MixItUpService.GetLatestUpdate();

            if (latestUpdate != null)
            {
                AutoUpdater.CheckForUpdateEvent += AutoUpdater_CheckForUpdateEvent;
                AutoUpdater.Start(latestUpdate.AutoUpdaterLink);
            }
        }
示例#5
0
        private async Task CheckForUpdates()
        {
            this.currentUpdate = await ChannelSession.Services.MixItUpService.GetLatestUpdate();

            if (this.currentUpdate != null && this.currentUpdate.SystemVersion > Assembly.GetEntryAssembly().GetName().Version)
            {
                updateFound = true;
                UpdateWindow window = new UpdateWindow(this.currentUpdate);
                window.Show();
            }
        }
        protected override async Task InitializeInternal()
        {
            MixItUpUpdateModel update = await ChannelSession.Services.MixItUpService.GetLatestUpdate();

            if (update != null)
            {
                using (HttpClient client = new HttpClient())
                {
                    string changelogHTML = await client.GetStringAsync(update.ChangelogLink);

                    this.ChangelogWebBrowser.NavigateToString(changelogHTML);
                }
            }
            await base.InitializeInternal();
        }
示例#7
0
        public async Task <bool> Run()
        {
            bool result = false;

            await Task.Run(async() =>
            {
                try
                {
                    if (!this.IsUpdate || await this.WaitForMixItUpToClose())
                    {
                        MixItUpUpdateModel update = await this.GetUpdateData();
                        if (this.IsPreview)
                        {
                            MixItUpUpdateModel preview = await this.GetUpdateData(preview: true);
                            if (preview != null && preview.SystemVersion > update.SystemVersion)
                            {
                                update = preview;
                            }
                        }

                        if (update != null)
                        {
                            if (await this.DownloadZipArchive(update))
                            {
                                if (this.InstallMixItUp() && this.CreateMixItUpShortcut())
                                {
                                    result = true;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.WriteToLogFile(ex.ToString());
                }
            });

            if (!result && !this.ErrorOccurred)
            {
                this.ShowError(string.Format("{0} file created in folder.", InstallerLogFileName), "Email [email protected] with this file to help diagnose this issue.");
            }
            return(result);
        }
示例#8
0
        private async Task CheckForUpdates()
        {
            this.currentUpdate = await ChannelSession.Services.MixItUpService.GetLatestUpdate();

            if (this.currentUpdate != null)
            {
                if (App.AppSettings.PreviewProgram)
                {
                    MixItUpUpdateModel previewUpdate = await ChannelSession.Services.MixItUpService.GetLatestPreviewUpdate();

                    if (previewUpdate != null && previewUpdate.SystemVersion >= this.currentUpdate.SystemVersion)
                    {
                        this.currentUpdate = previewUpdate;
                    }
                }

                AutoUpdater.CheckForUpdateEvent += AutoUpdater_CheckForUpdateEvent;
                AutoUpdater.Start(this.currentUpdate.AutoUpdaterLink);
            }
        }
示例#9
0
        private async Task <bool> DownloadZipArchive(MixItUpUpdateModel update)
        {
            this.DisplayText1             = "Downloading files...";
            this.IsOperationIndeterminate = false;
            this.OperationProgress        = 0;

            bool downloadComplete = false;

            WebClient client = new WebClient();

            client.DownloadProgressChanged += (s, e) =>
            {
                this.OperationProgress = e.ProgressPercentage;
            };

            client.DownloadDataCompleted += (s, e) =>
            {
                downloadComplete       = true;
                this.OperationProgress = 100;
                if (e.Error == null && !e.Cancelled)
                {
                    ZipArchiveData = e.Result;
                }
                else if (e.Error != null)
                {
                    this.WriteToLogFile(e.Error.ToString());
                }
            };

            client.DownloadDataAsync(new Uri(update.ZipArchiveLink));

            while (!downloadComplete)
            {
                await Task.Delay(1000);
            }

            client.Dispose();

            return(ZipArchiveData != null && ZipArchiveData.Length > 0);
        }
示例#10
0
        private async Task CheckForUpdates()
        {
            this.currentUpdate = await ChannelSession.Services.MixItUpService.GetLatestUpdate();

            if (this.currentUpdate != null)
            {
                if (App.AppSettings.PreviewProgram)
                {
                    MixItUpUpdateModel previewUpdate = await ChannelSession.Services.MixItUpService.GetLatestPreviewUpdate();

                    if (previewUpdate != null && previewUpdate.SystemVersion >= this.currentUpdate.SystemVersion)
                    {
                        this.currentUpdate = previewUpdate;
                    }
                }

                if (this.currentUpdate.SystemVersion > Assembly.GetEntryAssembly().GetName().Version)
                {
                    updateFound = true;
                    UpdateWindow window = new UpdateWindow(this.currentUpdate);
                    window.Show();
                }
            }
        }
示例#11
0
        public async Task <bool> Run()
        {
            bool result = false;

            await Task.Run(async() =>
            {
                try
                {
                    if (!this.IsUpdate || await this.WaitForMixItUpToClose())
                    {
                        MixItUpUpdateModel update = await this.GetUpdateData();

                        if (this.IsPreview)
                        {
                            MixItUpUpdateModel preview = await this.GetUpdateData(preview: true);
                            if (preview != null && preview.SystemVersion > update.SystemVersion)
                            {
                                update = preview;
                            }
                        }

                        if (this.IsTest)
                        {
                            MixItUpUpdateModel test = await this.GetUpdateData(test: true);
                            if (test != null && test.SystemVersion > update.SystemVersion)
                            {
                                update = test;
                            }
                        }

                        if (update != null)
                        {
                            if (await this.DownloadZipArchive(update))
                            {
                                if (this.InstallMixItUp() && this.CreateMixItUpShortcut())
                                {
                                    result = true;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    this.WriteToLogFile(ex.ToString());
                }
            });

            if (!result && !this.ErrorOccurred)
            {
                if (!string.IsNullOrEmpty(this.SpecificErrorMessage))
                {
                    this.HyperlinkAddress = InstallerLogFileName;
                    this.ShowError(string.Format("{0} file created:", InstallerLogFileName), this.SpecificErrorMessage);
                }
                else
                {
                    this.HyperlinkAddress = InstallerLogFileName;
                    this.ShowError(string.Format("{0} file created:", InstallerLogFileName), "Please visit our support Discord or send an email to [email protected] with the contents of this file.");
                }
            }
            return(result);
        }