private Label m_passFailElemName;      // the pass/fail element we are collecting

        public ColumnPropertiesListEntry(ColumnProperties cp)
        {
            GBox = new GroupBox();                                      // initializing fields
            configureGroupBox();                                        // configure groupbox
            Label dataSelectionCriteria = getDataSelectionCriteria(cp); // call method to populate method with correct data
            Label xmlData = getXMLDataLabel(cp);
            Label cpName  = getColPropName(cp);

            m_panel = new FlowLayoutPanel();
            m_panel.Controls.Add(cpName);
            m_panel.Controls.Add(dataSelectionCriteria); // add labels to flow layout panel
            m_panel.Controls.Add(xmlData);
            if (cp.UseXMLData)                           // if we are using xml data include the pass fail criteria in a label
            {
                Label collectionParameters = getCollectionParameters(cp);
                m_panel.Controls.Add(collectionParameters);
                Label passFailElemName = getPassFailElemName(cp);
                passFailElemName.AutoSize = true;
                m_panel.Controls.Add(passFailElemName);
                passFailElemName.Click     += PassFailElemName_Click;     // subscribe
                collectionParameters.Click += CollectionParameters_Click; // subscribe
            }
            configureFlowLayoutPanel();
            GBox.Controls.Add(m_panel);
            m_panel.Click += M_panel_Click;                             // subscribe
            GBox.Click    += GBox_Click;                                // subscribe
            dataSelectionCriteria.Click += DataSelectionCriteria_Click; // subscribe
            xmlData.Click += XmlData_Click;                             // subscribe
            cpName.Click  += CpName_Click;                              // sub
        }
        private Label getPassFailElemName(ColumnProperties cp)
        {
            Label passFailElement = new Label();

            passFailElement.AutoSize = true;
            passFailElement.Font     = new Font("Arial", 9, FontStyle.Bold);
            passFailElement.Text     = "Pass/Fail Element Name: " + cp.PassFailElemName;
            return(passFailElement);
        }
        private Label getXMLDataLabel(ColumnProperties cp)
        {
            Label xmlDataLabel = new Label();

            xmlDataLabel.AutoSize = true;
            xmlDataLabel.Font     = new Font("Arial", 9);
            xmlDataLabel.Text     = cp.XMLElemNameProp;
            return(xmlDataLabel);
        }
 public ColPropertiesDialog(ColumnProperties cp, string baseCamFolderPath, string baseInstFolderPath, bool doCameraTest)
 {
     m_formInitComplete = false;
     InitializeComponent();
     m_activeColumnProperty = cp;
     m_activeColumnProperty.CollectAlways = true;
     m_activeColumnProperty.CollectOnFail = false;
     m_activeColumnProperty.CollectOnPass = false;
     m_isCameraTest          = doCameraTest;
     this.baseCamFolderPath  = baseCamFolderPath;
     this.baseInstFolderPath = baseInstFolderPath;
     UpdateColPropViewInfo();
     m_formInitComplete           = true;
     cbXmlElementName.MouseWheel += new MouseEventHandler(comboBox_MouseWheel);
 }
        private Label getColPropName(ColumnProperties cp)
        {
            Label cpName = new Label();

            cpName.AutoSize = true;
            cpName.Font     = new Font("Arial", 9, FontStyle.Bold);
            if (string.IsNullOrEmpty(cp.DisplayName))
            {
                cpName.Text = "Name: " + cp.XMLElemNameProp;
            }
            else
            {
                cpName.Text = "Name: " + cp.DisplayName;
            }
            return(cpName);
        }
        /////////////////////////////////////
        ///////////// Member Data ///////////
        /////////////////////////////////////


        protected virtual void OnNewColumnPropertiesAvailable()
        {
            // TBD   -   Collect data from GUI and put it into a new col prop record
            ColumnProperties colProps = new ColumnProperties();

            colProps.CollectAlways    = rbAlways.Checked;
            colProps.CollectOnFail    = rbFail.Checked;
            colProps.CollectOnPass    = rbPass.Checked;
            colProps.UseCamSN         = rbCamSN.Checked;
            colProps.UseInstSN        = rbInstNum.Checked;
            colProps.UseXMLData       = rbXMLData.Checked;
            colProps.XMLElemNameProp  = cbXmlElementName.GetItemText(cbXmlElementName.SelectedItem);
            colProps.FileNameTemplate = tbFileNameTemplate.Text;
            colProps.PassFailElemName = cbVerificationField.Text;
            colProps.FilePath         = m_filepath;
            if (String.IsNullOrEmpty(tbDisplayName.Text))
            { // if the user has not designated a name use a default one
                if (colProps.UseCamSN)
                {
                    colProps.DisplayName = "Camera Serial Nbr.";
                }
                else if (colProps.UseInstSN)
                {
                    colProps.DisplayName = "Inst. Serial Nbr.";
                }
                else
                {
                    colProps.DisplayName = colProps.XMLElemNameProp;
                }
            }
            else
            {
                colProps.DisplayName = tbDisplayName.Text;
            }
            // ???  TBD  -- we need to get folder name for instrument or camera serial nbr
            ///          --  colProps.ParentDirectory = Directory.GetParent(filepath).ToString();

            NewColumnPropertiesEventArgs args = new NewColumnPropertiesEventArgs();

            args.colProps = colProps;
            EventHandler <NewColumnPropertiesEventArgs> handler = NewColumnPropertiesAvailable; // publish new data

            if (handler != null)
            {
                handler(this, args);
            }
        }
        private Label getDataSelectionCriteria(ColumnProperties cp)
        {
            Label dataSelectionCriteria = new Label();

            dataSelectionCriteria.AutoSize = true;
            dataSelectionCriteria.Font     = new Font("Arial", 9, FontStyle.Bold);
            if (cp.UseXMLData)
            {
                dataSelectionCriteria.Text = "Using XML Data:";
            }
            else if (cp.UseCamSN)
            {
                dataSelectionCriteria.Text = "Using Camera Serial Number";
            }
            else if (cp.UseInstSN)
            {
                dataSelectionCriteria.Text = "Using Instrument Serial Number";
            }
            return(dataSelectionCriteria);
        }
        private Label getCollectionParameters(ColumnProperties cp)
        {
            Label collectionParameters = new Label();

            collectionParameters.AutoSize = true;
            collectionParameters.Font     = new Font("Arial", 9, FontStyle.Bold);
            if (cp.CollectAlways)
            {
                collectionParameters.Text = "Collecting data always";
            }
            else if (cp.CollectOnPass)
            {
                collectionParameters.Text = "Collecting data on pass";
            }
            else if (cp.CollectOnFail)
            {
                collectionParameters.Text = "Collecting data on fail";
            }
            return(collectionParameters);
        }
 public void OnNewColProp(object source, ColumnProperties cp)
 {
     // PUT IN XML ELEMENT NAME, HAS NOT BEEN IMPLIMENTED YET
 }