/// <inheritdoc/>
protected override ExitCode ExecuteHelper(ICategoryIntegrationManager integrationManager, FeedUri interfaceUri)
{
#region Sanity checks
if (interfaceUri == null) throw new ArgumentNullException(nameof(interfaceUri));
if (integrationManager == null) throw new ArgumentNullException(nameof(integrationManager));
#endregion
if (RemoveOnly())
{
RemoveOnly(integrationManager, interfaceUri);
return ExitCode.OK;
}
CheckInstallBase();
var appEntry = GetAppEntry(integrationManager, ref interfaceUri);
var feed = FeedManager[interfaceUri];
if (NoSpecifiedIntegrations())
{
var state = new IntegrationState(integrationManager, appEntry, feed);
Retry:
Handler.ShowIntegrateApp(state);
try
{
state.ApplyChanges();
}
#region Error handling
catch (ConflictException ex)
{
if (Handler.Ask(
Resources.IntegrateAppInvalid + Environment.NewLine + ex.Message + Environment.NewLine + Environment.NewLine + Resources.IntegrateAppRetry,
defaultAnswer: false, alternateMessage: ex.Message))
goto Retry;
}
catch (InvalidDataException ex)
{
if (Handler.Ask(
Resources.IntegrateAppInvalid + Environment.NewLine + ex.Message + Environment.NewLine + Environment.NewLine + Resources.IntegrateAppRetry,
defaultAnswer: false, alternateMessage: ex.Message))
goto Retry;
}
#endregion
return ExitCode.OK;
}
RemoveAndAdd(integrationManager, feed, appEntry);
return ExitCode.OK;
}