Exemple #1
0
        /// <inheritdoc/>
        public override ExitCode Execute()
        {
            using (var integrationManager = new IntegrationManager(Handler, MachineWide))
                integrationManager.Repair(FeedManager.GetFeed);

            return(ExitCode.OK);
        }
Exemple #2
0
        /// <summary>
        /// Creates a new alias.
        /// </summary>
        /// <param name="aliasName">The name of the alias to create.</param>
        /// <param name="interfaceUri">The interface URI the alias shall point to.</param>
        /// <param name="command">A command within the interface the alias shall point to; can be <c>null</c>.</param>
        /// <returns>The exit status code to end the process with.</returns>
        private ExitCode CreateAlias(string aliasName, FeedUri interfaceUri, string command = null)
        {
            CheckInstallBase();

            using (var integrationManager = new IntegrationManager(Handler, MachineWide))
            {
                // Check this before modifying the environment
                bool needsReopenTerminal = NeedsReopenTerminal(integrationManager.MachineWide);

                var appEntry = GetAppEntry(integrationManager, ref interfaceUri);

                // Apply the new alias
                var alias = new AppAlias {
                    Name = aliasName, Command = command
                };
                integrationManager.AddAccessPoints(appEntry, FeedManager[interfaceUri], new AccessPoint[] { alias });

                string message = string.Format(Resources.AliasCreated, aliasName, appEntry.Name);
                if (needsReopenTerminal)
                {
                    message += Environment.NewLine + Resources.ReopenTerminal;
                }
                Handler.OutputLow(Resources.DesktopIntegration, message);
                return(ExitCode.OK);
            }
        }
    protected void grdLinkedRecords_OnRowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    rowIndex = Convert.ToInt32(e.CommandArgument);
        string sourceId = grdLinkedRecords.DataKeys[rowIndex].Values[0].ToString();
        string targetId = grdLinkedRecords.DataKeys[rowIndex].Values[1].ToString();

        switch (e.CommandName.ToUpper())
        {
        case "SELECT":
            lblExtendedDetails.Visible = true;
            grdMatchDetails.DataSource = DialogService.DialogParameters.ContainsKey("mergeArguments")
                                                 ? SessionMergeArguments.MatchingRecordView.GetExtendedContactDetails(
                sourceId, targetId)
                                                 : IntegrationManager.GetExtendedContactDetails(sourceId, targetId);
            grdMatchDetails.DataBind();
            break;

        case "UNLINK":
            if (DialogService.DialogParameters.ContainsKey("mergeArguments"))
            {
                SessionMergeArguments.MatchingRecordView.RemoveMatchedContact(sourceId, targetId);
                SessionMergeArguments.MatchingRecordView.MatchedContacts.RemoveAt(rowIndex);
            }
            else
            {
                IntegrationManager.MatchingInfoRemoveMatchedChildPair(sourceId, targetId);
                IntegrationManager.MatchedContacts.RemoveAt(rowIndex);
            }
            break;
        }
    }
Exemple #4
0
        /// <summary>
        /// Resolves or removes existing aliases.
        /// </summary>
        /// <param name="aliasName">The name of the existing alias.</param>
        /// <returns>The exit status code to end the process with.</returns>
        private ExitCode ResolveOrRemove(string aliasName)
        {
            using (var integrationManager = new IntegrationManager(Handler, MachineWide))
            {
                AppEntry appEntry;
                var      appAlias = GetAppAlias(integrationManager.AppList, aliasName, out appEntry);
                if (appAlias == null)
                {
                    Handler.Output(Resources.AppAlias, string.Format(Resources.AliasNotFound, aliasName));
                    return(ExitCode.InvalidArguments);
                }

                if (_resolve)
                {
                    string result = appEntry.InterfaceUri.ToStringRfc();
                    if (!string.IsNullOrEmpty(appAlias.Command))
                    {
                        result += Environment.NewLine + "Command: " + appAlias.Command;
                    }
                    Handler.OutputLow(Resources.AppAlias, result);
                }
                if (_remove)
                {
                    integrationManager.RemoveAccessPoints(appEntry, new AccessPoint[] { appAlias });

                    Handler.OutputLow(Resources.AppAlias, string.Format(Resources.AliasRemoved, aliasName, appEntry.Name));
                }
                return(ExitCode.OK);
            }
        }
Exemple #5
0
    /// <summary>
    /// Returns a command-line for executing the "0install run" command. Generates and returns a stub EXE if possible, falls back to directly pointing to the "0install" binary otherwise.
    /// </summary>
    /// <param name="target">The application to be launched.</param>
    /// <param name="command">The command argument to be passed to the the "0install run" command; can be <c>null</c>.</param>
    /// <param name="machineWide"><c>true</c> place the generated stub in a machine-wide location; <c>false</c> to place it in the current user profile.</param>
    /// <returns></returns>
    /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
    /// <exception cref="InvalidOperationException">There was a compilation error while generating the stub EXE.</exception>
    /// <exception cref="IOException">A problem occurred while writing to the filesystem.</exception>
    /// <exception cref="WebException">A problem occurred while downloading additional data (such as icons).</exception>
    /// <exception cref="UnauthorizedAccessException">Write access to the filesystem is not permitted.</exception>
    public IReadOnlyList <string> GetRunCommandLine(FeedTarget target, string?command = null, bool machineWide = false)
    {
        var  entryPoint = target.Feed.GetEntryPoint(command);
        bool gui        = entryPoint is not {
            NeedsTerminal : true
        };

        try
        {
#if NETFRAMEWORK
            string hash    = (target.Uri + "#" + command).Hash(SHA256.Create());
            string exeName = (entryPoint == null)
                ? FeedUri.Escape(target.Feed.Name)
                : entryPoint.BinaryName ?? entryPoint.Command;
            string path = Path.Combine(
                IntegrationManager.GetDir(machineWide, "stubs", hash),
                exeName + ".exe");

            CreateOrUpdateRunStub(path, target, gui, command);
            return(new[] { path });
#else
            return(GetArguments(target.Uri, command, gui)
                   .Prepend(GetBinary(gui))
                   .ToList());
#endif
        }
        #region Error handling
        catch (InvalidOperationException ex)
        {
            // Wrap exception since only certain exception types are allowed
            throw new IOException(ex.Message, ex);
        }
        #endregion
    }
Exemple #6
0
    /// <summary>
    /// Returns a command-line for executing the "0install run" command.
    /// Generates and returns a stub EXE if possible, falls back to directly pointing to the "0install" EXE otherwise.
    /// </summary>
    /// <param name="target">The application to be launched.</param>
    /// <param name="command">The command argument to be passed to the the "0install run" command; can be <c>null</c>.</param>
    /// <param name="machineWide"><c>true</c> place the generated stub in a machine-wide location; <c>false</c> to place it in the current user profile.</param>
    /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
    /// <exception cref="InvalidOperationException">There was a compilation error while generating the stub EXE.</exception>
    /// <exception cref="IOException">A problem occurred while writing to the filesystem.</exception>
    /// <exception cref="WebException">A problem occurred while downloading additional data (such as icons).</exception>
    /// <exception cref="UnauthorizedAccessException">Write access to the filesystem is not permitted.</exception>
    public IReadOnlyList <string> GetRunCommandLine(FeedTarget target, string?command = null, bool machineWide = false)
    {
        string targetKey = target.Uri + "#" + command;

        var  entryPoint = target.Feed.GetEntryPoint(command);
        bool gui        = entryPoint is not {
            NeedsTerminal : true
        };

        string targetHash = targetKey.Hash(SHA256.Create());
        string exeName    = (entryPoint == null)
            ? FeedUri.Escape(target.Feed.Name)
            : entryPoint.BinaryName ?? entryPoint.Command;
        string path = Path.Combine(
            IntegrationManager.GetDir(machineWide, "stubs", targetHash),
            exeName + ".exe");

#if !DEBUG
        try
#endif
        {
            CreateOrUpdateRunStub(path, target, gui, command);
            return(new[] { path });
        }
#if !DEBUG
        catch (Exception ex)
        {
            var exe = GetExe(gui);
            Log.Error($"Failed to generate stub EXE for {targetKey}. Falling back to using '{exe}' directly.", ex);
            return(GetArguments(target.Uri, command, gui)
                   .Prepend(Path.Combine(Locations.InstallBase, exe))
                   .ToList());
        }
#endif
    }
Exemple #7
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);
                }
            }
        }
Exemple #8
0
 /// <summary>
 /// Handles the Click event of the Link button.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void btnLink_Click(object sender, EventArgs e)
 {
     if (_mergeContactsStateInfo.SelectedRowTargetIndex != null &&
         _mergeContactsStateInfo.SelectedRowSourceIndex != null)
     {
         IntegrationManager.MatchingInfoAddMatchedChildPair(_mergeContactsStateInfo.SelectedSourceId,
                                                            _mergeContactsStateInfo.SelectedTargetId);
         IList <ComponentView> matchedContacts = IntegrationManager.MatchedContacts;
         string[] propertyNames = new[]
         {
             "sourceId", "targetId", "firstName", "lastName"
         };
         object[] propertyValues = new[]
         {
             _mergeContactsStateInfo.SelectedSourceId,
             _mergeContactsStateInfo.SelectedTargetId,
             _mergeContactsStateInfo.FirstName,
             _mergeContactsStateInfo.LastName
         };
         ComponentView view = new ComponentView(propertyNames, propertyValues);
         matchedContacts.Add(view);
         IntegrationManager.SourceContacts.RemoveAt((int)_mergeContactsStateInfo.SelectedRowSourceIndex);
         IntegrationManager.TargetContacts.RemoveAt((int)_mergeContactsStateInfo.SelectedRowTargetIndex);
     }
     else
     {
         throw new ApplicationException(GetLocalResourceObject("Error_SourceTargetNotSelected").ToString());
     }
 }
        public void UninstallPackage([NotNull] string fastPackageReference)
        {
            var  requirements = ParseReference(fastPackageReference);
            bool machineWide  = _request.OptionKeys.Contains(MachineWideKey);

            using (var integrationManager = new IntegrationManager(Handler, machineWide))
                integrationManager.RemoveApp(integrationManager.AppList[requirements.InterfaceUri]);
        }
Exemple #10
0
    /// <summary>
    /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
    /// </summary>
    /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        if (!_loadResults)
        {
            return;
        }
        if (DialogService.DialogParameters.ContainsKey("mergeArguments"))
        {
            grdMerge.Height            = 450;
            rowStandardButtons.Visible = true;
            rowWizardButtons.Visible   = false;

            //Verify the user has read write permissions for every property in the configuration mappings.
            //if (SessionMergeArguments.MergeProvider == null)
            //{
            //    MergeArguments.GetMergeProvider(SessionMergeArguments);
            //}
            if (!SessionMergeArguments.MergeProvider.ValidateUserSecurity())
            {
                throw new ValidationException(GetLocalResourceObject("error_Security_NoAccess").ToString());
            }

            grdMerge.DataSource = SessionMergeArguments.MergeProvider.GetMergeView(Convert.ToBoolean(txtShowAll.Value));
            _recordOverwrite    = SessionMergeArguments.MergeProvider.RecordOverwrite;
        }
        else
        {
            if (DialogService.DialogParameters.ContainsKey("IntegrationManager"))
            {
                lnkMergeRecordsHelp.NavigateUrl = "Merge_Data.htm";
                rowStandardButtons.Visible      = false;
                rowWizardButtons.Visible        = true;
                grdMerge.Height = 275;
                if (IntegrationManager.DataViewMappings == null)
                {
                    IntegrationManager.SetMergeDataMappings(Convert.ToBoolean(txtShowAll.Value));
                }
                grdMerge.DataSource = IntegrationManager.DataViewMappings;
            }
        }
        grdMerge.DataBind();
        if (grdMerge.Rows != null && grdMerge.Rows.Count <= 0)
        {
            lblMergeText.Text = GetLocalResourceObject("lblMergeText_NoDifferences.Text").ToString();
            lblMergeDetailDifferences.Text = GetLocalResourceObject("lblMergeDetailNoDifferences.Caption").ToString();
        }
        else
        {
            lblMergeText.Text = GetLocalResourceObject("lblMergeText_DifferencesFound.Text").ToString();
            lblMergeDetailDifferences.Text = GetLocalResourceObject("lblMergeDetailDifferences.Caption").ToString();
        }
        lnkShowAll.Text = Convert.ToBoolean(txtShowAll.Value)
                              ? GetLocalResourceObject("lnkHideDups.Caption").ToString()
                              : GetLocalResourceObject("lnkShowAll.Caption").ToString();
        lnkShowAllWizard.Text = Convert.ToBoolean(txtShowAll.Value)
                                    ? GetLocalResourceObject("lnkHideDups.Caption").ToString()
                                    : GetLocalResourceObject("lnkShowAll.Caption").ToString();
    }
    /// <inheritdoc/>
    public override ExitCode Execute()
    {
        CheckInstallBase();

        using var integrationManager = new IntegrationManager(Config, Handler, MachineWide);
        integrationManager.Repair(FeedManager.GetFresh);

        return(ExitCode.OK);
    }
