///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Monitors video store's movies collection. If the movie is deleted /// from collection, the form is closed. /// </summary> /// private void Movies_Changed(GenericObject item, ChangeType how, string reason) { Debug.TraceLine("{0} >>>> {1} {2}{3}", TraceID, how, item.GetType().Name, reason != null ? ", Reason: " + reason : ""); Movie record = item as Movie; if (record != null && this.Movie == record) { if (how == ChangeType.Removed) { QuitForm(); } } }
///////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Occurs when VRO database collection has been changed. /// </summary> /// <remarks> /// Updates the contents of the form, in case that database record has been updated, /// or closes the form, in case that database record was deleted. /// </remarks> /// private void Collection_Changed(GenericObject item, ChangeType how, string reason) { Debug.TraceLine("{0} >>>> {1} {2}{3}", TraceID, how, item.GetType().Name, reason != null ? ", Reason: " + reason : ""); T record = item as T; if (record != null && this.Record == record) { if (how == ChangeType.Removed) { QuitForm(); } else // updated or added { // Reload data into details form. This will also clean ContentsChanged // property for all fields in DetailsForm. // OnLoadData(); } } }