Пример #1
0
        private void Public_Text_Group_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string name = this.Public_Text_Group.Columns[e.ColumnIndex].Name;

            if (e.RowIndex < 0)
            {
                return;
            }
            string text = this.Public_Text_Group.Rows[e.RowIndex].Cells[1].Value.ToString();

            if (name == "Rename_PublicText")
            {
                formReName formReName = new formReName();
                formReName.name_text_str = text;
                formReName.Set_Text_Name();
                formReName.ShowDialog();
                if (formReName.rename_result)
                {
                    LedPublicText ledPublicText = new LedPublicText();
                    ledPublicText = formMain.Ledsys.GetPublicText(text);
                    formMain.Ledsys.RenamePublicText(text, formReName.name_text_str);
                    this.ReName_load_List(text, formReName.name_text_str);
                    this.Public_Text_Group.Rows[e.RowIndex].Cells[1].Value = formReName.name_text_str;
                    this.publictext_noEdit.Remove(text);
                    this.publictext_noEdit.Add(formReName.name_text_str, ledPublicText.Text);
                }
            }
        }
Пример #2
0
        private void Add_PublicText_toolStripButton_Click(object sender, EventArgs e)
        {
            DataGridViewRow dataGridViewRow = new DataGridViewRow();

            dataGridViewRow.CreateCells(this.Public_Text_Group);
            for (int i = 1; i < 9999; i++)
            {
                bool   flag = false;
                string text = formMain.ML.GetStr("Mar_PublicText") + i.ToString();
                foreach (LedPublicText current in formMain.Ledsys.PublicTexts)
                {
                    if (current.Name == text)
                    {
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    dataGridViewRow.Cells[1].Value = text;
                    LedPublicText ledPublicText = new LedPublicText();
                    ledPublicText.Name = text;
                    ledPublicText.Text = string.Empty;
                    formMain.Ledsys.PublicTexts.Add(ledPublicText);
                    this.Panel_Item_PublicText_Members_Dic.Add(text, new List <Panel_Item_PublicText>());
                    this.publictext_noEdit.Add(text, string.Empty);
                    break;
                }
            }
            this.Public_Text_Group.Rows.Add(dataGridViewRow);
        }
Пример #3
0
 private void Del_PublicText_toolStripButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(this, formMain.ML.GetStr("formEdit_Public_Text_MessageBox_DeletePublicText"), formMain.ML.GetStr("UpdateButton_Delete"), MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK && this.Public_Text_Group.Rows.Count > 0)
     {
         try
         {
             foreach (DataGridViewRow dataGridViewRow in this.Public_Text_Group.SelectedRows)
             {
                 LedPublicText publicText = formMain.Ledsys.GetPublicText(dataGridViewRow.Cells[1].Value.ToString());
                 formMain.Ledsys.PublicTexts.Remove(publicText);
                 formMain.Ledsys.RemovePublicText(publicText.Name);
                 this.Panel_Item_PublicText_Members_Dic.Remove(this.Public_Text_Group.SelectedRows[0].Cells[1].Value.ToString());
                 this.publictext_noEdit.Remove(this.Public_Text_Group.SelectedRows[0].Cells[1].Value.ToString());
                 this.Public_Text_Group.Rows.Remove(dataGridViewRow);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }