private void ProcessSearchPage(UPMGridPage searchPage, IReadOnlyList <string> contextMenuOptions, ICrmDataSourceRow crmRow, UPMResultRow listRow, AnalysisResult analysisResult, Page oldPage, int i)
        {
            var dataSource = analysisResult.DataSource;

            for (var j = 0; j < dataSource.NumberOfResultTables; j++)
            {
                var label = contextMenuOptions[j];
                if (string.IsNullOrEmpty(label))
                {
                    continue;
                }

                var recordIdentification = crmRow.RecordIdentificationAtIndex(j);
                if (recordIdentification?.Length > 0)
                {
                    var showRecordAction = new UPMOrganizerAnalysisShowRecordAction(StringIdentifier.IdentifierWithStringId($"action.row {i} record {j}"))
                    {
                        RecordIdentification = recordIdentification
                    };

                    showRecordAction.SetTargetAction(this, this.PerformShowRecordAction);
                    showRecordAction.LabelText = label;
                    listRow.AddDetailAction(showRecordAction);
                }

                var backAction = new UPMOrganizerAnalysisBackAction(StringIdentifier.IdentifierWithStringId("action.back"))
                {
                    AnalysisResult = analysisResult
                };

                backAction.SetTargetAction(this, this.PerformBackToAnalysis);
                backAction.LabelText = LocalizedString.TextAnalysesBackToAnalysis;
                searchPage.AddHeadOption(new UPMGridHeadOption(backAction.LabelText, backAction));
                searchPage.FixedFirstColumn = false;
                searchPage.SumRowAtEnd      = false;
                var hasOnlyEmptyLabels = true;
                foreach (var lbl in contextMenuOptions)
                {
                    if (lbl.Length > 0)
                    {
                        hasOnlyEmptyLabels = false;
                        break;
                    }
                }

                searchPage.ShowMenu  = !hasOnlyEmptyLabels;
                this.TopLevelElement = searchPage;
                this.InformAboutDidChangeTopLevelElement(oldPage, searchPage, null, null);
            }
        }
 private void UpdateResetHeadOption(UPMGridPage searchPage, bool reset, AnalysisResult result)
 {
     if (reset && searchPage.ResetHeadOption == null)
     {
         var resetAction = new UPMOrganizerAnalysisBackAction(StringIdentifier.IdentifierWithStringId("action.reset"))
         {
             AnalysisResult = result
         };
         resetAction.SetTargetAction(this, this.PerformResetAnalysis);
         resetAction.LabelText = LocalizedString.TextAnalysesReset;
         var option = new UPMGridHeadOption(resetAction.LabelText, resetAction)
         {
             IsReset = true
         };
         searchPage.ResetHeadOption = option;
     }
 }