public void Show() { IConductor conductor = this.Parent as IConductor; if (conductor == null) { return; } conductor.ActivateItem(this); }
private IEnumerable <IResult> ActivateItem(IConductor parent, TItem item) { if (OpenResult.BeforeActivation != null) { yield return(new SequentialResult(OpenResult.BeforeActivation(item).GetEnumerator())); } yield return(new DelegateResult(() => parent.ActivateItem(item))); if (OpenResult.AfterActivation != null) { yield return(new SequentialResult(OpenResult.AfterActivation(item).GetEnumerator())); } }
public void Execute(ActionExecutionContext context) { if (_locateParent == null) { _locateParent = c => (IConductor)c.Target; } IConductor parent = _locateParent(context); TChild child = _locateChild(context); if (_onConfigure != null) { _onConfigure(child); } parent.ActivateItem(child); Completed(this, new ResultCompletionEventArgs()); }
public void Navigate <T>(params object[] parameters) where T : IScreen { if (_conductor == null) { throw new InvalidOperationException("You should initialize this service before use it"); } List <global::Autofac.Core.Parameter> typedParameters = new List <global::Autofac.Core.Parameter>(); foreach (var parameter in parameters) { var typedParameter = new TypedParameter(parameter.GetType(), parameter); typedParameters.Add(typedParameter); } var screen = (IScreen)_diContainer.Resolve(typeof(T), typedParameters); _conductor.ActivateItem(screen); }
/// <summary> /// Opens the specified screen. /// </summary> /// <param name="conductor">The conductor.</param> /// <param name="subjectSpecification">The subject.</param> /// <param name="callback">Is called with true if the screen is activated.</param> public static void ActivateSubject(this IConductor conductor, ISubjectSpecification subjectSpecification, Action <bool> callback) { var found = conductor.GetChildren() .OfType <IHaveSubject>() .FirstOrDefault(subjectSpecification.Matches); EventHandler <ActivationProcessedEventArgs> processed = null; processed = (s, e) => { conductor.ActivationProcessed -= processed; callback(e.Success); }; conductor.ActivationProcessed += processed; if (found != null) { conductor.ActivateItem(found); } else { subjectSpecification.CreateSubjectHost(viewModelFactory, conductor.ActivateItem); } }
public void Show() { Conductor.ActivateItem(this); }