Пример #1
0
        /// <summary>
        /// Re-create the linked list to reflect the new "workflow."
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        private void ReorganizeLinkedList(RouteModifier routeModifier)
        {
            WizardStepViewModel cacheCurrentStep         = this.CurrentLinkedListStep.Value;
            IEnumerable <WizardStepViewModel> newSubList = this.CreateNewStepList(routeModifier);

            this.LinkedSteps = new LinkedList <WizardStepViewModel>(newSubList);
            this.ResetCurrentLinkedListStepTo(cacheCurrentStep);
        }
Пример #2
0
        /// <summary>
        /// Reworks the list based on.
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        public void ReworkListBasedOn(RouteModifier routeModifier)
        {
            if (routeModifier == null)
            {
                return;
            }

            this.reconfiguringRoute = true;

            this.ReorganizeLinkedList(routeModifier);
            this.ResetListRelevancy();

            this.reconfiguringRoute = false;
        }
Пример #3
0
        /// <summary>
        /// Ensures the not modifying current step.
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        private void EnsureNotModifyingCurrentStep(RouteModifier routeModifier)
        {
            Func <Type, bool> currentStepCondition = t => t == this.CurrentLinkedListStep.Value.ViewType;

            if (routeModifier.ExcludeViewTypes != null)
            {
                routeModifier.ExcludeViewTypes.FirstOrDefault(currentStepCondition);
            }

            if (routeModifier.IncludeViewTypes != null)
            {
                routeModifier.IncludeViewTypes.FirstOrDefault(currentStepCondition);
            }
        }
Пример #4
0
        /// <summary>
        /// Creates the new step list.
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        /// <returns>A list of WizardStepViewModels.</returns>
        private IEnumerable <WizardStepViewModel> CreateNewStepList(RouteModifier routeModifier)
        {
            List <WizardStepViewModel> result = new List <WizardStepViewModel>(this.steps);

            this.EnsureNotModifyingCurrentStep(routeModifier);

            if (routeModifier.ExcludeViewTypes != null)
            {
                routeModifier.ExcludeViewTypes.ForEach(t => result.RemoveAll(step => step.ViewType == t));
            }

            if (routeModifier.IncludeViewTypes != null)
            {
                this.AddBack(result, routeModifier.IncludeViewTypes);
            }

            return(result);
        }
        /// <summary>
        /// Reworks the list based on.
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        public void ReworkListBasedOn(RouteModifier routeModifier)
        {
            if (routeModifier == null)
            {
                return;
            }

            this.reconfiguringRoute = true;

            this.ReorganizeLinkedList(routeModifier);
            this.ResetListRelevancy();

            this.reconfiguringRoute = false;
        }
        /// <summary>
        /// Re-create the linked list to reflect the new "workflow."
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        private void ReorganizeLinkedList(RouteModifier routeModifier)
        {
            WizardStepViewModel cacheCurrentStep = this.CurrentLinkedListStep.Value;
            IEnumerable<WizardStepViewModel> newSubList = this.CreateNewStepList(routeModifier);

            this.LinkedSteps = new LinkedList<WizardStepViewModel>(newSubList);
            this.ResetCurrentLinkedListStepTo(cacheCurrentStep);
        }
        /// <summary>
        /// Ensures the not modifying current step.
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        private void EnsureNotModifyingCurrentStep(RouteModifier routeModifier)
        {
            Func<Type, bool> currentStepCondition = t => t == this.CurrentLinkedListStep.Value.ViewType;

            if (routeModifier.ExcludeViewTypes != null)
            {
               routeModifier.ExcludeViewTypes.FirstOrDefault(currentStepCondition);
            }

            if (routeModifier.IncludeViewTypes != null)
            {
                routeModifier.IncludeViewTypes.FirstOrDefault(currentStepCondition);
            }
        }
        /// <summary>
        /// Creates the new step list.
        /// </summary>
        /// <param name="routeModifier">The route modifier.</param>
        /// <returns></returns>
        private IEnumerable<WizardStepViewModel> CreateNewStepList(RouteModifier routeModifier)
        {
            List<WizardStepViewModel> result = new List<WizardStepViewModel>(this.steps);

            this.EnsureNotModifyingCurrentStep(routeModifier);

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

            return result;
        }
        /// <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;
        }