コード例 #1
0
 private void ResponseReceived(string version)
 {
     try {
         if (parent.InvokeRequired)
         {
             parent.Invoke(new ResponseReceivedCallback(ResponseReceived), new object[] { version });
         }
         else
         {
             try {
                 if (CompareVersion(version, Application.ProductVersion) > 0)
                 {
                     StateSet?.Invoke(State.UpdateAvailable, Properties.Resources.MessageUpdateAvailable);   //If auto or silent check is performed the StateSet event is fired only if update is available!
                     if (checkType == CheckType.Auto && dialog == null || !dialog.Visible)
                     {
                         UpdateCheckForm updateCheckForm = new UpdateCheckForm(version);
                         dialog = updateCheckForm;
                         DialogCreated?.Invoke(this, updateCheckForm);
                         updateCheckForm.ShowDialog(parent);
                     }
                 }
             } catch (Exception exception) {
                 Debug.WriteLine(exception);
                 ErrorLog.WriteLine(exception);
             }
         }
     } catch (Exception exception) {
         Debug.WriteLine(exception);
         ErrorLog.WriteLine(exception);
     }
 }
コード例 #2
0
        public void Check(CheckType checkType)
        {
            this.checkType = checkType;
            switch (checkType)
            {
            case CheckType.User:
                if (dialog == null || !dialog.Visible)
                {
                    UpdateCheckForm updateCheckForm = new UpdateCheckForm(null);
                    updateCheckForm.Load          += new EventHandler(OnLoad);
                    updateCheckForm.StateSet      += new UpdateCheckForm.UpdateCheckFormEventHandler(OnStateSet);
                    updateCheckForm.HelpRequested += new HelpEventHandler(OnHelpRequested);
                    dialog = updateCheckForm;
                    DialogCreated?.Invoke(this, updateCheckForm);
                    StateSet?.Invoke(State.Connecting, Properties.Resources.MessageConnecting);     //The Connecting state is set in constructor of the form and event is not fired!
                    updateCheckForm.ShowDialog(parent);
                }
                break;

            default:
                timer.Start();
                break;
            }
        }