Exemple #1
0
        /// <inheritdoc/>
        protected override ExitCode ExecuteHelper()
        {
            if (RemoveOnly)
            {
                IntegrationManager.RemoveAccessPointCategories(IntegrationManager.AppList[InterfaceUri], _removeCategories.ToArray());
                return(ExitCode.OK);
            }
            else
            {
                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);
                }
                else
                {
                    if (_removeCategories.Any())
                    {
                        IntegrationManager.RemoveAccessPointCategories(appEntry, _removeCategories.ToArray());
                    }
                    if (_addCategories.Any())
                    {
                        IntegrationManager.AddAccessPointCategories(appEntry, feed, _addCategories.ToArray());
                    }
                    return(ExitCode.OK);
                }
            }
        }