Exemple #12
0
 /// <summary>
 /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
 /// </summary>
 /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
 protected override void OnPreRender(EventArgs e)
 {
     if (loadSearchResults)
     {
         grdMatches.DataSource = IntegrationManager.GetMatches();
         grdMatches.DataBind();
     }
     SetViewDisplay();
     InitializeScript();
 }
 /// <summary>
 /// Shows a particular dialog setting the caption height and width.
 /// </summary>
 /// <param name="dialog">The name of the dialog to be displayed.</param>
 /// <param name="caption">The caption of the dialog to be displayed.</param>
 /// <param name="height">The height of the dialog to be displayed.</param>
 /// <param name="width">The width of the dialog to be displayed.</param>
 private void ShowDialog(string dialog, string caption, int height, int width)
 {
     DialogService.SetSpecs(200, 200, height, width, dialog, caption, true);
     if (DialogService.DialogParameters.ContainsKey("IntegrationManager"))
     {
         DialogService.DialogParameters.Remove("IntegrationManager");
     }
     DialogService.DialogParameters.Add("IntegrationManager", IntegrationManager);
     _integrationManager = null;
     DialogService.ShowDialog();
 }
        public void UninstallPackage(string fastPackageReference)
        {
            if (MachineWide && !WindowsUtils.IsAdministrator)
            {
                throw new NotAdminException(Resources.MustBeAdminForMachineWide);
            }

            var requirements = ParseReference(fastPackageReference);

            using var integrationManager = new IntegrationManager(Config, Handler, MachineWide);
            integrationManager.RemoveApp(integrationManager.AppList[requirements.InterfaceUri]);
        }
