/****************** CONSTRUCTOR ******************/ public EventSettingForm(MacroForm MacroForm) { InitializeComponent();//Initialize the Form #region Initialize attributes #region Initialize primitive attributes //Initialize attributes m_MacroForm = MacroForm; m_numberID_RadioButtonOptionSpeed = 1; #endregion #endregion }
/****************** CONSTRUCTOR ******************/ public ChooseEventsToExport(MacroForm MacroForm) { InitializeComponent();//Initialize the Form #region Initialize attributes #region Initialize primitive attributes //Initialize attributes m_MacroForm = MacroForm; m_numberID = 0; m_listOfCheckBox = new List <System.Windows.Forms.CheckBox>(); #endregion #endregion #region For each CheckBox in the MacroForm, create a CheckBox dynamically //For each CheckBox in the MacroForm, create a CheckBox dynamically foreach (RadioButton element in MacroForm.getm_listOfRadioButton()) { #region Create new CheckBox variable, set it is name dynamically and update variable //Create new CheckBox dynamically m_numberID++; //Increment the number of event System.Windows.Forms.CheckBox radb = new System.Windows.Forms.CheckBox(); //Create a CheckBox radb.Text = "Event" + m_numberID; //Set the text of CheckBox with the name Event following by the number of events Point lastLocationCheckBox = new System.Drawing.Point(0, 0); //Create a variable of type Point #endregion #region Store in the variable lastLocationCheckBox the location of the last CheckBox. //For each component in ScrollPanel of ChooseEventsToExport Form, we store the last location of checkbox foreach (object o in ScrollPanel.Controls) { //If the component is a RadioButton (i.e: If the type of component is a CheckBox). if (o is System.Windows.Forms.CheckBox) { System.Windows.Forms.CheckBox currentCheckBox = (System.Windows.Forms.CheckBox)o; //Stock the component (which is a RadioButton) on a variable called currentRadioButton. lastLocationCheckBox = currentCheckBox.Location; //Set the variable lastLocationCheckBox with the location of the current CheckBox. } } #endregion #region Set the position of the new CheckBox //If it is the first record if (m_numberID == 1) { radb.Location = new System.Drawing.Point(10, 0);//Set the position of CheckBox in the chooseEventsToExport Form } //If it is not the first record else { radb.Location = new System.Drawing.Point(10, lastLocationCheckBox.Y + 30);//Set the position of CheckBox in the chooseEventsToExport Form } #endregion radb.Checked = true;//Check current CheckBox. #region Add the new CheckBox to the ScrollPanel ScrollPanel.Controls.Add(radb);//Add CheckBox in panel called ScrollPanel in ChooseEventsToExport Form #endregion #region Add the new CheckBox to the list m_listOfCheckBox m_listOfCheckBox.Add(radb);//Add the new CheckBox to the list m_listOfCheckBox #endregion } #endregion }
/****************** CONSTRUCTOR ******************/ // Constructor of ASR (Automatic Speech Recognition) public ASR(MacroForm mainWindowIterum) { m_mainWindowIterum = mainWindowIterum; //Initialise member attributes StartEngine(); //Start the speech Recognition Engine }