Exemplo n.º 1
0
        public void Initialize(AppConfiguration appConfig, ApplicationUpdateInfo info)
        {
            m_info      = info;
            m_appConfig = appConfig;

            lblVersion.Text = string.Format("{0} - {1}", m_info.Version.ToString(), m_info.ReleaseDate.ToShortDateString());
        }
Exemplo n.º 2
0
 private void SetUpdateAvailable(ApplicationUpdateInfo info)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <ApplicationUpdateInfo>(SetUpdateAvailable), new object[] { info });
     }
     else
     {
         btnUpdate.Visible = true;
         btnUpdate.GlowOnce();
         m_updateControl.Initialize(AppConfiguration, info);
     }
 }
Exemplo n.º 3
0
 private void StartUpdateDownload(ApplicationUpdateInfo info)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <ApplicationUpdateInfo>(StartUpdateDownload), new object[] { info });
     }
     else
     {
         m_updateWebClient = new WebClient();
         m_updateWebClient.DownloadProgressChanged += WebClient_DownloadProgressChanged;
         m_updateWebClient.DownloadFileCompleted   += WebClient_DownloadFileCompleted;
         m_updateWebClient.DownloadFileAsync(new Uri(info.DownloadUrl), GetUpdateArchive());
     }
 }
Exemplo n.º 4
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
            }
        }