private void Mnu2verseSplit_Click(object sender, EventArgs e) { int nPoemId = ganjoorView.CurrentPoemId; if (nPoemId < 1) { MessageBox.Show("لطفا شعری را انتخاب کنید."); return; } if (MessageBox.Show("با اجرای این فرمان هر دو بیت شعر جدیدی محسوب میشود. شعرهای جدید به بخش جاری اضافه میشوند.\n\rآیا ادامه میدهید؟", "تأییدیه", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1, MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading) == DialogResult.Yes) { DbBrowser dbBrowser = new DbBrowser(); List <GanjoorVerse> verses = dbBrowser.GetVerses(nPoemId); int nCatId = ganjoorView.CurrentCatId; int nPoemNo = 0; int nLastPoemId = nPoemId; for (int nIndex = 0; nIndex < verses.Count; nIndex += 4) { nPoemNo++; dbBrowser.BeginBatchOperation(); GanjoorPoem newPoem = dbBrowser.CreateNewPoem("شمارهٔ " + GPersianTextSync.Sync(nPoemNo.ToString()), nCatId); nLastPoemId = newPoem._ID; for (int i = 0; i < 4; i++) { GanjoorVerse v = dbBrowser.CreateNewVerse(newPoem._ID, i, verses[nIndex + i]._Position); dbBrowser.SetVerseText(newPoem._ID, v._Order, verses[nIndex + i]._Text); } dbBrowser.CommitBatchOperation(); } ganjoorView.ShowPoem(dbBrowser.GetPoem(nLastPoemId), true); dbBrowser.CloseDb(); } }
private void txtHighlight_TextChanged(object sender, EventArgs e) { if (processTextChanged) { iLastFoundItems = ganjoorView.HighlightText(GPersianTextSync.Sync(txtHighlight.Text)); iLastHighlightedFoundItem = 0; if (lblFoundItemCount.Visible = !string.IsNullOrEmpty(txtHighlight.Text)) { lblFoundItemCount.Text = String.Format("{0} مورد یافت شد.", iLastFoundItems); } btnScrollToNext.Visible = iLastFoundItems > 1; } }
private void btnGroupNaming_Click(object sender, EventArgs e) { bool bPrefix = MessageBox.Show("آیا تمایل دارید این نام به عنوان پیشوند به عنوان فعلی اضافه شود (در غیر این صورت عنوان فعلی حذف میشود)؟", "تأییدیه", MessageBoxButtons.YesNo) == DialogResult.Yes; if (MessageBox.Show("آیا از ادامهٔ عملیات اطمینان دارید؟", "تأییدیه", MessageBoxButtons.YesNo) == DialogResult.No) { return; } _db.BeginBatchOperation(); int nNum = 0; foreach (DataGridViewRow Row in grdMain.Rows) { nNum++; string newTitle = $"شمارهٔ { GPersianTextSync.Sync(nNum.ToString())}"; if (bPrefix) { string title = Row.Cells[ClmnTitle].Value.ToString().Trim(); string verse1 = Row.Cells[ClmnVerse1].Value.ToString().Trim(); if (title == verse1) { title = ""; } if (title.StartsWith("شمارهٔ ")) { if (title.IndexOf(" - ") != -1) { title = title.Substring(title.IndexOf(" - ") + " - ".Length); newTitle = $"{newTitle} - {title}"; } } else if (!string.IsNullOrEmpty(title)) { newTitle = $"{newTitle} - {Row.Cells[ClmnTitle].Value}"; } } _db.SetPoemTitle(Convert.ToInt32(Row.Cells[ClmnID].Value), newTitle); } _db.CommitBatchOperation(); LoadGridData(); }
private void btnScrollToNext_Click(object sender, EventArgs e) { iLastHighlightedFoundItem++; ganjoorView.HighlightText(GPersianTextSync.Sync(txtHighlight.Text), iLastHighlightedFoundItem); btnScrollToNext.Visible = (iLastHighlightedFoundItem + 1 < iLastFoundItems); }