Пример #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();
                }
            }
        }
Пример #2
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();
                }
            }
        }