/// <summary>
        /// Re-create the linked list to reflect the new "workflow."
        /// </summary>
        /// <param name="rm">The rm.</param>
        private void ReorganizeLinkedList(RouteModifier rm)
        {
            var cacheCurrentStep = CurrentLinkedListStep.Value;
            var newSubList       = CreateNewStepList(rm);

            // Re-create linked list.
            _linkedSteps = new LinkedList <CompleteStep <WizardBusinessObject> >(newSubList);
            ResetCurrentLinkedListStepTo(cacheCurrentStep);
        }
 /// <summary>
 /// Reworks the list based on.
 /// </summary>
 /// <param name="rm">The rm.</param>
 public void ReworkListBasedOn(RouteModifier rm)
 {
     if (rm == null)
     {
         return;
     }
     _reconfiguringRoute = true;
     ReorganizeLinkedList(rm);
     ResetListRelevancy();
     _reconfiguringRoute = false;
 }
        /// <summary>
        /// Ensures the not modifying current step.
        /// </summary>
        /// <param name="rm">The rm.</param>
        private void EnsureNotModifyingCurrentStep(RouteModifier rm)
        {
            Func <Type, bool> currentStepCondition = t => t == CurrentLinkedListStep.Value.ViewType;

            if (rm.ExcludeViewTypes != null)
            {
                Contract.Ensures(rm.ExcludeViewTypes.FirstOrDefault(currentStepCondition) == null);
            }
            if (rm.IncludeViewTypes != null)
            {
                Contract.Ensures(rm.IncludeViewTypes.FirstOrDefault(currentStepCondition) == null);
            }
        }
        /// <summary>
        /// Creates the new step list.
        /// </summary>
        /// <param name="rm">The rm.</param>
        /// <returns></returns>
        private List <CompleteStep <WizardBusinessObject> > CreateNewStepList(RouteModifier rm)
        {
            var result = new List <CompleteStep <WizardBusinessObject> >(_linkedSteps);

            EnsureNotModifyingCurrentStep(rm);

            if (rm.ExcludeViewTypes != null)
            {
                rm.ExcludeViewTypes.ForEach(t => result.RemoveAll(step => step.ViewType.Equals(t)));
            }
            if (rm.IncludeViewTypes != null)
            {
                AddBack(result, rm.IncludeViewTypes);
            }

            return(result);
        }
Example #5
0
        /// <summary>
        /// Gets the route modifier.
        /// </summary>
        /// <param name="frameworkType">Type of the framework.</param>
        /// <returns>The RouteModifier.</returns>
        public RouteModifier GetRouteModifier(FrameworkType frameworkType)
        {
            RouteModifier routeModifier = new RouteModifier
            {
                ExcludeViewTypes = new List <Type>()
            };

            //// if no framework we cant setup up the viewmodels and views.
            if (frameworkType == FrameworkType.NoFramework)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(ViewsControl));
                routeModifier.ExcludeViewTypes.Add(typeof(PluginsControl));
            }

            if (frameworkType == FrameworkType.XamarinForms)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(PluginsControl));
            }

            if (this.cachingService.HasNinjaNugetPackages == false &&
                this.cachingService.HasNinjaCommunityNugetPackages == false &&
                this.cachingService.HasLocalNugetPackages == false)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(NinjaCoderOptionsControl));
            }

            IEnumerable <Plugin> samplePlugins = this.cachingService.ApplicationSamplePlugIns;

            if (samplePlugins != null &&
                samplePlugins.Any() == false)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(ApplicationSamplesOptionsControl));
            }

            if (this.cachingService.XamarinFormsLabsNugetPackageRequested == false)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(XamarinFormsLabsControl));
            }

            if (this.settingsService.AddProjectsSkipViewOptions)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(ViewsControl));
            }

            if (this.settingsService.AddProjectsSkipNinjaCoderOptions)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(NinjaCoderOptionsControl));
            }

            if (this.settingsService.AddProjectsSkipApplicationOptions)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(ApplicationOptionsControl));
                routeModifier.ExcludeViewTypes.Add(typeof(ApplicationSamplesOptionsControl));
            }

            if (this.settingsService.AddProjectsSkipMvvmCrossPluginOptions)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(PluginsControl));
            }

            if (this.settingsService.AddProjectsSkipNugetPackageOptions)
            {
                routeModifier.ExcludeViewTypes.Add(typeof(NugetPackagesControl));
            }

            return(routeModifier);
        }