private void tsButton_Paste_Click(object aSender, EventArgs aEventArgs) { string[] lNames; object[] lValues; Clipboard.get(out lNames, out lValues); for (int i = 0; i < lNames.Length; i++) { try { mHolder.add(lNames[i], lValues[i], true); } catch (Exception lExc) { var lResult = QuestionForm.askQuestion(lExc.Message + " Continue?", this); if (lResult == DialogResult.No) { break; } } } updateForm(); }
private void tsButton_Delete_Click(object aSender, EventArgs aEventArgs) { int lCount = dataGridView_Records.SelectedRows.Count; if (lCount > 0) { try { if (QuestionForm.askQuestion("Delete " + lCount.ToString() + " record(s)?", this) == DialogResult.Yes) { for (int i = 0; i < lCount; i++) { mSnapshot.deleteRecord(dataGridView_Records.SelectedRows[i].Cells[0].Value.ToString()); } updateForm(); } } catch (Exception lExc) { Log.Error("Error while user was deleting record(s) from snapshot '" + mSnapshot.Name + "'. " + lExc.Message, lExc.ToString()); MessageForm.showMessage(lExc.Message, this); } } }
private void tsButton_UpdateV_Click(object aSender, EventArgs aEventArgs) { int lCount = dataGridView_Records.SelectedRows.Count; if (lCount > 0) { string lItem; object lValue; try { if (QuestionForm.askQuestion("Update values for " + lCount.ToString() + " record(s)?", this) == DialogResult.Yes) { for (int i = 0; i < lCount; i++) { lItem = dataGridView_Records.SelectedRows[i].Cells[0].Value.ToString(); lValue = mSnapshot.ItemBrowser.readItemOrInitValue(mSnapshot.ItemBrowser.getItemHandleByName(lItem)); mSnapshot.changeRecord(lItem, lItem, lValue); } updateForm(); } } catch (Exception lExc) { Log.Error("Error while user was updating values for record(s) of snapshot '" + mSnapshot.Name + "'. " + lExc.Message, lExc.ToString()); MessageForm.showMessage(lExc.Message, this); } } }
private void Ok() { try { if (mPanel.mBmp != null && ReferenceEquals(mPanel.mBmp, mBmp) == false) { mPanel.mBmp.Dispose(); } if (mPanel.mImgMemStrm != null && ReferenceEquals(mPanel.mImgMemStrm, mImgMemStrm) == false) { mPanel.mImgMemStrm.Close(); } mPanel.mImgMemStrm = mImgMemStrm; mPanel.mBmp = mBmp; mPanel.IsContainer = IsContainer; if (mPanel.Width != mBmp.Width || mPanel.Height != mBmp.Height) { if (QuestionForm.askQuestion("Fit panel to image size?", this) == DialogResult.Yes) { mPanel.fitSize(); } } mPanel.updateProperties(); DialogResult = DialogResult.OK; } catch (Exception lExc) { MessageForm.showMessage(lExc.Message, this); } }
private void tsButton_AddWizard_Click(object aSender, EventArgs aEventArgs) { try { int[] lHandles = mSnapshot.ItemBrowser.getItemHandlesByForm(this); if (lHandles.Length > 0) { Cursor = Cursors.WaitCursor; bool?lReplace = null; try { for (int i = 0; i < lHandles.Length; i++) { if (mSnapshot.isRecordExists(lHandles[i])) { if (lReplace == null) { lReplace = (QuestionForm.askQuestion("Replace existing records? ", this) == DialogResult.Yes); } if (lReplace == true) { mSnapshot.deleteRecord(lHandles[i]); } else { continue; } } mSnapshot.addRecord(lHandles[i], mSnapshot.ItemBrowser.readItemOrInitValue(lHandles[i])); } updateForm(); } finally { Cursor = Cursors.Arrow; } } } catch (Exception lExc) { Cursor = Cursors.Arrow; Log.Error("Error while user was adding new records to snapshot '" + mSnapshot.Name + "'. " + lExc.Message, lExc.ToString()); MessageForm.showMessage(lExc.Message, this); } }
private void tsButton_Delete_Click(object aSender, EventArgs aEventArgs) { if (mSelectedNode != null) { try { if (QuestionForm.askQuestion("Delete State '" + mSelectedNode.LabelText + "'?", this) == DialogResult.Yes) { mCSharpFSMClone.deleteState(mSelectedNode.LabelText); updateForm(); updateButtons(); } } catch (Exception lExc) { MessageForm.showMessage(lExc.Message, this); } } }
private void tsButton_Delete_Click(object aSender, EventArgs aEventArgs) { int lCount = dataGridView_Items.SelectedRows.Count; if (lCount > 0) { try { if (QuestionForm.askQuestion("Delete " + lCount.ToString() + " Item(s)?", this) == DialogResult.Yes) { HashSet <int> lDeleteHandles = new HashSet <int>(); for (int i = 0; i < lCount; i++) { lDeleteHandles.Add(mBrowser.getItemHandleByName(dataGridView_Items.SelectedRows[i].Cells[0].Value.ToString())); } HashSet <int> lNewHandles = new HashSet <int>(); foreach (int lHandle in mCloneItems) { if (lDeleteHandles.Contains(lHandle) == false) { lNewHandles.Add(lHandle); } } mCloneItems = lNewHandles; updateTable(); updateButtons(); } } catch (Exception lExc) { Log.Error("Error while user was deleting Item(s). " + lExc.Message, lExc.ToString()); MessageForm.showMessage(lExc.Message, this); } } }
private void tsButton_Delete_Click(object aSender, EventArgs aEventArgs) { int lCount = dataGridView_Sections.SelectedRows.Count; if (lCount > 0) { try { if (QuestionForm.askQuestion("Delete " + lCount.ToString() + " section(s)?", this) == DialogResult.Yes) { for (int i = 0; i < lCount; i++) { mCloneSections[dataGridView_Sections.SelectedRows[i].Index] = null; } var lTemp = new List <Tuple <long, Snapshot> >(); foreach (var lTuple in mCloneSections) { if (lTuple != null) { lTemp.Add(lTuple); } } mCloneSections = lTemp; updateTable(); updateButtons(); } } catch (Exception lExc) { Log.Error("Error while user was deleting section(s). " + lExc.Message, lExc.ToString()); MessageForm.showMessage(lExc.Message, this); } } }