public TemplateView(TemplateView origianl) { this.id = origianl.id; this.name = origianl.name; this.description = origianl.description; this.templateContent = origianl.templateContent; this.templateType = origianl.templateType; this.fileNamePrefix = origianl.fileNamePrefix; }
/// <summary> /// Copy values back to this object from a cached object /// </summary> /// <param name="origianl"></param> public void Restore(TemplateView cachedObject) { this.id = cachedObject.id; this.name = cachedObject.name; this.description = cachedObject.description; this.fileNamePrefix = cachedObject.fileNamePrefix; this.templateContent = cachedObject.templateContent; this.templateType = cachedObject.templateType; }
/// <summary> /// 'Cancel' button is clicked /// </summary> public void CancelEdit() { Restore(cache); cache = null; }
/// <summary> /// 'Edit' button is clicked /// Due to binding, all UI changed will be mapped to the object, so we need make a copy of object before edit in case user wants to cancel the editing /// </summary> public void BeginEdit() { cache = new TemplateView(this); }