/// <summary>
 /// Constructor.
 /// </summary>
 public UpdateNotifyForm(UpdateAvailableEventArgs args)
     : this()
 {
     m_args = args;
 }
Beispiel #2
0
        /// <summary>
        /// Occurs when a program update is available. Display the information form to the user.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnUpdateAvailable(object sender, UpdateAvailableEventArgs e)
        {
            // Ensure it is invoked on the proper thread
            if (InvokeRequired)
            {
                Invoke(new MethodInvoker(() => OnUpdateAvailable(sender, e)));
                return;
            }

            // Did the user previously choose to ignore this version ?
            if (Settings.Updates.MostRecentDeniedUpgrade != null)
            {
                if (e.NewestVersion <= new Version(Settings.Updates.MostRecentDeniedUpgrade))
                    return;
            }

            // Notify the user and prompt him
            if (m_isShowingUpdateWindow)
                return;

            m_isShowingUpdateWindow = true;
            using (UpdateNotifyForm f = new UpdateNotifyForm(e))
            {
                f.ShowDialog();
                if (f.DialogResult == DialogResult.OK)
                {
                    m_isUpdating = true;
                    Settings.Save();
                    Close();
                }
            }
            m_isShowingUpdateWindow = false;
        }
 /// <summary>
 /// When an update is available, we update the informations.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UpdateNotifyForm_UpdateAvailable(object sender, UpdateAvailableEventArgs e)
 {
     m_args = e;
     UpdateInformation();
 }