예제 #1
0
        private void checkForUpdatesBckgWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e)
        {
            if (Recorder.Instance.IsRecording)
            {
                this.toolStripStatusStateLabel.Text = "Recording...";
            }
            else
            {
                this.toolStripStatusStateLabel.Text = "";
            }

            CheckForUpdatesResult res = (CheckForUpdatesResult)e.Result;

            if (!res.succeeded)
            {
                // An error occured or product is up to date.
                MessageBox.Show(this, res.messsage, CatStudioConstants.TWEBST_PRODUCT_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                if (res.isUpToDate)
                {
                    MessageBox.Show(this, res.messsage, CatStudioConstants.TWEBST_PRODUCT_NAME, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    DialogResult dlgRes = MessageBox.Show(this, res.messsage, CatStudioConstants.TWEBST_PRODUCT_NAME, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (DialogResult.Yes == dlgRes)
                    {
                        this.OpenURL(res.downloadUrl);
                    }
                }
            }
        }
예제 #2
0
        private void checkForUpdatesBckgWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.Load(CatStudioConstants.TWEBST_CHECK_UPDATES_URL);

                String lastSiteVer = xmlDoc.DocumentElement.GetAttribute(CatStudioConstants.CHECK_UPDATES_VERSION_ATTR);
                String downloadURL = xmlDoc.DocumentElement.GetAttribute(CatStudioConstants.CHECK_UPDATES_DOWNLOAD_URL_ATTR);

                if (lastSiteVer.CompareTo(CoreWrapper.Instance.productVersion) > 0)
                {
                    String msg = String.Format("A new version ({0}) of {1} is available at {2}\n\nDo you want to download it now?", lastSiteVer, CatStudioConstants.TWEBST_PRODUCT_NAME, downloadURL);
                    CheckForUpdatesResult res = new CheckForUpdatesResult(true, false, msg);

                    res.downloadUrl = downloadURL;
                    e.Result        = res;
                }
                else
                {
                    String msg = String.Format("{0} is up to date ({1})", CatStudioConstants.TWEBST_PRODUCT_NAME, CoreWrapper.Instance.productVersion);
                    e.Result = new CheckForUpdatesResult(true, true, msg);
                }
            }
            catch (Exception ex)
            {
                e.Result = new CheckForUpdatesResult(false, false, "Check for updates failed: " + ex.Message);
            }
        }
예제 #3
0
        private void checkForUpdatesBckgWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            XmlDocument xmlDoc = new XmlDocument();

            try
            {
                xmlDoc.Load(CatStudioConstants.TWEBST_CHECK_UPDATES_URL);

                String lastSiteVer = xmlDoc.DocumentElement.GetAttribute(CatStudioConstants.CHECK_UPDATES_VERSION_ATTR);
                String downloadURL = xmlDoc.DocumentElement.GetAttribute(CatStudioConstants.CHECK_UPDATES_DOWNLOAD_URL_ATTR);

                if (lastSiteVer.CompareTo(CoreWrapper.Instance.productVersion) > 0)
                {
                    String                msg = String.Format("A new version ({0}) of {1} is available at {2}\n\nDo you want to download it now?", lastSiteVer, CatStudioConstants.TWEBST_PRODUCT_NAME, downloadURL);
                    CheckForUpdatesResult res = new CheckForUpdatesResult(true, false, msg);

                    res.downloadUrl = downloadURL;
                    e.Result        = res;
                }
                else
                {
                    String msg = String.Format("{0} is up to date ({1})", CatStudioConstants.TWEBST_PRODUCT_NAME, CoreWrapper.Instance.productVersion);
                    e.Result = new CheckForUpdatesResult(true, true, msg);
                }
            }
            catch (Exception ex)
            {
                e.Result = new CheckForUpdatesResult(false, false, "Check for updates failed: " + ex.Message);
            }
        }