Exemple #15
0
 void Awake()
 {
     mInstance          = this;
     board              = GetComponent <Board> ();
     shapesManager      = GetComponent <ShapesManager> ();
     inputManager       = GetComponent <InputManager> ();
     shapeMove          = GetComponent <ShapeMove> ();
     integrationManager = GetComponent <IntegrationManager> ();
     redimensionManager = GetComponent <RedimensionManager> ();
     combinarManager    = GetComponent <CombinarManager> ();
     levelManager       = GetComponent <LevelManager> ();
 }
    /// <summary>
    /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
    /// </summary>
    /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        if (!_loadResults)
        {
            return;
        }
        if (DialogService.DialogParameters.ContainsKey("mergeArguments"))
        {
            if (!Sage.SalesLogix.BusinessRules.BusinessRuleHelper.ValidateCanMergeEntity(SessionMergeArguments))
            {
                DialogService.DialogParameters.Remove("mergeArguments");
                throw new ValidationException(GetLocalResourceObject("error_Promoted_Target").ToString());
            }
            btnBack.Visible = false;
            grdMerge.Height = 450;
            if (!SessionMergeArguments.MergeProvider.ValidateUserSecurity())
            {
                throw new UserObservableApplicationException(GetLocalResourceObject("error_Security_NoAccess").ToString());
            }

            grdMerge.DataSource = SessionMergeArguments.MergeProvider.GetMergeView(Convert.ToBoolean(txtShowAll.Value));
            _recordOverwrite    = SessionMergeArguments.MergeProvider.RecordOverwrite;
        }
        else
        {
            if (DialogService.DialogParameters.ContainsKey("IntegrationManager"))
            {
                lnkMergeRecordsHelp.NavigateUrl = "Merge_Data.htm";
                grdMerge.Height = 275;
                if (IntegrationManager.DataViewMappings == null)
                {
                    IntegrationManager.SetMergeDataMappings(Convert.ToBoolean(txtShowAll.Value));
                }
                grdMerge.DataSource = IntegrationManager.DataViewMappings;
            }
        }
        grdMerge.DataBind();
        if (grdMerge.Rows.Count <= 0)
        {
            lblMergeText.Text = GetLocalResourceObject("lblMergeText_NoDifferences.Text").ToString();
            lblMergeDetailDifferences.Text = GetLocalResourceObject("lblMergeDetailNoDifferences.Caption").ToString();
        }
        else
        {
            lblMergeText.Text = GetLocalResourceObject("lblMergeText_DifferencesFound.Text").ToString();
            lblMergeDetailDifferences.Text = GetLocalResourceObject("lblMergeDetailDifferences.Caption").ToString();
        }
        lnkShowAllWizard.Text = Convert.ToBoolean(txtShowAll.Value)
                                    ? GetLocalResourceObject("lnkHideDups.Caption").ToString()
                                    : GetLocalResourceObject("lnkShowAll.Caption").ToString();
    }
    /// <summary>
    /// Raises the <see cref="E:System.Web.UI.Control.PreRender"/> event.
    /// </summary>
    /// <param name="e">An <see cref="T:System.EventArgs"/> object that contains the event data.</param>
    protected override void OnPreRender(EventArgs e)
    {
        InitializeScript();
        rdbCreateNew.Attributes.Add("onClick", "return advancedSearchOptions.clearTargetSelection();");
        rdbRefineSearch.Attributes.Add("onClick", "return advancedSearchOptions.clearTargetSelection();");
        string error = String.Empty;

        if (_loadSearchResults)
        {
            grdMatches.DataSource = IntegrationManager.GetMatches(out error);
            grdMatches.DataBind();
        }
        SetViewDisplay(error);
    }
Exemple #18
0
    /// <inheritdoc />
    protected override ExitCode ExecuteHelper()
    {
        string aliasName = AdditionalArgs[0];

        if (_resolve || _remove)
        {
            if (AdditionalArgs.Count > 1)
            {
                throw new OptionException(Resources.TooManyArguments + Environment.NewLine + AdditionalArgs[1].EscapeArgument(), null);
            }

            var match = IntegrationManager.AppList.FindAppAlias(aliasName);
            if (!match.HasValue)
            {
                Handler.Output(Resources.AppAlias, string.Format(Resources.AliasNotFound, aliasName));
                return(ExitCode.NoChanges);
            }
            var(alias, appEntry) = match.Value;

            if (_resolve)
            {
                string result = appEntry.InterfaceUri.ToStringRfc();
                if (!string.IsNullOrEmpty(alias.Command))
                {
                    result += Environment.NewLine + "Command: " + alias.Command;
                }
                Handler.OutputLow(Resources.AppAlias, result);
            }
            if (_remove)
            {
                IntegrationManager.RemoveAccessPoints(appEntry, new AccessPoint[] { alias });

                Handler.OutputLow(Resources.AppAlias, string.Format(Resources.AliasRemoved, aliasName, appEntry.Name));
            }
            return(ExitCode.OK);
        }
        else
        {
            if (AdditionalArgs.Count < 2 || string.IsNullOrEmpty(AdditionalArgs[1]))
            {
                throw new OptionException(Resources.MissingArguments, null);
            }
            string?command = (AdditionalArgs.Count >= 3) ? AdditionalArgs[2] : null;

            var appEntry = GetAppEntry(IntegrationManager, ref InterfaceUri);
            CreateAlias(appEntry, aliasName, command);
            return(ExitCode.OK);
        }
    }
