void edit() { Boolean isCompleted = false; String[] itemCells; itemCells = new String[AP_COLUMN_COUNT]; Boolean gotListViewItem = Windows.GetSelectedListViewItem(listViewAP, ref itemCells); if (!gotListViewItem) { Log.Fatal(" No item selected to edit!"); return; } Log.Debug("itemCells[COLUMN_TERM]=" + itemCells[COLUMN_TERM]); do { Invoke(new MethodInvoker(delegate() { String oldTerm = itemCells[COLUMN_TERM].ToString(); _hideForm = true; AlternatePronunciationEditorForm dlg = new AlternatePronunciationEditorForm(itemCells[COLUMN_TERM].ToString(), itemCells[COLUMN_ALTERNATE].ToString()); Context.AppScreenManager.ShowDialog(this, dlg); Log.Debug("_originalTerm=" + dlg._originalTerm + "_replacementTerm=" + dlg._replacementTerm); if (dlg._hasTerm == false) { isCompleted = true; return; // user must have cancelled } if (String.IsNullOrEmpty(dlg._originalTerm)) { DialogUtils.ShowTimedDialog(this, "Message", "Pronunciation cannot be empty!"); } else { UpdatePronunciation(listViewAP, oldTerm, dlg._originalTerm, dlg._replacementTerm); isCompleted = true; ListViewChanged(); return; } })); } while (!isCompleted); }
void add() { Boolean isCompleted = false; String originalTerm = String.Empty; String replacementTerm = String.Empty; do { Invoke(new MethodInvoker(delegate() { _hideForm = true; AlternatePronunciationEditorForm dlg = new AlternatePronunciationEditorForm(originalTerm, replacementTerm); Context.AppScreenManager.ShowDialog(this, dlg); if (dlg._hasTerm == false) { isCompleted = true; return; // user must have cancelled } if (String.IsNullOrEmpty(dlg._originalTerm)) { isCompleted = true; return; // this should have already been validated in the editor dialog } Log.Debug("originalterm=" + dlg._originalTerm + " replacementterm=" + dlg._replacementTerm); originalTerm = dlg._originalTerm; replacementTerm = dlg._replacementTerm; // check if pronunciation already exists if (Context.AppPronunications.Exists(dlg._originalTerm)) { // prompt user that pronunciation already exists! DialogUtils.ShowTimedDialog(this, "Error", "Pronunciation for '" + dlg._originalTerm + "' already exists"); } else { AddPronunciation(listViewAP, dlg._originalTerm, dlg._replacementTerm); isCompleted = true; ListViewChanged(); return; } })); } while (!isCompleted); }
void edit() { Boolean isCompleted = false; String[] itemCells; itemCells = new String[AP_COLUMN_COUNT]; Boolean gotListViewItem = Windows.GetSelectedListViewItem(listViewAP, ref itemCells); if (!gotListViewItem) { Log.Fatal(" No item selected to edit!"); return; } Log.Debug("itemCells[COLUMN_TERM]=" + itemCells[COLUMN_TERM]); do { Invoke(new MethodInvoker(delegate() { String oldTerm = itemCells[COLUMN_TERM].ToString(); _hideForm = true; AlternatePronunciationEditorForm dlg = new AlternatePronunciationEditorForm(itemCells[COLUMN_TERM].ToString(), itemCells[COLUMN_ALTERNATE].ToString()); Context.AppScreenManager.ShowDialog(this, dlg); Log.Debug("_originalTerm=" + dlg._originalTerm + "_replacementTerm=" + dlg._replacementTerm); if (dlg._hasTerm == false) { isCompleted = true; return; // user must have cancelled } if (String.IsNullOrEmpty(dlg._originalTerm)) { DialogUtils.ShowTimedDialog(this, "Message", "Pronunciation cannot be empty!"); } else { UpdatePronunciation(listViewAP, oldTerm, dlg._originalTerm, dlg._replacementTerm); isCompleted = true; ListViewChanged(); return; } })); } while (!isCompleted); }
void add() { Boolean isCompleted = false; String originalTerm = String.Empty; String replacementTerm = String.Empty; do { Invoke(new MethodInvoker(delegate() { _hideForm = true; AlternatePronunciationEditorForm dlg = new AlternatePronunciationEditorForm(originalTerm, replacementTerm); Context.AppScreenManager.ShowDialog(this, dlg); if (dlg._hasTerm == false) { isCompleted = true; return; // user must have cancelled } if (String.IsNullOrEmpty(dlg._originalTerm)) { isCompleted = true; return; // this should have already been validated in the editor dialog } Log.Debug("originalterm=" + dlg._originalTerm + " replacementterm=" + dlg._replacementTerm); originalTerm = dlg._originalTerm; replacementTerm = dlg._replacementTerm; // check if pronunciation already exists if (Context.AppPronunications.Exists(dlg._originalTerm)) { // prompt user that pronunciation already exists! DialogUtils.ShowTimedDialog(this, "Error", "Pronunciation for '" + dlg._originalTerm + "' already exists"); } else { AddPronunciation(listViewAP, dlg._originalTerm, dlg._replacementTerm); isCompleted = true; ListViewChanged(); return; } })); } while (!isCompleted); }