Esempio n. 1
0
        /// <summary>
        /// Builds the pages from view reference.
        /// </summary>
        public override void BuildPagesFromViewReference()
        {
            SyncConflictsPageModelController pageModelController = new SyncConflictsPageModelController();
            UPMOrganizer syncConflictOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("SyncConflictsOrganizer"))
            {
                ExpandFound  = true,
                SubtitleText = LocalizedString.TextSyncConflictsTitle
            };

            this.ShouldShowTabsForSingleTab = false;
            UPMOrganizerAction retryAction       = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.retry"));
            UPMOrganizerAction reportErrorAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.report"));
            string             retryText         = LocalizedString.Localize(LocalizationKeys.TextGroupBasic, LocalizationKeys.KeyBasicSyncConflictsRetryAll, "Retry All");

            retryAction.LabelText = retryText;
            retryAction.IconName  = "Icon:Record";
            retryAction.SetTargetAction(this, this.RetryAll);
            this.AddOrganizerHeaderActionItem(retryAction);
            IOfflineStorage offlineStorage = UPOfflineStorage.DefaultStorage;

            if (!string.IsNullOrEmpty(ConfigurationUnitStore.DefaultStore.ConfigValue("Sync.ConflictEmailAddress")) &&
                offlineStorage.ConflictRequests?.Count > 1 &&
                !string.IsNullOrEmpty(offlineStorage.OfflineRequestXml()))
            {
                string sendRequestXmlText = LocalizedString.Localize(LocalizationKeys.TextGroupBasic, LocalizationKeys.KeyBasicSyncConflictsReportAllErrors, "Report all errors");
                reportErrorAction.LabelText = sendRequestXmlText;
                reportErrorAction.SetTargetAction(this, this.ReportAllErrors);
                this.AddOrganizerHeaderActionItem(reportErrorAction);
            }

            this.AddPageModelController(pageModelController);
            syncConflictOrganizer.AddPage(pageModelController.Page);
            this.TopLevelElement = syncConflictOrganizer;
        }
        /// <summary>
        /// Builds the pages from view reference.
        /// </summary>
        public override void BuildPagesFromViewReference()
        {
            SyncConflictsPageModelController pageModelController = new SyncConflictsPageModelController();
            UPMOrganizer syncConflictOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("SyncConflictOrganizer"))
            {
                ExpandFound                  = true,
                DisplaysTitleText            = true,
                LineCountAdditionalTitletext = 1,
                SubtitleText                 = LocalizedString.TextSyncConflictsTitle,
                TitleText           = this.SyncConflict.MainField.StringValue,
                AdditionalTitleText = (string)this.SyncConflict.DetailField?.FieldValue
            };

            this.ShouldShowTabsForSingleTab = false;
            if (this.IsDiscardAllowed())
            {
                UPMOrganizerAction discardAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.discard"))
                {
                    LabelText = LocalizedString.Localize(LocalizationKeys.TextGroupBasic,
                                                         LocalizationKeys.KeyBasicSyncConflictsActionDiscardChanges, "DISCARD CONFLICT"),
                    IconName = "Icon:Trash"
                };

                discardAction.SetTargetAction(this, this.DiscardError);
                this.AddOrganizerHeaderActionItem(discardAction);
            }

            this.AddPageModelController(pageModelController);
            syncConflictOrganizer.AddPage(pageModelController.Page);
            this.TopLevelElement = syncConflictOrganizer;
        }
        /// <summary>
        /// Builds the detail organizer pages.
        /// </summary>
        public void BuildDetailOrganizerPages()
        {
            UPMOrganizer detailOrganizer = new UPMOrganizer(StringIdentifier.IdentifierWithStringId("Details"));

            this.TopLevelElement        = detailOrganizer;
            detailOrganizer.ExpandFound = true;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            string          configName          = this.ViewReference.ContextValueForKey("LayoutName");
            WebConfigLayout layout = configStore.WebConfigLayoutByName(configName);

            if (layout == null)
            {
                return;
            }

            string organizerColorKey = this.ViewReference.ContextValueForKey("OrganizerColor");

            if (!string.IsNullOrEmpty(organizerColorKey))
            {
                this.Organizer.OrganizerColor = AureaColor.ColorWithString(organizerColorKey);
            }

            string         headerName = this.ViewReference.ContextValueForKey("HeaderName");
            UPConfigHeader header     = null;

            if (!string.IsNullOrEmpty(headerName))
            {
                header = configStore.HeaderByName(headerName);
            }

            if (header == null)
            {
                headerName = "SYSTEMINFO.Expand";
                header     = configStore.HeaderByName(headerName);
            }

            if (header != null)
            {
                detailOrganizer.SubtitleText = header.Label;
                this.AddActionButtonsFromHeaderRecordIdentification(header, null);
            }
            else
            {
                detailOrganizer.SubtitleText = LocalizedString.TextSettings;
                UPMOrganizerAction action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.edit"));
                action.SetTargetAction(this, this.SwitchToEdit);
                action.LabelText = LocalizedString.TextEdit;
                action.IconName  = "Button:Edit";
                this.AddOrganizerHeaderActionItem(action);
            }

            SettingsViewPageModelController detailPageModelController = new SettingsViewPageModelController(this.ViewReference);
            Page overviewPage = detailPageModelController.Page;

            this.AddPageModelController(detailPageModelController);
            detailOrganizer.AddPage(overviewPage);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds the remaining page model controller.
        /// </summary>
        public void AddRemainingPageModelController()
        {
            this.created = true;
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPConfigHeader          editHeader  = configStore.HeaderByNameFromGroup(this.IsNew ? "New" : "Update", this.ExpandConfig.HeaderGroupName) ??
                                                  configStore.HeaderByNameFromGroup("Edit", this.ExpandConfig.HeaderGroupName);

            if (editHeader != null && editHeader.SubViews.Count != 0)
            {
                Page rootPage = this.PageModelControllers[0].Page;
                if (string.IsNullOrEmpty(rootPage.LabelText) && !string.IsNullOrEmpty(editHeader.Label))
                {
                    this.PageModelControllers[0].Page.LabelText = editHeader.Label;
                }

                foreach (UPConfigHeaderSubView subView in editHeader.SubViews)
                {
                    ViewReference pageViewReference = this.CopyFieldDictionary != null
                        ? subView.ViewReference.ViewReferenceWith(new Dictionary <string, object> {
                        { "copyFields", this.CopyFieldDictionary }
                    })
                        : subView.ViewReference;

                    UPPageModelController pageModelController = pageViewReference.ViewName == "RecordView"
                        ? new EditPageModelController(pageViewReference.ViewReferenceWith(this.RecordIdentification))
                        : this.PageForViewReference(pageViewReference.ViewReferenceWith(this.RecordIdentification));

                    if (pageModelController != null)
                    {
                        if (pageModelController is SerialEntryPageModelController)
                        {
                            //pageModelController.AddObserverForKeyPathOptionsContext(this, "hasRunningChangeRequests", NSKeyValueObservingOptionNew, null);
                        }

                        pageModelController.Page.Invalid   = true;
                        pageModelController.Page.LabelText = subView.Label;
                        pageModelController.Delegate       = this;
                        this.AddPageModelController(pageModelController);
                        this.Organizer.AddPage(pageModelController.Page);

                        if (pageModelController is UPWebContentPageModelController)
                        {
                            if (((UPWebContentPageModelController)pageModelController).AllowsXMLExport)
                            {
                                UPMOrganizerAction exportXMLAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.exportXML"));
                                //exportXMLAction.SetTargetAction(pageModelController, ExportXML);
                                exportXMLAction.LabelText = "Export XML";
                                this.AddOrganizerHeaderActionItem(exportXMLAction);
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Adds the organizer actions.
        /// </summary>
        public override void AddOrganizerActions()
        {
            if (this.ConflictHandlingMode)
            {
                UPMOrganizerAction cancelAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.cancel"));
                cancelAction.SetTargetAction(this, this.Cancel);
                cancelAction.LabelText = LocalizedString.TextCancel;
                this.AddLeftNavigationBarActionItem(cancelAction);
            }

            this.RightAction           = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.create"));
            this.RightAction.LabelText = this.OfflineRequest != null ? LocalizedString.TextSave : LocalizedString.TextClose;
            this.RightAction.SetTargetAction(this, this.Save);
            this.AddRightNavigationBarActionItem(this.RightAction);
        }
Esempio n. 6
0
        /// <summary>
        /// The favorite model controller favorite record identification.
        /// </summary>
        /// <param name="favoriteModelController">The favorite model controller.</param>
        /// <param name="favoriteRecordIdentification">The favorite record identification.</param>
        public void FavoriteModelControllerFavoriteRecordIdentification(UPFavoriteModelController favoriteModelController, string favoriteRecordIdentification)
        {
            ((UPMOrganizer)this.TopLevelElement).FavoriteRecordIdentification = favoriteRecordIdentification;
            UPMOrganizerAction action = this.ActionItem(StringIdentifier.IdentifierWithStringId(Core.Constants.ActionIdToggleFavorite));

            if (action != null)
            {
                action.Aktive    = string.IsNullOrEmpty(favoriteRecordIdentification);
                action.LabelText = !action.Aktive ? LocalizedString.TextProcessDeleteFromFavorites : LocalizedString.TextProcessAddToFavorites;
                this.ModelControllerDelegate?.ModelControllerDidChange(this, this.TopLevelElement, this.TopLevelElement,
                                                                       new List <IIdentifier> {
                    action.Identifier
                }, UPChangeHints.ChangeHintsWithHint("ActionItemStatusChanged"));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Adds the organizer actions.
        /// </summary>
        public override void AddOrganizerActions()
        {
            UPMOrganizerAction cancelAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.cancel"));

            cancelAction.SetTargetAction(this, this.Cancel);
            cancelAction.LabelText = LocalizedString.TextCancel;
            this.AddLeftNavigationBarActionItem(cancelAction);
            UPMOrganizerAction saveAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.save"));

            saveAction.SetTargetAction(this, this.Save);
            saveAction.LabelText  = LocalizedString.TextSave;
            saveAction.MainAction = true;
            this.AddRightNavigationBarActionItem(saveAction);
            this.SaveActionItems.Add(saveAction);
        }
        private void AddCategoriesFromResultToPage(AnalysisResult result, UPMGridPage gridPage)
        {
            AnalysisCategory currentCategory = result.Settings.Category;

            gridPage.AddCategory(new UPMGridCategory(currentCategory.Label, null, true));
            foreach (AnalysisCategory category in result.CategoryOptions)
            {
                UPMOrganizerAction action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId($"action.{category.Key}"));
                action.SetTargetAction(this, this.PerformAnalysisWithCategory);
                action.ViewReference = new ViewReference(new Dictionary <string, object> {
                    { "Category", category.Key }
                }, "PerformAnalysis");
                action.LabelText = category.Label;
                gridPage.AddCategory(new UPMGridCategory(category.Label, action, false));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Adds Subview pages to UPMOrganizer
        /// </summary>
        /// <param name="expandHeader">
        /// <see cref="UPConfigHeader"/> configuration object
        /// </param>
        /// <param name="detailOrganizer">
        /// <see cref="UPMOrganizer"/> to add pages to
        /// </param>
        /// <param name="overviewPage">
        /// <see cref="Page"/> object to update LableText
        /// </param>
        private void UPMOrganizerAddPages(UPConfigHeader expandHeader, UPMOrganizer detailOrganizer, Page overviewPage)
        {
            var additionalParameters = new Dictionary <string, object> {
                { nameof(VirtualInfoAreaId), VirtualInfoAreaId }
            };

            if (expandHeader.SubViews != null)
            {
                foreach (UPConfigHeaderSubView subView in expandHeader.SubViews)
                {
                    if (subView.Options == "#")
                    {
                        overviewPage.LabelText = subView.Label;
                        continue;
                    }

                    UPPageModelController pageModelController = PageForViewReference(
                        subView.ViewReference?.ViewReferenceWith(additionalParameters).ViewReferenceWith(RecordIdentification));

                    if (pageModelController != null)
                    {
                        pageModelController.Page.Parent    = detailOrganizer;
                        pageModelController.Page.Invalid   = true;
                        pageModelController.Page.LabelText = subView.Label;
                        AddPageModelController(pageModelController);
                        if (pageModelController is UPWebContentPageModelController)
                        {
                            var webContentPageModelController = (UPWebContentPageModelController)pageModelController;
                            if (webContentPageModelController.AllowsXMLExport)
                            {
                                var exportXMLAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.exportXML"))
                                {
                                    LabelText = "Export XML"
                                };
                                AddOrganizerHeaderActionItem(exportXMLAction);
                            }
                        }

                        detailOrganizer.AddPage(pageModelController.Page);
                    }
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Sets the questionnaire finalized.
        /// </summary>
        /// <param name="finalized">if set to <c>true</c> [finalized].</param>
        public void SetQuestionnaireFinalized(bool finalized)
        {
            if (finalized)
            {
                UPMOrganizerAction action             = this.ActionItem(StringIdentifier.IdentifierWithStringId("action.save"));
                List <IIdentifier> changedIdentifiers = new List <IIdentifier>();
                if (action != null)
                {
                    action.LabelText = finalized ? LocalizedString.TextClose : LocalizedString.TextSave;
                    changedIdentifiers.Add(action.Identifier);
                }

                if (this.LeftNavigationBarItems.Count > 0)
                {
                    action         = (UPMOrganizerAction)this.LeftNavigationBarItems[0];
                    action.Enabled = false;
                    changedIdentifiers.Add(action.Identifier);
                }

                this.InformAboutDidChangeTopLevelElement(this.TopLevelElement, this.TopLevelElement, changedIdentifiers, UPChangeHints.ChangeHintsWithHint("EditActionsChanged"));
            }
        }
Esempio n. 11
0
        private void SaveRootTemplateFilterBaseTemplateFilter(object actionDictionary, UPConfigFilter rootTemplateFilter, UPConfigFilter baseTemplateFilter)
        {
            UPMOrganizerAction action = this.ActionItem(StringIdentifier.IdentifierWithStringId("action.save"));

            if (action.LabelText == LocalizedString.TextClose)
            {
                this.Cancel(actionDictionary);
                return;
            }

            List <UPCRMRecord> changedRecordArray = this.ChangedRecordsWithRootTemplateFilter(rootTemplateFilter, baseTemplateFilter, false);
            UPSurvey           survey             = null;

            foreach (UPPageModelController pageModelController in this.PageModelControllers)
            {
                if (survey == null && pageModelController is QuestionnaireEditPageModelController)
                {
                    survey = ((QuestionnaireEditPageModelController)pageModelController).Survey;
                }
            }

            if (changedRecordArray == null)
            {
                this.NoChangesWhileSaving();
                return;
            }

            if (survey != null)
            {
                UPMProgressStatus stillLoadingError = new UPMProgressStatus(StringIdentifier.IdentifierWithStringId("savingIdentifier"));
                UPMStringField    statusField       = new UPMStringField(StringIdentifier.IdentifierWithStringId("statusFieldIdentifier"));
                statusField.FieldValue = LocalizedString.TextWaitForChanges;
                stillLoadingError.StatusMessageField = statusField;
                this.Organizer.Status = stillLoadingError;
                this.InformAboutDidChangeTopLevelElement(this.TopLevelElement, this.TopLevelElement, null, null);

                survey.OfflineRequest.StartRequest(UPOfflineRequestMode.OnlineConfirm, changedRecordArray, this);
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Adds the organizer actions.
        /// </summary>
        public override void AddOrganizerActions()
        {
            this.leftAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.cancel"));
            this.leftAction.SetTargetAction(this, this.Cancel);
            this.leftAction.LabelText = LocalizedString.TextCancel;
            this.AddLeftNavigationBarActionItem(this.leftAction);
            if (this.IsNew == false)
            {
                this.RightAction            = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.save"));
                this.RightAction.MainAction = true;
                this.RightAction.LabelText  = LocalizedString.TextSerialEntryComplete;
                this.RightAction.SetTargetAction(this, this.Save);
                this.AddRightNavigationBarActionItem(this.RightAction);
                return;
            }

            this.RightAction            = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId("action.create"));
            this.RightAction.MainAction = true;
            this.RightAction.SetTargetAction(this, this.Save);
            this.RightAction.LabelText = LocalizedString.TextCreate;
            this.AddRightNavigationBarActionItem(this.RightAction);
        }
Esempio n. 13
0
        /// <summary>
        /// Adds row actions
        /// </summary>
        /// <param name="expand">Expand</param>
        /// <param name="resultRow">Result row</param>
        /// <param name="recordId">Record id</param>
        public override void AddRowActions(UPConfigExpand expand, UPMResultRow resultRow, string recordId)
        {
            base.AddRowActions(expand, resultRow, recordId);

            if (this.PreparedSearch.FilterBasedDecision != null)
            {
                var rowContext    = this.ResultContext.RowDictionary[resultRow.Key];
                var actionButtons = this.PreparedSearch.FilterBasedDecision.ButtonsForResultRow(rowContext.Row);

                if (actionButtons.Count > 0)
                {
                    foreach (UPConfigButton buttonDef in actionButtons)
                    {
                        string iconName   = string.Empty;
                        string buttonName = buttonDef.UnitName;

                        if (buttonDef.ViewReference != null)
                        {
                            var action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId($"action.{buttonName}"));

                            var viewReference = buttonDef.ViewReference.ViewReferenceWith(recordId);
                            viewReference = viewReference.ViewReferenceWith(new Dictionary <string, object> {
                                { ".fromPopup", 1 }
                            });
                            action.ViewReference = viewReference;

                            if (!string.IsNullOrEmpty(iconName))
                            {
                                action.IconName = iconName;
                            }

                            action.LabelText = buttonDef.Label;
                            resultRow.AddDetailAction(action);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Performs the objectives action.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        public async void PerformObjectivesAction(object parameters)
        {
            var paramDict                    = (Dictionary <string, object>)parameters;
            UPMOrganizerAction action        = (UPMOrganizerAction)paramDict[Core.Constants.OrganizerAction];
            ViewReference      viewReference = action.ViewReference;

            if (viewReference == null)
            {
                return;
            }

            if (this.HasChanges())
            {
                this.pendingExecutionViewReference = viewReference;
                await SimpleIoc.Default.GetInstance <IDialogService>().ShowMessage(
                    LocalizedString.TextObjectivesSaveWarning,
                    LocalizedString.TextObjectivesTitle,
                    LocalizedString.TextSave,
                    LocalizedString.TextCancel,
                    c =>
                {
                    if (c)
                    {
                        this.Save(null);
                    }
                    else
                    {
                        this.pendingExecutionViewReference = null;
                    }
                });

                return;
            }

            this.ContinueWithAction(viewReference);
        }
 /// <summary>
 /// Adds the action.
 /// </summary>
 /// <param name="action">The action.</param>
 public void AddAction(UPMOrganizerAction action)
 {
     this.Actions.Add(action);
 }
Esempio n. 16
0
        private void LoadData(UPMObjectivesPage objectivesPage)
        {
            int itemCounter    = 0;
            int sectionCounter = 0;

            foreach (UPObjectivesGroup group in this.objectivesGroupArray)
            {
                UPMObjectivesSection section = this.CreateSectionIdentfier(group.Label, StringIdentifier.IdentifierWithStringId(group.GroupKey));
                foreach (UPObjectivesItem item in group.Items)
                {
                    UPMObjective mobjective = this.CreateObjectiveIdentfier(item, StringIdentifier.IdentifierWithStringId($"ObjectiveItem_{itemCounter}"));
                    if (item.Documents != null)
                    {
                        UPMDocumentsGroup documentGroup = new UPMDocumentsGroup(StringIdentifier.IdentifierWithStringId($"documentgroup{itemCounter}"));
                        foreach (DocumentData document in item.Documents)
                        {
                            UPMDocument documentModel = new UPMDocument(document);
                            documentGroup.AddChild(documentModel);
                        }

                        mobjective.AddGroup(documentGroup);
                    }

                    mobjective.ObjectiveItem = item;
                    Dictionary <string, UPEditFieldContext> itemEditFields = new Dictionary <string, UPEditFieldContext>();
                    for (int additionalFieldIndex = 0; additionalFieldIndex < item.AdditionalFields.Count; additionalFieldIndex++)
                    {
                        UPConfigFieldControlField field           = item.AdditionalFields[additionalFieldIndex];
                        RecordIdentifier          fieldIdentifier = new RecordIdentifier(field.Identification);
                        UPEditFieldContext        fieldContext    = null;
                        FieldAttributes           attributes      = field.Attributes;
                        if (attributes != null && attributes.Hide)
                        {
                            fieldContext = UPEditFieldContext.HiddenFieldFor(field, fieldIdentifier, item.Values[additionalFieldIndex]);
                        }
                        else if (attributes != null && attributes.ReadOnly)
                        {
                            fieldContext = UPEditFieldContext.ReadonlyFieldFor(field, fieldIdentifier, item.Values[additionalFieldIndex]);
                        }
                        else
                        {
                            fieldContext = UPEditFieldContext.FieldContextFor(field, fieldIdentifier, item.Values[additionalFieldIndex], (List <UPEditFieldContext>)null);
                        }

                        if (fieldContext?.Field != null)
                        {
                            string fieldIdentification = this.FieldIdentificationSectionCounterItemCounter(field.Field, sectionCounter, itemCounter);
                            this.editPageContext.EditFields.SetObjectForKey(fieldContext, fieldIdentification);
                            itemEditFields.SetObjectForKey(fieldContext, fieldIdentification);
                            if (fieldContext.EditField != null)
                            {
                                fieldContext.EditField.EditFieldsContext = this.editPageContext;
                                mobjective.AddField(fieldContext.EditField);
                            }
                            else
                            {
                                mobjective.AddField(fieldContext.Field);
                            }
                        }
                    }

                    this.HandleDependentFieldsSectionCounterItemCounter(itemEditFields, sectionCounter, itemCounter);
                    if (item.ButtonActions.Count > 0)
                    {
                        List <UPMOrganizerAction> buttonActions = new List <UPMOrganizerAction>();
                        foreach (UPConfigButton button in item.ButtonActions)
                        {
                            StringIdentifier   fieldIdentifier = StringIdentifier.IdentifierWithStringId("button");
                            UPMOrganizerAction action          = new UPMOrganizerAction(fieldIdentifier);
                            //action.SetTargetAction(this.ParentOrganizerModelController, PerformObjectivesAction);
                            action.ViewReference = button.ViewReference.ViewReferenceWith(item.Record.RecordIdentification);
                            action.LabelText     = button.Label;
                            buttonActions.Add(action);
                        }

                        mobjective.Actions = buttonActions;
                    }

                    section.AddChild(mobjective);
                    itemCounter++;
                }

                if (section.Children.Count > 0)
                {
                    objectivesPage.AddChild(section);
                }
            }

            if (objectivesPage.Children.Count == 0)
            {
                UPMMessageStatus messageStatus = new UPMMessageStatus(StringIdentifier.IdentifierWithStringId("messageIdentifier"));
                UPMStringField   messageField  = new UPMStringField(StringIdentifier.IdentifierWithStringId("statusFieldIdentifier"));
                messageField.FieldValue          = LocalizedString.Localize(LocalizationKeys.TextGroupBasic, LocalizationKeys.KeyBasicNoObjectives);
                messageStatus.DetailMessageField = messageField;
                objectivesPage.Status            = messageStatus;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Method Loads tiles and subviews into Details Organizer Page
        /// </summary>
        private void ContinueBuildDetailsOrganizerPageTilesLoaded()
        {
            var configStore     = ConfigurationUnitStore.DefaultStore;
            var detailOrganizer = (UPMOrganizer)TopLevelElement;
            var recordTiles     = GetUPMTiles();

            detailOrganizer.Tiles       = recordTiles;
            Organizer.OrganizerColor    = ColorForInfoAreaWithId(InfoAreaId);
            Organizer.DisplaysTitleText = true;
            Organizer.ExpandFound       = true;
            RefreshTableCaption();

            if (string.IsNullOrWhiteSpace(VirtualInfoAreaId) || string.IsNullOrWhiteSpace(ExpandConfig.UnitName))
            {
                return;
            }

            var additionalParameters = new Dictionary <string, object>
            {
                { nameof(VirtualInfoAreaId), VirtualInfoAreaId },
                { "CurrentExpandName", ExpandConfig.UnitName }
            };

            var detailPageModelController = new DetailPageModelController(ViewReference.ViewReferenceWith(additionalParameters));

            detailPageModelController.Init();
            var overviewPage = detailPageModelController.Page;

            overviewPage.Parent = detailOrganizer;
            AddPageModelController(detailPageModelController);
            detailOrganizer.AddPage(overviewPage);
            var expandHeader = configStore.HeaderByNameFromGroup(HeaderNameExpand, ExpandConfig.HeaderGroupName);

            if (expandHeader != null)
            {
                UPMOrganizerAddPages(expandHeader, detailOrganizer, overviewPage);
                AddActionButtonsFromHeaderRecordIdentification(expandHeader, RecordIdentification);
                var offline = UPCRMDataStore.DefaultStore.RecordExistsOffline(RecordIdentification);
                if (!offline)
                {
                    OnlineData       = true;
                    SyncRecordAction = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId(ActionSyncRecord));
                    SyncRecordAction.SetTargetAction(this, PerformAction);
                    var parameter = new List <string> {
                        "RecordId", "Value", "uid"
                    };
                    var parameters = new List <object> {
                        parameter
                    };
                    var definition = new List <object> {
                        string.Empty, "Action:syncRecord", parameters
                    };
                    var syncRecordViewReference = new ViewReference(definition, ButtonSyncRecordText);
                    SyncRecordAction.ViewReference = syncRecordViewReference.ViewReferenceWith(RecordIdentification);
                }
                else
                {
                    OnlineData       = false;
                    SyncRecordAction = null;
                }
            }

            Organizer.DisplaysImage = IsOrganizerHeaderImageConfigured();
            Organizer.LineCountAdditionalTitletext = LinecountOrganizerHeaderSubLabelConfigured();
            UpdateActionItemsStatus();
            InformAboutDidChangeTopLevelElement(Organizer, Organizer, null, UPChangeHints.ChangeHintsWithHint(HintAlternateExpandFound));
        }
        /// <summary>
        /// Builds the additional actions for record identification.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <returns></returns>
        public List <object> BuildAdditionalActionsForRecordIdentification(string recordIdentification)
        {
            var configStore  = ConfigurationUnitStore.DefaultStore;
            var buttonsArray = new List <object>();
            var buttonName   = this.FieldControlConfig.ValueForAttribute($"action{this.TabIndex + 1}");
            var buttons      = new List <string>();

            if (!string.IsNullOrEmpty(buttonName))
            {
                buttons.AddRange(buttonName.Split(';'));
            }

            buttonName = this.TabConfig.ValueForAttribute("action");
            if (!string.IsNullOrEmpty(buttonName))
            {
                buttons.AddRange(buttonName.Split(';'));
            }

            foreach (var bName in buttons)
            {
                var buttonDef = configStore.ButtonByName(bName);
                if (buttonDef == null || buttonDef.IsHidden)
                {
                    continue;
                }

                var iconName = string.Empty;
                if (!string.IsNullOrEmpty(buttonDef.ImageName))
                {
                    iconName = configStore.FileNameForResourceName(buttonDef.ImageName);
                }

                UPMOrganizerAction action = null;

                if (buttonDef.ViewReference != null)
                {
                    action = new UPMOrganizerAction(StringIdentifier.IdentifierWithStringId($"action.{bName}"));
                    action.SetTargetAction(this, action.PerformAction);
                    action.ViewReference = buttonDef.ViewReference.ViewReferenceWith(recordIdentification);
                    if (!string.IsNullOrEmpty(iconName))
                    {
                        action.IconName = iconName;
                    }

                    if (action.Identifier.Equals(StringIdentifier.IdentifierWithStringId(Core.Constants.ActionIdToggleFavorite)))
                    {
                        action.IconName       = "Icon:StarEmpty";
                        action.ActiveIconName = "Icon:Star";
                        action.LabelText      = LocalizedString.TextProcessAddToFavorites;
                    }
                    else
                    {
                        action.LabelText = buttonDef.Label;
                    }
                }

                if (action != null)
                {
                    action.Invalid = true;
                    buttonsArray.Add(action);
                }
            }

            return(buttonsArray);
        }