public PlanLinksViewModel(IPlanPresentable planElement) { Plans = new List<PlanLinkViewModel>(); if (planElement.PlanElementUIDs.Any()) { var allPlans = ShowOnPlanHelper.GetAllPlans(planElement); foreach (var paln in allPlans) { Plans.Add(new PlanLinkViewModel(paln.Key, paln.Value)); } } }
public static Dictionary<Plan, Guid> GetAllPlans(IPlanPresentable planElement) { Dictionary<Plan, Guid> planDictinary = new Dictionary<Plan, Guid>(); GetPlans().ForEach(x => { var element = x.AllElements.FirstOrDefault(y => planElement.PlanElementUIDs.Contains(y.UID) && !y.IsHidden ); if (element != null) planDictinary.Add(x, element.UID); }); return planDictinary; }
public static bool ShowObjectOnPlan(IPlanPresentable planElement) { if (planElement.PlanElementUIDs.Any()) { var plan = GetAllPlans(planElement).FirstOrDefault(); if (plan.Key != null) { ServiceFactory.Events.GetEvent<NavigateToPlanElementEvent>().Publish(new NavigateToPlanElementEventArgs(plan.Key.UID, plan.Value)); return false; } return true; } return true; }
public static bool CanShowOnPlan(IPlanPresentable planElement) { return planElement.PlanElementUIDs.Any() && GetAllPlans(planElement).Any(); }