Exemple #19
0
 /// <summary>
 /// Handles the OnClick event of the lnkShowAll control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void lnkShowAll_OnClick(object sender, EventArgs e)
 {
     if (DialogService.DialogParameters.ContainsKey("mergeArguments"))
     {
         IList <MergeRecordView> mergeView = SessionMergeArguments.MergeProvider.GetMergeView(Convert.ToBoolean(txtShowAll.Value));
         grdMerge.DataSource = mergeView;
     }
     else
     {
         IntegrationManager integrationManager = DialogService.DialogParameters["IntegrationManager"] as IntegrationManager;
         integrationManager.SetMergeDataMappings(Convert.ToBoolean(txtShowAll.Value));
         grdMerge.DataSource = integrationManager.DataViewMappings;
     }
     grdMerge.DataBind();
 }
    /// <summary>
    /// Handles the OnClick event of the btnReloadGrid control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnReloadGrid_OnClick(object sender, EventArgs e)
    {
#pragma warning disable 612,618
        var filters = (JavaScriptArray)JavaScriptConvert.DeserializeObject(txtFilters.Text);
        List <MatchingExpression> expressions = (from JavaScriptObject filter in filters
                                                 select
                                                 new MatchingExpression(filter["fieldName"].ToString(),
                                                                        (MatchingOperation)
                                                                        Convert.ToInt16(filter["operator"]),
                                                                        filter["searchValue"].ToString())).ToList();
#pragma warning restore 612,618
        grdMatches.DataSource = IntegrationManager.GetMatches(expressions);
        grdMatches.DataBind();
        _loadSearchResults = false;
    }
Exemple #21
0
        /// <inheritdoc/>
        public override ExitCode Execute()
        {
            if (!Handler.Ask(Resources.ConfirmRemoveAll, defaultAnswer: true))
            {
                return(ExitCode.NoChanges);
            }

            using var integrationManager = new IntegrationManager(Config, Handler, MachineWide);
            Handler.RunTask(ForEachTask.Create(Resources.RemovingApplications, integrationManager.AppList.Entries.ToList(), integrationManager.RemoveApp));

            // Purge sync status, otherwise next sync would remove everything from server as well instead of restoring from there
            File.Delete(AppList.GetDefaultPath(MachineWide) + SyncIntegrationManager.AppListLastSyncSuffix);

            return(ExitCode.OK);
        }
        /// <inheritdoc/>
        protected override ExitCode ExecuteHelper()
        {
            try
            {
                IntegrationManager.RemoveApp(IntegrationManager.AppList[InterfaceUri]);
            }
            #region Sanity checks
            catch (KeyNotFoundException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(ex.Message, ex);
            }
            #endregion

            return(ExitCode.OK);
        }
    protected void grdLinkedRecords_OnRowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    rowIndex = Convert.ToInt32(e.CommandArgument);
        string sourceId = grdLinkedRecords.DataKeys[rowIndex].Values[0].ToString();
        string targetId = grdLinkedRecords.DataKeys[rowIndex].Values[1].ToString();

        if (DialogService.DialogParameters.ContainsKey("mergeArguments"))
        {
            SessionMergeArguments.MatchingRecordView.RemoveMatchedAddress(sourceId, targetId);
        }
        else
        {
            IntegrationManager.MatchingInfoRemoveMatchedChildPair(sourceId, targetId);
            IntegrationManager.MatchedContacts.RemoveAt(rowIndex);
        }
    }
