/// <summary>
        /// Update this application.
        /// </summary>
        /// <returns></returns>
        internal async Task <bool> UpdateAsync()
        {
            if (!m_ClickOnce.IsNetworkDeployed)
            {
                WriteLog("This application is not a ClickOnce application.");
                return(false);
            }

            ShowApplicationInformation(m_ClickOnce);

            IClickOnceUpdateInfo info = await m_ClickOnce.CheckForUpdateAsync().ConfigureAwait(false);

            if (!info.UpdateAvailable)
            {
                WriteLog("This application is the latest version.");
                return(false);
            }

            if (!await m_ClickOnce.UpdateAsync().ConfigureAwait(false))
            {
                WriteLog("This application was not updated.");
                return(false);
            }

            ShowApplicationInformation(m_ClickOnce);

            return(true);
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private async Task CheckForUpdateAsync()
        {
            WriteLog("===== CheckForUpdateAsync =====");

            try
            {
                pnlButtons.Enabled = false;

                IClickOnceUpdateInfo info = await m_ClickOnce.CheckForUpdateAsync().ConfigureAwait(false);

                WriteLog(string.Format("AvailableVersion = {0}", info.AvailableVersion));
                WriteLog(string.Format("IsUpdateRequired = {0}", info.IsUpdateRequired));
                WriteLog(string.Format("MinimumRequiredVersion = {0}", info.MinimumRequiredVersion));
                WriteLog(string.Format("UpdateAvailable = {0}", info.UpdateAvailable));
                WriteLog(string.Format("UpdateSizeBytes = {0}", info.UpdateSizeBytes));
            }
            catch (Exception ex)
            {
                WriteExceptionLog(ex);
            }
            finally
            {
                WriteLog("");
                pnlButtons.Enabled = true;
            }
        }