/// <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.GetConductedItems() .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); }
/// <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); } }
/// <summary> /// Initializes a new instance of the <see cref="OpenScreenSubjectResult"/> class. /// </summary> /// <param name="subjectSpecification">The subject specification.</param> public OpenScreenSubjectResult(ISubjectSpecification subjectSpecification) { this.subjectSpecification = subjectSpecification; }
/// <summary> /// Shows a modal dialog base on an <see cref="ISubjectSpecification"/>. /// </summary> /// <param name="subjectSpecification">The subject specification.</param> /// <returns>The result.</returns> public static DialogScreenSubjectResult DialogSubject(ISubjectSpecification subjectSpecification) { return(new DialogScreenSubjectResult(subjectSpecification)); }
/// <summary> /// Shows a child based on a <see cref="ISubjectSpecification"/>. /// </summary> /// <param name="subjectSpecification">The subject specification.</param> /// <returns>The result.</returns> public static OpenScreenSubjectResult ChildSubject(ISubjectSpecification subjectSpecification) { return(new OpenScreenSubjectResult(subjectSpecification)); }