private void EditForm_FormClosing(object sender, FormClosingEventArgs e) { if (context == null) { return; } if (txtMemoText.Text.Length > 0) { btnSave.PerformClick(); //store current remark } context.Save(); context = null; }
public void View(RemarkContext _context) { context = _context; popupRemarks = context.Remarks.Where(c => c.RemarkType.ShowPopup).ToList(); popupCount = popupRemarks.Count(); if (popupCount == 0) { return; } Text = context.OwnerName + " [" + context.OwnerId + "] " + context.EntityName; index = 0; UpdateControls(); ShowDialog(); Close(); }
public RemarkType ChooseType(RemarkContext context) { lbRemarkType.Items.Clear(); foreach (DictionaryEntry type in context.RemarkTypes) { var remarkType = (RemarkType)type.Value; if (remarkType.CanCreate == 1) { lbRemarkType.Items.Add(remarkType.Caption); } } if (lbRemarkType.Items.Count < 1) { return(null); } else if (lbRemarkType.Items.Count == 1) { return((RemarkType)context.RemarkTypes[0]); } else { lbRemarkType.SelectedIndex = 0; ShowDialog(); if (cancelled) { return(null); } else { return((RemarkType)context.RemarkTypes[lbRemarkType.SelectedIndex]); } } }
public void View(RemarkContext _context) { context = _context; ShowDialog(); }