Esempio n. 1
0
        void SetConfigType(AlignmentMethodType methodType)
        {
            switch (methodType)
            {
            case AlignmentMethodType.Registration:
                methodTypeIcon.Image = RegistrationMethodIcon;
                break;

            case AlignmentMethodType.Anchors:
                methodTypeIcon.Image = AnchorMethodIcon;
                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;
            }
        }