Exemplo n.º 1
0
            internal void PropagateStart()
            {
                Debug.Assert(Service.DynamicStatus != null && Service.DynamicStatus.Value >= RunningStatus.Running);

                StartDependencyImpact impact = Service.ConfigSolvedImpact;

                if (TheOnlyPlugin != null)
                {
                    TheOnlyPlugin.DynamicStartBy(impact, PluginRunningStatusReason.StartedByRunningService);
                }
                else if (TheOnlyService != null)
                {
                    TheOnlyService.DynamicStartBy(ServiceRunningStatusReason.StartedByPropagation);
                }
                else
                {
                    foreach (var s in GetExcludedServices(impact))
                    {
                        Debug.Assert(s.DynamicStatus == null || s.DynamicStatus.Value <= RunningStatus.Stopped);
                        if (s.DynamicStatus == null)
                        {
                            s.DynamicStopBy(ServiceRunningStatusReason.StoppedByPropagation);
                        }
                    }
                    foreach (var s in GetIncludedServices(impact, false))
                    {
                        Debug.Assert(s.DynamicStatus == null || s.DynamicStatus.Value >= RunningStatus.Running);
                        if (s.DynamicStatus == null)
                        {
                            s.DynamicStartBy(ServiceRunningStatusReason.StartedByPropagation);
                        }
                    }
                }
            }
Exemplo n.º 2
0
            public bool PropagateSolvedStatus()
            {
                Debug.Assert(Service.FinalConfigSolvedStatus == SolvedConfigurationStatus.Running);
                if (TheOnlyPlugin != null)
                {
                    if (!TheOnlyPlugin.SetRunningStatus(PluginRunningRequirementReason.FromServiceToSinglePlugin))
                    {
                        if (!Service.Disabled)
                        {
                            Service.SetDisabled(ServiceDisabledReason.PropagationToSinglePluginFailed);
                        }
                        else
                        {
                            Service._configDisabledReason = ServiceDisabledReason.PropagationToSinglePluginFailed;
                        }
                        return(false);
                    }
                }
                else if (TheOnlyService != null)
                {
                    if (!TheOnlyService.SetRunningStatus(ServiceSolvedConfigStatusReason.FromServiceToSingleSpecialization))
                    {
                        if (!Service.Disabled)
                        {
                            Service.SetDisabled(ServiceDisabledReason.PropagationToSingleSpecializationFailed);
                        }
                        else
                        {
                            Service._configDisabledReason = ServiceDisabledReason.PropagationToSingleSpecializationFailed;
                        }
                        return(false);
                    }
                }
                else
                {
                    StartDependencyImpact impact = Service.ConfigSolvedImpact;
                    Debug.Assert(impact != StartDependencyImpact.Unknown && (impact & StartDependencyImpact.IsTryOnly) == 0);

                    foreach (var s in GetIncludedServices(impact, false))
                    {
                        if (!s.SetRunningStatus(ServiceSolvedConfigStatusReason.FromPropagation))
                        {
                            if (!Service.Disabled)
                            {
                                Service.SetDisabled(ServiceDisabledReason.PropagationToCommonPluginReferencesFailed);
                            }
                            else
                            {
                                Service._configDisabledReason = ServiceDisabledReason.PropagationToCommonPluginReferencesFailed;
                            }
                            return(false);
                        }
                    }
                    if (!Service.Disabled)
                    {
                        foreach (var s in GetExcludedServices(impact))
                        {
                            if (!s.Disabled)
                            {
                                s.SetDisabled(ServiceDisabledReason.StopppedByPropagation);
                            }
                        }
                    }
                }
                return(true);
            }