/// <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 <bool> UpdateApplicationAsync()
        {
            WriteLog("===== UpdateApplication =====");

            try
            {
                pnlButtons.Enabled = false;

                bool result = await m_ClickOnce.UpdateAsync().ConfigureAwait(false);

                WriteLog(result ? "The version of this application has been updated." : "The version of this application was not updated.");

                return(result);
            }
            catch (Exception ex)
            {
                WriteExceptionLog(ex);
                return(false);
            }
            finally
            {
                WriteLog("");
                pnlButtons.Enabled = true;
            }
        }