コード例 #1
0
ファイル: Updater.cs プロジェクト: sandeepbeniwal/Kinovea
        private void mnuCheckForUpdatesOnClick(object sender, EventArgs e)
        {
            NotificationCenter.RaiseStopPlayback(this);

            // Download the update configuration file from the webserver.
            HelpIndex hiRemote = new HelpIndex(Software.RemoteHelpIndex);

            if (!hiRemote.LoadSuccess)
            {
                MessageBox.Show(UpdaterLang.Updater_InternetError, UpdaterLang.Updater_Title, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            // Check if we are up to date.
            bool testUpdate = false;
            ThreePartsVersion currentVersion = new ThreePartsVersion(Software.Version);

            if (hiRemote.AppInfos.Version > currentVersion || testUpdate)
            {
                // We are not up to date, display the full dialog.
                // The dialog is responsible for displaying the download success msg box.
                UpdateDialog2 ud = new UpdateDialog2(hiRemote);
                ud.ShowDialog();
                ud.Dispose();
            }
            else
            {
                MessageBox.Show(UpdaterLang.Updater_UpToDate, UpdaterLang.Updater_Title, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
        private void mnuCheckForUpdatesOnClick(object sender, EventArgs e)
        {
            // Stop playing if needed.
            DelegatesPool dp = DelegatesPool.Instance();

            if (dp.StopPlaying != null)
            {
                dp.StopPlaying();
            }

            // Download the update configuration file from the webserver.
            HelpIndex hiRemote;

            if (PreferencesManager.ExperimentalRelease)
            {
                hiRemote = new HelpIndex("http://www.kinovea.org/setup/updatebeta.xml");
            }
            else
            {
                hiRemote = new HelpIndex("http://www.kinovea.org/setup/update.xml");
            }

            if (hiRemote.LoadSuccess)
            {
                if (dp.DeactivateKeyboardHandler != null)
                {
                    dp.DeactivateKeyboardHandler();
                }

                // Check if we are up to date.
                ThreePartsVersion currentVersion = new ThreePartsVersion(PreferencesManager.ReleaseVersion);
                if (hiRemote.AppInfos.Version > currentVersion)
                {
                    // We are not up to date, display the full dialog.
                    // The dialog is responsible for displaying the download success msg box.
                    UpdateDialog2 ud = new UpdateDialog2(hiRemote);
                    ud.ShowDialog();
                    ud.Dispose();
                }
                else
                {
                    // We are up to date, display a simple confirmation box.
                    MessageBox.Show(UpdaterLang.Updater_UpToDate, UpdaterLang.Updater_Title,
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }

                if (dp.ActivateKeyboardHandler != null)
                {
                    dp.ActivateKeyboardHandler();
                }
            }
            else
            {
                // Remote connection failed, we are probably firewalled.
                MessageBox.Show(resManager.GetString("Updater_InternetError", Thread.CurrentThread.CurrentUICulture),
                                resManager.GetString("Updater_Title", Thread.CurrentThread.CurrentUICulture),
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation);
            }
        }