public override void Initialize() { base.Initialize(); _enabled = false; // disable by default if (this.ContextBase is IRegistrationWorkflowItemToolContext) { ((IRegistrationWorkflowItemToolContext)this.ContextBase).SelectionChanged += delegate { this.Enabled = (((IRegistrationWorkflowItemToolContext)this.ContextBase).SelectedItems != null && ((IRegistrationWorkflowItemToolContext)this.ContextBase).SelectedItems.Count == 1); }; } else if (this.ContextBase is IPatientSearchToolContext) { ((IPatientSearchToolContext)this.ContextBase).SelectedProfileChanged += delegate { IPatientSearchToolContext context = (IPatientSearchToolContext)this.ContextBase; this.Enabled = (context.SelectedProfile != null && context.SelectedProfile.PatientProfileRef != null); }; } else if (this.ContextBase is IPatientBiographyToolContext) { this.Enabled = true; } }
public void Apply() { if (this.ContextBase is IRegistrationWorkflowItemToolContext) { IRegistrationWorkflowItemToolContext context = (IRegistrationWorkflowItemToolContext)this.ContextBase; RegistrationWorklistItemSummary item = CollectionUtils.FirstElement(context.SelectedItems); if (Edit(item.PatientProfileRef, context.DesktopWindow)) { context.InvalidateSelectedFolder(); } } else if (this.ContextBase is IPatientSearchToolContext) { IPatientSearchToolContext context = (IPatientSearchToolContext)this.ContextBase; Edit(context.SelectedProfile.PatientProfileRef, context.DesktopWindow); } else if (this.ContextBase is IPatientBiographyToolContext) { IPatientBiographyToolContext context = (IPatientBiographyToolContext)this.ContextBase; Edit(context.PatientProfileRef, context.DesktopWindow); } }