Beispiel #1
0
        /// <summary>
        /// Check if an update is available. If yes, show a Message Form.
        /// </summary>
        private void ExecCheckUpdates()
        {
            if (!Properties.Settings.Default.DisableUpdateCheck)
            {
                if (DateTime.Now.Subtract(Properties.Settings.Default.LastUpdateCheck).TotalDays > 1.0)
                {
                    Thread chkUpdtThread = new Thread(delegate()
                    {
                        Version localVersion;
                        Version remoteVersion;
                        bool errorPresent;
                        if (CheckUpdates.Exec(out localVersion, out remoteVersion, out errorPresent))
                        {
                            this.BeginInvoke((MethodInvoker) delegate()
                            {
                                using (NewVersion nv = new NewVersion())
                                {
                                    nv.LocalVersion  = localVersion;
                                    nv.RemoteVersion = remoteVersion;
                                    nv.ShowDialog(this);
                                }
                            });
                        }
                        Properties.Settings.Default.LastUpdateCheck = DateTime.Now;
                        Properties.Settings.Default.Save();
                    }
                                                      );

                    chkUpdtThread.IsBackground = true;
                    chkUpdtThread.Start();
                }
            }
        }
Beispiel #2
0
        private void ExecCheckNewVersion()
        {
            Version localVersion;

            _newveravailable = CheckUpdates.Exec(out localVersion, out _newversion, out _newversionerror);
            try
            {
                this.BeginInvoke((MethodInvoker) delegate() { this.ShowCheckNewVersionResult(); });
            }
            catch (Exception) { }   // the form could be closed during thread run
        }