private AppEntry ReplaceAppEntry(IIntegrationManager integrationManager, AppEntry entry, FeedTarget newTarget) { integrationManager.RemoveApp(entry); var newEntry = CreateAppEntry(integrationManager, newTarget); integrationManager.AddAccessPoints(newEntry, newTarget.Feed, entry.AccessPoints.Entries); return(newEntry); }
/// <summary> /// Applies any changes made to the View-Model to the underlying system. /// </summary> /// <exception cref="OperationCanceledException">The user canceled the task.</exception> /// <exception cref="ConflictException">One or more of the new <see cref="AccessPoints.AccessPoint"/>s would cause a conflict with the existing <see cref="AccessPoints.AccessPoint"/>s in <see cref="IIntegrationManager.AppList"/>.</exception> /// <exception cref="InvalidDataException">One of the <see cref="AccessPoints.AccessPoint"/>s or <see cref="Store.Model.Capabilities.Capability"/>s is invalid.</exception> /// <exception cref="WebException">A problem occured while downloading additional data (such as icons).</exception> /// <exception cref="IOException">A problem occurs while writing to the filesystem or registry.</exception> /// <exception cref="UnauthorizedAccessException">Write access to the filesystem or registry is not permitted.</exception> public void ApplyChanges() { var toAdd = new List <AccessPoints.AccessPoint>(); var toRemove = new List <AccessPoints.AccessPoint>(); (CapabilitiyRegistration ? toAdd : toRemove).Add(new AccessPoints.CapabilityRegistration()); CollectCommandAccessPointChanges(toAdd, toRemove); CollectDefaultAccessPointChanges(toAdd, toRemove); if (toRemove.Any()) { _integrationManager.RemoveAccessPoints(AppEntry, toRemove); } if (toAdd.Any()) { _integrationManager.AddAccessPoints(AppEntry, Feed, toAdd); } }