Exemple #24
0
    /// <inheritdoc/>
    protected override ExitCode ExecuteHelper()
    {
        var appEntry = IntegrationManager.AppList.GetEntry(InterfaceUri);

        if (appEntry == null)
        {
            Log.Warn(string.Format(Resources.AliasNotFound, InterfaceUri));
            return(ExitCode.NoChanges);
        }

        if (appEntry.AccessPoints != null)
        {
            CheckInstallBase();
        }

        foreach (var hook in appEntry.CapabilityLists.CompatibleCapabilities().OfType <RemoveHook>())
        {
            var process = StartRemoveHook(hook);
            if (process == null)
            {
                continue;
            }

            try
            {
                process.WaitForSuccess();
            }
            catch (ExitCodeException ex)
            {
                Log.Info($"Remove process for {InterfaceUri} cancelled by remove hook {hook.ID} with exit code {ex.ExitCode}");
                return((ExitCode)ex.ExitCode);
            }
        }

        IntegrationManager.RemoveApp(appEntry);

        if (ZeroInstallInstance.IsLibraryMode &&
            !ExistingDesktopIntegration() &&
            (!ZeroInstallInstance.IsMachineWide || !ExistingDesktopIntegration(machineWide: true)))
        {
            Log.Info("Last app removed, auto-removing library mode Zero Install instance");
            StartCommandBackground(Self.Name, Self.Remove.Name, "--batch");
        }

        return(ExitCode.OK);
    }
Exemple #25
0
        /// <summary>
        /// Removes all applications from the <see cref="AppList"/> and undoes any desktop environment integration.
        /// </summary>
        /// <param name="handler">A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.</param>
        /// <param name="machineWide">Apply the operation machine-wide instead of just for the current user.</param>
        public static void RemoveAllApps(ITaskHandler handler, bool machineWide)
        {
            #region Sanity checks
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            #endregion

            using (var integrationManager = new IntegrationManager(handler, machineWide))
            {
                handler.RunTask(ForEachTask.Create(Resources.RemovingApplications, integrationManager.AppList.Entries.ToList(), integrationManager.RemoveApp));

                // Purge sync status, otherwise next sync would remove everything from server as well instead of restoring from there
                File.Delete(AppList.GetDefaultPath(machineWide) + SyncIntegrationManager.AppListLastSyncSuffix);
            }
        }
