private void CheckUpdate()
        {
            Log.Write("{0}: Request update check", GetType().Name);
            Thread T = new Thread(delegate()
            {
                //DEBUG ONLY, FORCE UPDATE
                var U = Program.DEBUG || UpdateHandler.HasUpdate();
                if (U)
                {
                    Log.Write("{0}: Update available. Downloading...", GetType().Name);
                    if (UpdateHandler.DownloadUpdate())
                    {
                        Log.Write("{0}: Update download success", GetType().Name);
                        Invoke((MethodInvoker) delegate()
                        {
                            updateAvailableToolStripMenuItem.Visible = true;
                        });
                    }
                    else
                    {
                        Log.Write("{0}: Update download failed", GetType().Name);
                    }
                }
                else
                {
                    Log.Write("{0}: No update found", GetType().Name);
                }
            });

            T.IsBackground = true;
            T.Start();
        }
Esempio n. 2
0
        /// <summary>
        /// Performs an update check
        /// </summary>
        private void CheckUpdate(bool silent)
        {
            Log.Write("{0}: Request update check", GetType().Name);
            Thread T = new Thread(delegate()
            {
                //DEBUG ONLY, FORCE UPDATE
                var U = Program.DEBUG || UpdateHandler.HasUpdate();
                if (U)
                {
                    Log.Write("{0}: Update available. Downloading...", GetType().Name);
                    if (UpdateHandler.DownloadUpdate())
                    {
                        Log.Write("{0}: Update download success", GetType().Name);
                        Invoke((MethodInvoker) delegate()
                        {
                            checkForUpdatesToolStripMenuItem.Text    = "Update check complete";
                            updateAvailableToolStripMenuItem.Visible = true;
                            checkForUpdatesToolStripMenuItem.Visible = false;
                            if (!silent)
                            {
                                MessageBox.Show("An update is available. Click the 'update available' menu to install it.", "Update check", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            }
                        });
                    }
                    else
                    {
                        Log.Write("{0}: Update download failed", GetType().Name);
                        if (!silent)
                        {
                            Invoke((MethodInvoker) delegate()
                            {
                                MessageBox.Show("An update is available but the download failed.", "Update check", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                checkForUpdatesToolStripMenuItem.Text    = "Retry update check";
                                checkForUpdatesToolStripMenuItem.Enabled = true;
                            });
                        }
                    }
                }
                else
                {
                    Log.Write("{0}: No update found", GetType().Name);
                    if (!silent)
                    {
                        Invoke((MethodInvoker) delegate()
                        {
                            MessageBox.Show("No update is available", "Update check", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        });
                    }
                }
            });

            T.IsBackground = true;
            T.Start();
        }