private void FillPageWithResult(UPCRMResult result) { this.vistedNodes = new Dictionary <IIdentifier, UPMCoINode>(); this.nodeIdConfigDict = new Dictionary <IIdentifier, UPConfigTreeViewTable>(); // Root Node Query if (result.RowCount == 1) { UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(0); UPMCoINode rootNode = CoITreeNodeLoader.CreateNodeFromResultRow(row, 0, this.expandChecker, null, null); this.vistedNodes[rootNode.Identifier] = rootNode; this.nodeIdConfigDict[rootNode.Identifier] = this.rootTreeNode.RootNode; // Only root configured if (this.rootTreeNode.RootNode.ChildNodes.Count == 0) { UPMCircleOfInfluencePage newPage = this.CreatePageInstance(); newPage.RootNode = rootNode; newPage.Invalid = false; newPage.ConfigProvider = ((UPMCircleOfInfluencePage)this.Page).ConfigProvider; UPMCircleOfInfluencePage oldPage = (UPMCircleOfInfluencePage)this.Page; this.TopLevelElement = newPage; this.InformAboutDidChangeTopLevelElement(oldPage, newPage, null, null); } foreach (UPConfigTreeViewTable childTree in this.rootTreeNode.RootNode.ChildNodes) { CoITreeNodeLoader nodeLoader = new CoITreeNodeLoader(rootNode, childTree, this.ViewReference, 0, this.vistedNodes, this.nodeIdConfigDict, this.recordIdentifierInfoAreaConfigMapping); nodeLoader.TheDelegate = this; nodeLoader.Mode = CoINodeLoaderMode.InitialLoad; this.pendingNodeLoader.Add(nodeLoader); this.pendingNodeLoaderCount++; } // TODO: This is buggy and will be implemented in CRM-5621 /* * foreach (CoITreeNodeLoader _loader in this.pendingNodeLoader) * { * _loader.LoadNodeSubNodes(); * } */ } else { // Request Mode Offline and jump To Online Node if (result.RowCount == 0 && this.RequestOption == UPRequestOption.Offline) { // Offline Configured and Online Record UPMCircleOfInfluencePage newPage = this.CreatePageInstance(); newPage.Status = UPMMessageStatus.MessageStatusWithMessageDetails(string.Empty, LocalizedString.TextOfflineNotAvailable); UPMCircleOfInfluencePage oldPage = (UPMCircleOfInfluencePage)this.Page; this.TopLevelElement = newPage; this.InformAboutDidChangeTopLevelElement(oldPage, newPage, null, null); } } }
private void FillPageWithResult(UPCRMResult result) { this.vistedNodes = new Dictionary <IIdentifier, UPMCoINode>(); if (result.RowCount == 1) { UPCRMResultRow row = (UPCRMResultRow)result.ResultRowAtIndex(0); UPMCoINode rootNode = CoINodeLoader.CreateRootNodeFromResultRow(row, this.RootRecordIdentification, 0, this.expandChecker); this.vistedNodes[rootNode.Identifier] = rootNode; if (this.MaxDepth > 0) { this.currentNodeLoader = new CoINodeLoader(rootNode, this.ViewReference, 0, this.MaxDepth, this.vistedNodes); this.currentNodeLoader.TheDelegate = this; this.currentNodeLoader.Mode = CoINodeLoaderMode.InitialLoad; this.currentNodeLoader.LoadNodeSubNodes(); } else { // Finished loading UPMCircleOfInfluencePage newPage = this.CreatePageInstance(); newPage.RootNode = rootNode; newPage.Invalid = false; newPage.ConfigProvider = ((UPMCircleOfInfluencePage)this.Page).ConfigProvider; UPMCircleOfInfluencePage oldPage = (UPMCircleOfInfluencePage)this.Page; this.TopLevelElement = newPage; if (!oldPage.Invalid && oldPage.RootNode.Invalid) { // return from edir newPage.RefreshedNode = newPage.RootNode; this.InformAboutDidChangeTopLevelElement(oldPage, newPage, new List <IIdentifier> { oldPage.RootNode.Identifier }, null); } else { this.InformAboutDidChangeTopLevelElement(oldPage, newPage, null, null); } } } else { // Request Mode Offline and jump To Online Node if (result.RowCount == 0 && this.RequestOption == UPRequestOption.Offline) { // Offline Configured and Online Record UPMCircleOfInfluencePage newPage = this.CreatePageInstance(); newPage.Status = UPMMessageStatus.MessageStatusWithMessageDetails(string.Empty, LocalizedString.TextOfflineNotAvailable); UPMCircleOfInfluencePage oldPage = (UPMCircleOfInfluencePage)this.Page; this.TopLevelElement = newPage; this.InformAboutDidChangeTopLevelElement(oldPage, newPage, null, null); } } }
/// <summary> /// Adds the status. /// </summary> /// <param name="status">The status.</param> public void AddStatus(UPMMessageStatus status) { this.AddChild(status); }
/// <inheritdoc/> public void LocationError(string error) { this.locationManager.StopUpdatingLocation(); this.SearchPage.Status = UPMMessageStatus.MessageStatusWithMessageDetails(error, LocalizedString.TextDistanceFilterNoLocation); this.InformAboutDidFailTopLevelElement(this.SearchPage); }
/// <summary> /// Handles the page message details. /// </summary> /// <param name="message">The message.</param> /// <param name="details">The details.</param> /// <returns></returns> public virtual bool HandlePageMessageDetails(string message, string details) { var messageStatus = UPMMessageStatus.MessageStatusWithMessageDetails(message, details); return(this.ShowStatus(messageStatus)); }
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; } }