Example #1
0
        private void newMatchButton_Click(object sender, EventArgs e)
        {
            bool screenTranslationAllowed = true;

            try
            {
                if (FileManipulation.GlobalFormMain._contentPanel.Controls.Count > 0)
                {
                    screenTranslationAllowed = checkSave();
                }
                if (screenTranslationAllowed)
                {
                    if (newMatchButton.Checked)
                    {
                        FormMatchConfig newExperiment = new FormMatchConfig("false");
                        FileManipulation.GlobalFormMain._contentPanel.Controls.Add(newExperiment);
                        newMatchButton.Checked = false;
                    }
                    else
                    {
                        /*do nothing*/
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #2
0
        private bool checkSave()
        {
            bool result = false;

            if (FileManipulation.GlobalFormMain._contentPanel.Controls[0] is FormMatchConfig)
            {
                DialogResult dialogResult = MessageBox.Show(LocRM.GetString("savePending", currentCulture), LocRM.GetString("savePendingTitle", currentCulture), MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    FormMatchConfig programToSave = (FormMatchConfig)(FileManipulation.GlobalFormMain._contentPanel.Controls[0]);
                    result = programToSave.save();
                }
                else
                {
                    FileManipulation.GlobalFormMain._contentPanel.Controls.Clear();
                    return(true);
                }
            }
            if (result == false)
            {
                FileManipulation.GlobalFormMain._contentPanel.Controls.Clear();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        private void editMatchButton_Click(object sender, EventArgs e)
        {
            bool screenTranslationAllowed = true;

            if (editMatchButton.Checked)
            {
                if (FileManipulation.GlobalFormMain._contentPanel.Controls.Count > 0)
                {
                    screenTranslationAllowed = checkSave();
                }
                if (screenTranslationAllowed)
                {
                    FormDefine   defineProgram;
                    DialogResult result;
                    string       editProgramName = "error";

                    try
                    {
                        defineProgram = new FormDefine(LocRM.GetString("editProgram", currentCulture), MatchingProgram.GetProgramsPath(), "prg", "program", false, false);
                        result        = defineProgram.ShowDialog();
                        if (result == DialogResult.OK)
                        {
                            editProgramName = defineProgram.ReturnValue;
                            FormMatchConfig configureProgram = new FormMatchConfig(editProgramName);
                            configureProgram.PrgName = editProgramName;
                            FileManipulation.GlobalFormMain._contentPanel.Controls.Add(configureProgram);
                            editMatchButton.Checked = false;
                        }
                        else
                        {
                            /*do nothing, user cancelled selection of program*/
                        }
                    }
                    catch (Exception ex) { MessageBox.Show(ex.Message); }
                }
            }
            else
            {
                /*do nothing*/
            }
        }