BrowserSelect.UpdateChecker.check C# (CSharp) Метод

check() публичный Метод

public check ( ) : void
Результат void
        public void check()
        {
            if (new_version())
                Settings.Default.last_version = last_version;
            if (Settings.Default.check_update != "nope")
                Settings.Default.check_update = Program.time().ToString();
            Settings.Default.Save();
        }

Usage Example

Пример #1
0
        private void btn_check_update_Click(object sender, EventArgs e)
        {
            var btn = ((Button)sender);
            var uc  = new UpdateChecker();

            // color the button to indicate request, disable it to prevent multiple instances
            btn.BackColor = Color.Blue;
            btn.Enabled   = false;
            // run inside a Task to prevent freezing the UI
            Task.Factory.StartNew(() => uc.check()).ContinueWith(x =>
            {
                try
                {
                    if (uc.Checked)
                    {
                        if (uc.Updated)
                        {
                            MessageBox.Show(String.Format(
                                                "New Update Available!\nCurrent Version: {1}\nLast Version: {0}" +
                                                "\nto Update download and install the new version from project's github.",
                                                uc.LVer, uc.CVer));
                        }
                        else
                        {
                            MessageBox.Show("You are running the lastest version.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Unable to check for updates.\nPlease make sure you are connected to internet.");
                    }
                    btn.UseVisualStyleBackColor = true;
                    btn.Enabled = true;
                }
                catch (Exception) { }
                return(x);
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }
All Usage Examples Of BrowserSelect.UpdateChecker::check