コード例 #1
0
        public AutoUpdateController(IHelper aHelper, AutoUpdate aAutoUpdate, OptionPageUpdates aOptionPageUpdates, IViewAutoUpdate aView, IInvoker aInvoker)
        {
            iAutoUpdate        = aAutoUpdate;
            iOptionPageUpdates = aOptionPageUpdates;
            iView    = aView;
            iInvoker = aInvoker;

            iModel = new AutoUpdateModel(aHelper.Title);

            iAutoUpdate.EventUpdateProgress += UpdateProgress;
            iAutoUpdate.EventUpdateFailed   += UpdateFailed;
            iAutoUpdate.EventUpdateFound    += UpdateFound;

            iOptionPageUpdates.EventAutoUpdateChanged += AutoUpdateChanged;

            iView.EventClosed += ViewClosed;
            iView.EventButtonUpdateClicked    += ButtonUpdateClicked;
            iView.EventButtonAutoCheckClicked += ButtonAutoCheckClicked;

            AutoUpdateChanged(this, EventArgs.Empty);
        }
コード例 #2
0
 public bool ShowCompatibilityBreak(AutoUpdateModel aModel)
 {
     return(ShowCompatibilityBreak("Update", "Cancel",
                                   "This is a compatibility family upgrade. Do you wish to continue with the upgrade?",
                                   "Updating " + aModel.UpdateInfo.Name + " to a new compatibility family will also require updating Linn DS firmware."));
 }
コード例 #3
0
 public void ProgressChanged(AutoUpdateModel aModel)
 {
     ProgressValue = aModel.DownloadProgress;
 }
コード例 #4
0
        public void StateChanged(AutoUpdateModel aModel)
        {
            switch (aModel.State)
            {
            case AutoUpdateModel.EState.eChecking:
                Text1           = "Checking for updates...";
                Text2           = "";
                ButtonCloseText = "Cancel";

                StartProgress(true);
                ProgressHidden = false;

                ButtonDetailsEnabled = false;
                ButtonUpdateEnabled  = false;
                ButtonCloseEnabled   = true;
                SetButtonCloseAsDefault();
                ButtonAutoCheckHidden = true;
                WindowHidden          = false;
                break;

            case AutoUpdateModel.EState.eUnavailable:
                StopProgress();
                ProgressHidden = true;

                Text1           = string.Format("{0} is up to date.", aModel.ProductName);
                Text2           = "";
                ButtonCloseText = "Close";

                ButtonDetailsEnabled = false;
                ButtonUpdateEnabled  = false;
                ButtonCloseEnabled   = true;
                SetButtonCloseAsDefault();
                ButtonAutoCheckHidden = false;
                break;

            case AutoUpdateModel.EState.eAvailable:
                StopProgress();
                ProgressHidden = true;

                if (aModel.UpdateInfo.UpdateType != AutoUpdate.EUpdateType.Stable)
                {
                    Text1 = string.Format("There is a new version of {0} ({1} {2}) available.", aModel.UpdateInfo.Name, aModel.UpdateInfo.UpdateType, aModel.UpdateInfo.Version);
                }
                else
                {
                    Text1 = string.Format("There is a new version of {0} ({1}) available.", aModel.UpdateInfo.Name, aModel.UpdateInfo.Version);
                }
                Text2           = "Do you wish to update?";
                ButtonCloseText = "Not Now";

                ButtonDetailsEnabled = true;
                ButtonUpdateEnabled  = true;
                ButtonCloseEnabled   = true;
                SetButtonUpdateAsDefault();
                ButtonAutoCheckHidden = false;
                WindowHidden          = false;

                WebViewUri = aModel.UpdateInfo.History.AbsoluteUri;
                break;

            case AutoUpdateModel.EState.eDownloading:
                StartProgress(false);
                ProgressHidden = false;

                Text1           = string.Format("Downloading {0} ({1}).", aModel.UpdateInfo.Name, aModel.UpdateInfo.Version);
                Text2           = "";
                ButtonCloseText = "Cancel";

                ButtonDetailsEnabled  = true;
                ButtonCloseEnabled    = true;
                ButtonUpdateEnabled   = false;
                ButtonAutoCheckHidden = true;
                break;

            case AutoUpdateModel.EState.ePreparingToUpdate:
                StartProgress(true);
                ProgressHidden = false;

                Text1 = string.Format("Updating {0} to {1}.", aModel.UpdateInfo.Name, aModel.UpdateInfo.Version);
                Text2 = "";

                ButtonDetailsEnabled  = false;
                ButtonUpdateEnabled   = false;
                ButtonCloseEnabled    = false;
                ButtonAutoCheckHidden = true;
                break;

            case AutoUpdateModel.EState.eFailed:
                StopProgress();
                ProgressHidden = false;
                ProgressValue  = 0;

                Text1           = string.Format("The update failed.");
                Text2           = "";
                ButtonCloseText = "Close";

                ButtonDetailsEnabled = false;
                ButtonUpdateEnabled  = false;
                ButtonCloseEnabled   = true;
                SetButtonCloseAsDefault();
                ButtonAutoCheckHidden = true;
                break;

            case AutoUpdateModel.EState.eUpdateStarted:
                WindowHidden = true;
                break;
            }
        }