public override void Activate() { base.Activate(); // Save original body side mPatientBodySide = Session.PatientBodySide; if (!InitManually) { IEnumerable <ManualMeasurementItem> measurements = null; var helper = new WizardMeasurementsHelper(); if (Parameter is string) { var wizard = helper.GetWizard((string)Parameter); if (wizard != null) { measurements = wizard.SelectedMeasurements; mSkipMeasurementIfCompleted = wizard.Skip; } } else if (Parameter is IEnumerable <ManualMeasurementItem> ) { measurements = Parameter as IEnumerable <ManualMeasurementItem>; mSkipMeasurementIfCompleted = (helper.GetWizard(measurements.FirstOrDefault()?.WizardName)?.Skip).GetValueOrDefault(false); } if (ValidateMeasurementsList(measurements)) { // Init Wizard View if (mWizardView == null && ProcedureContext.AllViews.TryGetValue("Wizard", out ViewRegistrar viewRegistrar)) { var parameter = new object[] { }; mWizardView = DynamicInitializer.New <IWizardView>(viewRegistrar.ViewType, parameter); mWizardView.Init(this, Session); mWizardView.Position = DockSide.Left; mWizardView.PositionInContainer = DockContainerSide.Center; DockItems = new List <IDockItem> { mWizardView }; } ProcedureContext.OnViewComponentChange(new ViewComponentChangeArgs(ViewComponents.OpenCC, 0)); // Select first procedure if (NextProcedure()) { Session.CurrentContext.ProcedureBegin -= ProcBegin; Session.CurrentContext.ProcedureBegin += ProcBegin; mbCanClose = false; return; } } Close(); } }
/// <summary> /// Lets user to know if specified procedure exist in the list /// </summary> /// <param name="list">Wizard measurements list</param> /// <param name="procName">procedure name</param> /// <param name="bodyside">procedure bodyside</param> /// <returns>Returns True if procedure with specific body side present in the list, False otherwise</returns> protected bool ContainsMeasurement(List <ManualMeasurementItem> list, string procName, PatientsBodySide bodyside) { bool result = false; if (list != null) { result = list.Where(l => l.ProcName == procName && (l.BodySide == bodyside || (!l.BodySide.HasValue && Session.PatientBodySide == bodyside))).FirstOrDefault() != null; } return(result); }