/// <summary> /// Default ctor /// </summary> public Item(IImportableEntity sourceEntity, IImportableEntity targetEntity) { entity = sourceEntity; Text = entity.Description; SubItems.Add(entity.TypeName); var remarks = string.Empty; SafeToImport = false; switch (sourceEntity.CompareTo(targetEntity)) { case ImportComparison.TargetDoesNotExists: remarks = string.Empty; SafeToImport = true; break; case ImportComparison.SourceInNewer: remarks = "This item already exists, but is newer then what you have now."; SafeToImport = true; break; case ImportComparison.TargetIsNewer: remarks = "This item already exists and it older then what you have now."; SafeToImport = false; break; case ImportComparison.TargetExists: remarks = "This item already exists. It is unknown which version is older."; SafeToImport = false; break; } SubItems.Add(remarks); Checked = (targetEntity == null); }
/// <summary> /// Compare the last modification of this entity (from the import source) with the given entity found in /// the target package. /// </summary> /// <param name="target">The equal entity in the target package. Can be null.</param> ImportComparison IImportableEntity.CompareTo(IImportableEntity target) { if (target == null) { return(ImportComparison.TargetDoesNotExists); } return(ImportComparison.TargetExists); }
/// <summary> /// Compare the last modification of this entity (from the import source) with the given entity found in /// the target package. /// </summary> /// <param name="target">The equal entity in the target package. Can be null.</param> ImportComparison IImportableEntity.CompareTo(IImportableEntity target) { return(CompareTo((IPersistentEntity)target)); }