Пример #1
0
        private void FormAbout_Load(object sender, EventArgs e)
        {
            this.GetAssemblyAttributes ();

            this.Text = _assemblyTitle;

            ApplicationVersion appVersion = new ApplicationVersion(_assemblyVersion);

            labelVersion.Text += appVersion.ToString();

            lnkCompanyName.Text  = _assemblyCompany;

            labelCopyright.Text = _assemblyCopyright;
        }
Пример #2
0
        // Callback method must have the same signature as the
        // AsyncCallback delegate.
        private void CallbackCheckForNewMyZillaVersion(IAsyncResult ar)
        {
            // Retrieve the delegate.
            AsyncCheckForNewMyZillaVersion dlgt = (AsyncCheckForNewMyZillaVersion)ar.AsyncState;

            // Call EndInvoke to retrieve the results.
            object[] result = dlgt.EndInvoke(ar);

            string publishedMyZillaVersion = result[0] as string;
            bool forceCheck = (result[1] == null ? false : (bool)result[1]);
            Form owner = result[2] as Form;

            if (!String.IsNullOrEmpty(publishedMyZillaVersion))
            {
                ApplicationVersion publishedVersion = new ApplicationVersion(publishedMyZillaVersion);
                ApplicationVersion applicationInstanceVersion = new ApplicationVersion(Application.ProductVersion);

                MyZillaSettingsDataSet _appSettings = MyZillaSettingsDataSet.CreateInstance(Utils.UserAppDataPath);

                MyZillaSettingsDataSet.GlobalSettingsRow settings = _appSettings.GetGlobalSettings();

                if (forceCheck || (publishedVersion > (new ApplicationVersion(settings.LastMyZillaVersion))))
                {

                    if (publishedVersion > applicationInstanceVersion)
                    {
                        FormNewVersion newVersion = new FormNewVersion(publishedVersion.ToString());

                        if (this.InvokeRequired)
                        {
                            this.BeginInvoke(new MethodInvoker(delegate()
                            {
                                newVersion.ShowDialog(this);
                            }));
                        }
                    }
                    else
                    {
                        if (forceCheck)
                        {
                            if (owner.InvokeRequired)
                            {
                                this.BeginInvoke(new MethodInvoker(delegate()
                                {
                                    MessageBox.Show(owner, "No update is available!", "MyZilla", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                }));

                            }
                        }
                    }
                }
            }
        }