Esempio n. 1
0
        private void CheckForUpdatesWithUserInteraction(bool notifyWhenNoUpdatesAvailable)
        {
            this.UpdateUI(() =>
            {
                CheckForUpdatesButton.Enabled = false;
                PatchListView.Focus();
            });
            var checkForUpdates = new Action(() =>
            {
                var newPatches = UpdatesManager.CheckForNewPatches(m_firmware.Definition, m_suitablePatches);
                this.UpdateUI(() =>
                {
                    CheckForUpdatesButton.Enabled = true;
                    if (newPatches == null || newPatches.Count == 0)
                    {
                        if (notifyWhenNoUpdatesAvailable)
                        {
                            InfoBox.Show("No updates available!");
                        }
                        return;
                    }

                    using (var newPatchesWindow = new PatchUpdatesAvailableWindow(m_firmware.Definition, newPatches))
                    {
                        if (newPatchesWindow.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        ReloadPatchesButton_Click(null, EventArgs.Empty);
                    }
                });
            });

            checkForUpdates.BeginInvoke(null, null);
        }
        private void CheckForUpdatesWithUserInteraction(bool notifyWhenNoUpdatesAvailable)
        {
            this.UpdateUI(() =>
            {
                CheckForUpdatesButton.Enabled = false;
                PatchListView.Focus();
            });
            var checkForUpdates = new Action(() =>
            {
                var newPatches = CheckForUpdates();
                this.UpdateUI(() =>
                {
                    CheckForUpdatesButton.Enabled = true;
                    if (newPatches == null || newPatches.Count == 0)
                    {
                        if (notifyWhenNoUpdatesAvailable)
                        {
                            InfoBox.Show("No updates available!");
                        }
                        return;
                    }

                    using (var newPatchesWindow = new PatchUpdatesAvailableWindow(m_firmware.Definition, newPatches))
                    {
                        if (newPatchesWindow.ShowDialog() != DialogResult.OK) return;
                        ReloadPatchesButton_Click(null, EventArgs.Empty);
                    }
                });
            });
            checkForUpdates.BeginInvoke(null, null);
        }