Esempio n. 1
0
        private void BtnEditSetsAddMember_Click(object sender, System.EventArgs e)
        {
            // edit sets, add selected to set
            // first we need to get the selected parameter
            // MessageBox.Show(DataGridViewEditAvailableParams.SelectedRows.Count)
            ClassOneSet activeEditSet = this.GetActiveEditSet();

            if (!(activeEditSet == null))
            {
                foreach (DataGridViewRow oRow in DataGridViewEditAvailableParams.SelectedRows)
                {
                    //   If oRow.Selected Then
                    ClassOneParamAssociation thisData = oRow.DataBoundItem as ClassOneParamAssociation;
                    // we need to know the active set
                    // and we need to know the selected parameter
                    // MessageBox.Show("adding " & thisData.thisParameterName)
                    JerkHub.AllSetsObj.addMemberToActiveSet(activeEditSet, thisData);
                    //   Exit For
                    //  End If
                    // If thisData.parameterGroup.ToLower = groupNameB.ToLower Then
                    //     oRow.Selected = isSelected
                    // End If
                }
            }

            JerkHub.Flags.MarkFileToBeSaved();
            this.RedrawEditPage();
        }
 public void BuildSelectedParamsToInsertList()
 {
     foreach (DataGridViewRow oRow in DataGridViewFromFile.Rows)
     {
         ClassOneParamAssociation thisData = oRow.DataBoundItem as ClassOneParamAssociation;
         //   nameToAdd = thisData.thisParameterName.ToString()
         if (oRow.Selected)
         {
             JerkHub.AllParametersSelectedToBeInserted.Add(thisData);
         }
     }
 }
        private void MarkAllSelectedAsGroupedUnder(string newValue)
        {
            foreach (DataGridViewRow oRow in DataGridViewFromFile.SelectedRows)
            {
                ClassOneParamAssociation thisItem = oRow.DataBoundItem as ClassOneParamAssociation;
                thisItem.GroupParameterUnderAsLabelStr = newValue;
            }

            ContextMenuStripGroupUnder.Close();
            DataGridViewFromFile.Refresh();
            JerkHub.Flags.MarkFileToBeSaved();
        }
        private void MarkAllInstance(bool newValue)
        {
            foreach (DataGridViewRow oRow in DataGridViewFromFile.SelectedRows)
            {
                ClassOneParamAssociation thisItem = oRow.DataBoundItem as ClassOneParamAssociation;
                if (thisItem != null)
                {
                    thisItem.IsInstance = newValue;
                }
            }

            JerkHub.Flags.MarkFileToBeSaved();
            DataGridViewFromFile.Refresh();
        }
        private void ToggleSet(string setName, bool isSelected)
        {
            JerkHub.Ptr2Debug.AddToDebug(("toggleSet: " + (setName + (" " + isSelected))));
            // get the selected set
            ClassOneSet selectSet;

            selectSet = JerkHub.AllSetsObj.getOneSetByNameFromMaster(setName);
            // now that we have the set name, let's toggle all it's members
            foreach (DataGridViewRow oRow in DataGridViewFromFile.Rows)
            {
                ClassOneParamAssociation thisData = oRow.DataBoundItem as ClassOneParamAssociation;
                if (thisData != null && selectSet.setMembers.Contains(thisData.ThisParameterName))
                {
                    oRow.Selected = isSelected;
                }
            }
        }
        private void ToggleGroup()
        {
            // at this point we have a group name and we want to select all
            // rows in the table that have the same group name
            // If isSelected Then
            // End If
            string groupNameB = JerkHub.Flags.SelectGroupName;
            bool   isSelected = JerkHub.Flags.RowSelected;


            foreach (DataGridViewRow oRow in DataGridViewFromFile.Rows)
            {
                ClassOneParamAssociation thisData = oRow.DataBoundItem as ClassOneParamAssociation;
                if (thisData != null && (thisData.ParameterGroup.Equals(groupNameB, StringComparison.OrdinalIgnoreCase)))
                {
                    oRow.Selected = isSelected;
                }
            }
        }
        public void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (((DataGridViewFromFile.Columns[e.ColumnIndex].Name == "isInstance") ||
                 ((DataGridViewFromFile.Columns[e.ColumnIndex].Name == "GroupParameterUnderAsLabelStr") ||
                  (DataGridViewFromFile.Columns[e.ColumnIndex].Name == "comment"))))
            {
                // Dim checkCell As DataGridViewCheckBoxCell = CType(DataGridViewFromFile.Rows(e.RowIndex).Cells("CheckBoxes"), DataGridViewCheckBoxCell)
                if ((DataGridViewFromFile.Columns[e.ColumnIndex].Name == "comment"))
                {
                    // check to make sure it's legal
                    DataGridViewRow          thisCell = DataGridViewFromFile.Rows[e.RowIndex];
                    ClassOneParamAssociation thisData = thisCell.DataBoundItem as ClassOneParamAssociation;
                    // in case they use right pick-> clear/ cut

                    if (thisData != null)
                    {
                        if ((thisData.Comment == null))
                        {
                            thisData.Comment = "";
                        }

                        int maxLength = 128;
                        if ((thisData.Comment.Length > maxLength))
                        {
                            thisData.Comment = thisData.Comment.Substring(0, maxLength);
                            MessageBox.Show(("comment is too long. I shortened it for ya. "
                                             + (maxLength + " characters max")));
                        }

                        if (!Regex.IsMatch(thisData.Comment, "^[A-Za-z0-9]"))
                        {
                            thisData.Comment = thisData.Comment.Replace("^[A-Za-z0-9]", "");
                        }
                    }
                }

                //  DataGridViewFromFile.Invalidate()
                JerkHub.Flags.MarkFileToBeSaved();
            }
        }
        private void ContextMenuStrip1_Opening(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // get the first line that is selected
            ClassOneParamAssociation lastOne = null;

            foreach (DataGridViewRow oRow in DataGridViewFromFile.SelectedRows)
            {
                lastOne = oRow.DataBoundItem as ClassOneParamAssociation;
                // Exit For
            }
            //    MessageBox.Show(lastOne.ToString())
            if (!(lastOne == null))
            {
                string firstValue = lastOne.GroupParameterUnderAsLabelStr;
                // MessageBox.Show(firstValue)
                // assign that to the combobox
                int itemIndex = JerkHub.ParameterGroupParameterUnderManagerListObj.GetItemIndex(firstValue);
                // MessageBox.Show(itemIndex)
                JerkHub.Flags.ReactToChangesInComboBoxGroupUnder = false;
                ToolStripComboBox1.SelectedIndex = itemIndex;
                JerkHub.Flags.ReactToChangesInComboBoxGroupUnder = true;
            }
        }