private void ConfigureMethod(AlignmentMethod alignmentMethod) { switch (alignmentMethod.GetAlignmentMethodType) { case AlignmentMethodType.Anchors: AnchorAlignmentMethodForm anchorAlignmentMethodTool = new AnchorAlignmentMethodForm((AnchorAlignmentMethod)alignmentMethod, templateImage); anchorAlignmentMethodTool.OnConfigurationFinishedEvent += (AnchorAlignmentMethod anchorAlignmentMethod) => { AlignmentMethods[alignmentMethod.PipelineIndex] = anchorAlignmentMethod; anchorAlignmentMethodTool.Close(); }; anchorAlignmentMethodTool.ShowDialog(); break; case AlignmentMethodType.Registration: RegistrationAlignmentMethodForm registrationAlignmentMethodForm = new RegistrationAlignmentMethodForm((RegistrationAlignmentMethod)alignmentMethod, templateImage); registrationAlignmentMethodForm.OnConfigurationFinishedEvent += (RegistrationAlignmentMethod registrationAlignmentMethod) => { AlignmentMethods[alignmentMethod.PipelineIndex] = registrationAlignmentMethod; registrationAlignmentMethodForm.Close(); }; registrationAlignmentMethodForm.ShowDialog(); break; } }
private void AddMethodBtn_Click(object sender, EventArgs e) { newMethodName = createMethodNameTextBox.Text; if (!ValidateNewMethodName(newMethodName)) { return; } AlignmentMethodType alignmentMethodType = (AlignmentMethodType)comboBoxStateComboBox.SelectedIndex; switch (alignmentMethodType) { case AlignmentMethodType.Anchors: AnchorAlignmentMethodForm anchorAlignmentMethodTool = new AnchorAlignmentMethodForm(templateImage, AlignmentMethods.Count, newMethodName); anchorAlignmentMethodTool.OnConfigurationFinishedEvent += (AnchorAlignmentMethod anchorAlignmentMethod) => { AddMethod(anchorAlignmentMethod); anchorAlignmentMethodTool.Close(); NewMethodToggle = false; }; anchorAlignmentMethodTool.ShowDialog(); break; case AlignmentMethodType.Registration: RegistrationAlignmentMethodForm registrationAlignmentMethodForm = new RegistrationAlignmentMethodForm(templateImage, AlignmentMethods.Count, newMethodName); registrationAlignmentMethodForm.OnConfigurationFinishedEvent += (RegistrationAlignmentMethod registrationAlignmentMethod) => { AddMethod(registrationAlignmentMethod); registrationAlignmentMethodForm.Close(); NewMethodToggle = false; }; registrationAlignmentMethodForm.ShowDialog(); break; default: break; } }