Exemplo n.º 1
0
        private void CloseUpdateDownloadProgress()
        {
            if (InvokeRequired)
            {
                Invoke(new Action(CloseUpdateDownloadProgress));
            }
            else
            {
                m_updateWebClient.Dispose();
                m_updateDownloadProgress.Hide();
                m_updateDownloadProgress.Close();

                ApplicationUpdater applicationUpdater = new ApplicationUpdater(GetUpdateArchive(), AppDomain.CurrentDomain.BaseDirectory);
                if (!applicationUpdater.Execute())
                {
                    TextBoxForm form = new TextBoxForm(true, MessageBoxButtons.OK)
                    {
                        Text          = "Update Error",
                        HeaderText    = "The application was unable to update.Please download the update manually.",
                        DisplayText   = applicationUpdater.LastError,
                        StartPosition = FormStartPosition.CenterScreen
                    };

                    form.ShowDialog(this);
                }
            }
        }
Exemplo n.º 2
0
        private async Task CheckForAppUpdate()
        {
            try
            {
                ApplicationUpdate     applicationUpdate = new ApplicationUpdate(TimeSpan.FromSeconds(30));
                ApplicationUpdateInfo info = await applicationUpdate.GetUpdateApplicationInfo(Assembly.GetExecutingAssembly().GetName().Version);

                if (info != null)
                {
                    SetUpdateAvailable(info);
                }
                else
                {
                    ApplicationUpdater.CleanupUpdateFiles(AppDomain.CurrentDomain.BaseDirectory);
                }
            }
            catch
            {
                // no internet connection or bad connection, try again next time
            }
        }