Ejemplo n.º 1
0
 private void toolStripButtonInfoDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show($"Вы точно хотите удалить пакет информации {dgvInfoList.SelectedCells[0].Value.ToString()}?", "Warning!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         HelpfullInformation information = classInformation.HelpfullsInfo.Where(t => t.Name == dgvInfoList.SelectedCells[0].Value.ToString()).First();
         classInformation.HelpfullsInfo.Remove(information);
         LoadHelpfullInformationToForm();
     }
 }
Ejemplo n.º 2
0
        private void toolStripTextBoxInfoName_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                HelpfullInformation helpfull = new HelpfullInformation();
                helpfull.Name = toolStripTextBoxInfoName.Text;
                toolStripTextBoxInfoName.Text = "";
                classInformation.HelpfullsInfo.Add(helpfull);
                LoadHelpfullInformationToForm();

                toolStripButtonInfoAdd.Visible      = true;
                toolStripButtonInfoAddClose.Visible = false;
                toolStripSeparatorInfo1.Visible     = false;
                toolStripLabelInfoAdd.Visible       = false;
                toolStripTextBoxInfoName.Visible    = false;
            }
        }
Ejemplo n.º 3
0
 private void dgvInfoList_CellStateChanged(object sender, DataGridViewCellStateChangedEventArgs eCell)
 {
     try
     {
         if (eCell.StateChanged == DataGridViewElementStates.Selected)
         {
             if (eCell.Cell.Selected)
             {
                 setInfoVisible(true);
                 HelpfullInformation information = classInformation.HelpfullsInfo.Where(t => t.Name == eCell.Cell.Value.ToString()).First();
                 rtbInfo.Text    = information.Text;
                 tbInfoKeys.Text = "";
                 foreach (string s in information.keyWords)
                 {
                     tbInfoKeys.Text += s + ", ";
                 }
             }
             else
             {
                 try
                 {
                     HelpfullInformation information = classInformation.HelpfullsInfo.Where(t => t.Name == eCell.Cell.Value.ToString()).First();
                     information.Text = rtbInfo.Text;
                     information.keyWords.Clear();
                     string[] str = tbInfoKeys.Text.Split(new char[] { ',', '\n' });
                     foreach (string s in str)
                     {
                         information.keyWords.Add(s.Trim());
                     }
                     int count = information.keyWords.Where(e => e == "").Count();
                     for (int i = 0; i < count; i++)
                     {
                         information.keyWords.Remove("");
                     }
                 }
                 catch { }
             }
         }
     }
     catch { }
 }