Exemple #26
0
    /// <summary>
    /// Handles the OnClick event of the btnNext control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnNext_OnClick(object sender, EventArgs e)
    {
        int height = 250;
        int width  = 500;

        if (IntegrationManager.MergeData())
        {
            IntegrationManager.LinkChildren = true;
            IntegrationManager.LinkOperatingCompany();
        }
        if (!String.IsNullOrEmpty(IntegrationManager.LinkAccountError))
        {
            height = 500;
            width  = 750;
        }
        ShowDialog("LinkResults", GetLocalResourceObject("LinkToAccounting.Caption").ToString(), height, width);
    }
 /// <summary>
 /// Handles the OnClick event of the btnNext control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
 protected void btnNext_OnClick(object sender, EventArgs e)
 {
     lblExtendedDetails.Visible = false;
     ContextService.RemoveContext("MergeContactsStateInfo");
     if (DialogService.DialogParameters.ContainsKey("mergeArguments"))
     {
         if (SessionMergeArguments.TargetEntityType == typeof(IAccount) && SessionMergeArguments.MatchingRecordView.MatchedContacts.Count > 0)
         {
             ShowDialog("MergeContactAddress", GetLocalResourceObject("LinkContactAddresses.Caption").ToString(), 600, 1300);
         }
         else
         {
             SessionMergeArguments.MergeProvider.AssignMatchedChildren(SessionMergeArguments.MatchingRecordView);
             if (Sage.SalesLogix.BusinessRules.BusinessRuleHelper.MergeRecords(SessionMergeArguments))
             {
                 using (new Sage.Platform.Orm.SessionScopeWrapper(true))
                 {
                     Type              type     = SessionMergeArguments.MergeProvider.Target.EntityType;
                     string            entityId = SessionMergeArguments.MergeProvider.Source.EntityId;
                     IPersistentEntity source   = Sage.Platform.EntityFactory.GetById(type, entityId) as IPersistentEntity;
                     source.Delete();
                     EntityService.RemoveEntityHistory(type, source);
                     DialogService.CloseEventHappened(sender, e);
                     Response.Redirect(String.Format("{0}.aspx", GetEntityName(type)));
                 }
             }
         }
     }
     else
     {
         int height = 250;
         int width  = 500;
         if (IntegrationManager.MergeData())
         {
             IntegrationManager.LinkChildren = true;
             IntegrationManager.LinkOperatingCompany();
         }
         if (!String.IsNullOrEmpty(IntegrationManager.LinkAccountError))
         {
             height = 500;
             width  = 750;
         }
         ShowDialog("LinkResults", GetLocalResourceObject("LinkToAccounting.Caption").ToString(), height, width);
     }
 }
    /// <inheritdoc/>
    public override ExitCode Execute()
    {
        var importList = XmlStorage.LoadXml <AppList>(AdditionalArgs[0]);

        using var integrationManager = new IntegrationManager(Config, Handler, MachineWide);
        foreach (var importEntry in importList.Entries)
        {
            var interfaceUri = importEntry.InterfaceUri;
            var appEntry     = GetAppEntry(integrationManager, ref interfaceUri);

            if (importEntry.AccessPoints != null)
            {
                var feed = FeedManager[interfaceUri];
                integrationManager.AddAccessPoints(appEntry, feed, importEntry.AccessPoints.Entries);
            }
        }

        return(ExitCode.OK);
    }
Exemple #29
0
        public static void OnStartup()
        {
            try
            {
                Persistent.Load();
                Access.Initialize();
                Textures.Initialize();

                IntegrationManager.Initialize();
                CompatibilityManager.Initialize();
            }
            catch (System.Exception exception)
            {
                var info = new ExceptionInfo(exception);
                Error("RimHUD was unable to initialize properly due to the following exception:\n" + info.Text);
                State.Activated = false;
                Harmony.UnpatchAll();
            }
        }
Exemple #30
0
    protected void grdLinkedRecords_OnRowCommand(object sender, GridViewCommandEventArgs e)
    {
        int    rowIndex = Convert.ToInt32(e.CommandArgument);
        string sourceId = grdLinkedRecords.DataKeys[rowIndex].Values[0].ToString();
        string targetId = grdLinkedRecords.DataKeys[rowIndex].Values[1].ToString();

        switch (e.CommandName.ToUpper())
        {
        case "SELECT":
            grdMatchDetails.DataSource = IntegrationManager.GetExtendedContactDetails(sourceId, targetId);
            grdMatchDetails.DataBind();
            break;

        case "UNLINK":
            IntegrationManager.MatchingInfoRemoveMatchedChildPair(sourceId, targetId);
            IntegrationManager.MatchedContacts.RemoveAt(rowIndex);
            break;
        }
    }
 /// <summary>
 /// Shows a particular dialog setting the caption height and width.
 /// </summary>
 /// <param name="dialog">The name of the dialog to be displayed.</param>
 /// <param name="caption">The caption of the dialog to be displayed.</param>
 /// <param name="height">The height of the dialog to be displayed.</param>
 /// <param name="width">The width of the dialog to be displayed.</param>
 private void ShowDialog(string dialog, string caption, int height, int width)
 {
     DialogService.SetSpecs(200, 200, height, width, dialog, caption, true);
     if (DialogService.DialogParameters.ContainsKey("IntegrationManager"))
     {
         DialogService.DialogParameters.Remove("IntegrationManager");
     }
     DialogService.DialogParameters.Add("IntegrationManager", IntegrationManager);
     _integrationManager = null;
     DialogService.ShowDialog();
 }