Beispiel #1
0
        public Page PageFromState()
        {
            UpdateInstalledKitStatus();

            if (NoAuthToken())
            {
                return(login);
            }

            if (NoOrganizationSelected())
            {
                return(orgs);
            }

            if (ManualInitializationFlow())
            {
                return(manualInitialization);
            }

            RecreateKitInstance();

            if (PluginUpdateInProgress() && Update.PeriodicUpdateManager.IsPluginUpdateAvailable() && NoKitSelected())
            {
                return(updatePage);
            }

            if (ConflictResolutionInProgress() || ConflictResolutionInProgressPostUpdate())
            {
                if (HasConflictingDependencies(ConflictAgent()))
                {
                    return(conflictPage);
                }

                OnAllConflictsResolved();
            }

            if (KitUpdateInProgress())
            {
                if (KitUtils.IsKitInstalled(Settings.Instance.Kit))
                {
                    return(OnKitUpdateCompleted());
                }

                if (kit != null && Update.PeriodicUpdateManager.IsKitUpdateAvailable(kit.Name, kit.Instance.Version()) || kit == null)
                {
                    return(updatePage);
                }
                else
                {
                    CleanKitUpgrade(kit.Name);

                    // Trigger the kit flow.
                    Settings.Instance.FlowSequence = 0;
                }
            }

            if (NoKitSelected())
            {
                if (Settings.Instance.FlowSequence == (int)UpdateFlow.Plugin || LegacyUpdateFlow())
                {
                    CleanPluginUpgrade();
                }

                Settings.Instance.FlowSequence = 0;
                return(kitSelection);
            }

            // At this point, the kit is selected. If it does not exist in the installed kits list,
            // add it.

            AddKitToKitsList(kit.Name);
            return(DelegateToKitController() ?? kitSelection);
        }
Beispiel #2
0
        public Page PageFromState()
        {
            if (NoAuthToken())
            {
                return(login);
            }

            if (NoOrganizationSelected())
            {
                return(orgs);
            }

            if (KitIsActivated())
            {
                MarkKitAsInstalled();
            }

            RecreateKitInstance();

            if (PluginUpdateInProgress() && Update.PeriodicUpdateManager.IsPluginUpdateAvailable() && NoKitSelected())
            {
                return(updatePage);
            }

            if (KitUpdateInProgress())
            {
                if (KitUtils.IsKitInstalled(Settings.Instance.Kit))
                {
                    if (!Update.PeriodicUpdateManager.IsKitUpdateAvailable(kit.Name, kit.Instance.Version()))
                    {
                        // At this point, the upgrade is done for the given kit. Since this kit was previously
                        // installed, we do not need to go through the flow.

                        CleanKitUpgrade(kit.Name);
                        BackToKitSelection();
                        return(kitSelection);
                    }

                    // Waiting for the import to finish.
                    return(updatePage);
                }

                if (kit != null && Update.PeriodicUpdateManager.IsKitUpdateAvailable(kit.Name, kit.Instance.Version()) || kit == null)
                {
                    return(updatePage);
                }
                else
                {
                    CleanKitUpgrade(kit.Name);

                    // Trigger the kit flow.
                    Settings.Instance.FlowSequence = 0;
                }
            }

            if (NoKitSelected())
            {
                if (Settings.Instance.FlowSequence == (int)UpdateFlow.Plugin || LegacyUpdateFlow())
                {
                    CleanPluginUpgrade();
                }

                Settings.Instance.FlowSequence = 0;
                return(kitSelection);
            }

            Page page = null;
            KitControllerStatus status = kit.Instance.PageFromState(out page);

            switch (status)
            {
            case KitControllerStatus.NextPage:
                return(page);

            case KitControllerStatus.LastPage:
                return(validation);

            case KitControllerStatus.CurrentPage:
                Settings.Instance.Kit = "";
                break;
            }

            return(kitSelection);
        }