private void btnDel_Click(object sender, EventArgs e) { TreeNode selNode = tvKind.SelectedNode; ListView.CheckedIndexCollection selText = lvText.CheckedIndices; if (selText == null || selText.Count == 0) { MessageBox.Show(LangPack.GetMongolian("Please choose the CG text to delete."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (DialogResult.No == MessageBox.Show(LangPack.GetMongolian("Want to delete?"), this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2)) { return; } for (int i = 0; i < selText.Count; i++) { BoardInfoDetail info = lvText.Items[selText[i]].Tag as BoardInfoDetail; brdMng.dicBrd[info.kind].dicText.Remove(info.name); brdMng.SaveBrdData(); } MessageBox.Show(LangPack.GetMongolian("Deleted."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); if (this.OnCGChangedEvt != null) { this.OnCGChangedEvt(this, new CGChangedEventArgs()); } tvKind.SelectedNode = null; tvKind.SelectedNode = selNode; }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(tbName.Text)) { MessageBox.Show(LangPack.GetMongolian("Please enter the CG title."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); tbName.Focus(); return; } if (string.IsNullOrEmpty(tbText.Text)) { MessageBox.Show(LangPack.GetMongolian("Please enter the CG text."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); tbText.Focus(); return; } if (bAdd) { BoardInfo info = brdMng.dicBrd[cbKind.Text]; if (info.dicText != null && info.dicText.ContainsKey(tbName.Text)) { MessageBox.Show(LangPack.GetMongolian("The same title already exists. Please enter check again after."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning); tbName.Focus(); return; } BoardInfoDetail dinfo = new BoardInfoDetail(); dinfo.name = tbName.Text; dinfo.text = tbText.Text; dinfo.kindNum = info.kindNum; dinfo.kind = cbKind.Text; dinfo.isBlack = (cbBlack.SelectedIndex == 0 ? false : true); if (this.cutInfoD != null) { for (int i = 0; i < 9; i++) { dinfo.cut[i] = this.cutInfoD.cut[i]; } } brdMng.dicBrd[cbKind.Text].dicText.Add(tbName.Text, dinfo); MessageBox.Show(LangPack.GetMongolian("Stored."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); ResetCtrl(); } else { // Name(Key) 수정 if (this.oldName != tbName.Text) { // 기존 Name(Key) 삭제 brdMng.dicBrd[cbKind.Text].dicText.Remove(this.oldName); // 새로운 Name(Key) 등록 BoardInfoDetail dinfo = new BoardInfoDetail(); dinfo.name = tbName.Text; dinfo.text = tbText.Text; dinfo.kind = cbKind.Text; dinfo.kindNum = infoD.kindNum; dinfo.isBlack = (cbBlack.SelectedIndex == 0 ? false : true); for (int i = 0; i < 9; i++) { dinfo.cut[i] = this.cutInfoD.cut[i]; } brdMng.dicBrd[cbKind.Text].dicText.Add(tbName.Text, dinfo); } else { brdMng.dicBrd[cbKind.Text].dicText[tbName.Text].text = tbText.Text; brdMng.dicBrd[cbKind.Text].dicText[tbName.Text].isBlack = (cbBlack.SelectedIndex == 0 ? false : true); for (int i = 0; i < 9; i++) { brdMng.dicBrd[cbKind.Text].dicText[tbName.Text].cut[i] = this.cutInfoD.cut[i]; } } brdMng.SaveBrdData(); MessageBox.Show(LangPack.GetMongolian("Modified."), this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } if (this.OnCGChangeEvt != null) { this.OnCGChangeEvt(this, new CGChangeEventArgs()); } }