Ejemplo n.º 1
0
        /// <summary>
        /// Performs the global action.
        /// </summary>
        /// <param name="_action">The action.</param>
        public void PerformGlobalAction(object _action)
        {
            var           action = (UPMAction)_action;
            ViewReference detailViewReference = this.viewReferenceDict[action.Identifier];
            UPOrganizerModelController organizerModelController = OrganizerFromViewReference(detailViewReference);

            this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController, MultiOrganizerMode.AlwaysNewWorkingOrganizer);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Switches to record.
        /// </summary>
        /// <param name="recorddentification">The recorddentification.</param>
        /// <param name="menuByName">Name of the menu by.</param>
        /// <param name="shouldShowTabsForSingleTap">if set to <c>true</c> [should show tabs for single tap].</param>
        /// <param name="flip">if set to <c>true</c> [flip].</param>
        /// <param name="switchToIndex">Index of the switch to.</param>
        protected void SwitchToRecord(string recorddentification, string menuByName, bool shouldShowTabsForSingleTap, bool flip, UPOrganizerViewSwitchToIndex switchToIndex)
        {
            UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromViewReference(ConfigurationUnitStore.DefaultStore.MenuByName(menuByName).ViewReference.ViewReferenceWith(recorddentification));

            organizerModelController.ShouldShowTabsForSingleTab = shouldShowTabsForSingleTap;
            if (switchToIndex != null)
            {
                organizerModelController.SwitchToTabAtIndexAfterTabsLoaded = switchToIndex;
            }

            this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
        }
        private void PerformShowRecordAction(object dict)
        {
            var dictionary = dict as Dictionary <string, object>;
            var action     = dictionary?.ValueOrDefault("UPMOrganizerAction") as UPMOrganizerAnalysisShowRecordAction;

            this.ParentOrganizerModelController.SetFocusViewVisible(false);
            var organizerModelController = UPOrganizerModelController.OrganizerFromDefaultActionOfRecordIdentification(action.RecordIdentification);

            if (organizerModelController != null)
            {
                this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Edits the conflict for conflict.
        /// </summary>
        /// <param name="syncConflict">The synchronize conflict.</param>
        public void EditConflictForConflict(UPMSyncConflict syncConflict)
        {
            UPMSyncConflictWithContext syncConflictWithContext = (UPMSyncConflictWithContext)syncConflict;

            syncConflictWithContext.OfflineRequest.ConflictHandlingMode = true;
            UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromOfflineRequest(syncConflictWithContext.OfflineRequest);

            if (organizerModelController != null)
            {
                this.SyncConflictsPage.Invalid = true;
                this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController, MultiOrganizerMode.StayInCurrentOrganizer);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Switches to detail.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        public override void SwitchToDetail(IIdentifier identifier)
        {
            bool switchToCoi = this.ViewReference.ContextValueForKey("SwitchToCoi") == "true";

            if (identifier is RecordIdentifier)
            {
                string recordIdentification          = ((RecordIdentifier)identifier).RecordIdentification;
                CoITreeInfoAreaConfig infoAreaConfig = this.recordIdentifierInfoAreaConfigMapping[recordIdentification];
                string editAction = infoAreaConfig.Definition.ValueOrDefault("NodeDetailAction") as string;
                editAction = !string.IsNullOrEmpty(editAction) ? editAction : "SHOWRECORD";
                this.SwitchToRecord(recordIdentification, editAction, true, false, switchToCoi ? new SwitchToFirstCoiIndex() : null);
            }
            else
            {
                // Switch to SearchAndList
                string searchAndListName = this.nodeIdConfigDict[identifier].SearchAndListName;
                if (!string.IsNullOrEmpty(searchAndListName))
                {
                    IConfigurationUnitStore configStore   = ConfigurationUnitStore.DefaultStore;
                    SearchAndList           searchAndList = configStore.SearchAndListByName(searchAndListName);
                    if (searchAndList != null)
                    {
                        Dictionary <string, object> dictionary = new Dictionary <string, object>();
                        dictionary["ConfigName"] = searchAndListName;
                        dictionary["InfoArea"]   = searchAndList.InfoAreaId;
                        UPMCoINode            node = this.vistedNodes[identifier];
                        UPConfigTreeViewTable parentConfigTable = this.nodeIdConfigDict[node.Parent.Identifier];
                        if (!string.IsNullOrEmpty(node.Parent.RecordIdentification))
                        {
                            dictionary["LinkRecord"] = node.Parent.RecordIdentification;
                        }

                        if (parentConfigTable.LinkId > 0)
                        {
                            dictionary["LinkId"] = $"{parentConfigTable.LinkId}";
                        }

                        dictionary[Search.Constants.SwipeDetailRecordsConfigName] = "true";
                        string initialRquestOptionString = UPCRMDataStore.StringFromRequestOption(this.RequestOption);
                        if (!string.IsNullOrEmpty(initialRquestOptionString))
                        {
                            dictionary["InitialRequestOption"] = initialRquestOptionString;
                        }

                        UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromViewReference(new ViewReference(dictionary, "RecordListView"));
                        this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RecordSwitchActionHandler"/> class.
        /// </summary>
        /// <param name="modelController">The model controller.</param>
        /// <param name="viewReference">The view reference.</param>
        public RecordSwitchActionHandler(UPOrganizerModelController modelController, ViewReference viewReference)
            : base(modelController, viewReference)
        {
            this.RecordIdentification = viewReference.ContextValueForKey("RecordId");
            string link = viewReference.ContextValueForKey("Link");
            string decisionFilterName = viewReference.ContextValueForKey("DecisionFilterName");

            if (decisionFilterName != null)
            {
                this.DecisionFilter = ConfigurationUnitStore.DefaultStore.FilterByName(decisionFilterName);
                if (this.DecisionFilter != null)
                {
                    this.DecisionFilter = this.DecisionFilter.FilterByApplyingDefaultReplacements();
                }

                if (this.DecisionFilter != null)
                {
                    this.DecisionHandler = new UPCRMFilterBasedDecision(this.DecisionFilter);
                }
            }

            string infoAreaId = null;
            int    linkId     = -1;

            if (!string.IsNullOrEmpty(link))
            {
                var linkParts = link.Split('#');
                infoAreaId = linkParts[0];
                if (linkParts.Length > 1)
                {
                    linkId = Convert.ToInt32(linkParts[1]);
                }
            }

            if (this.DecisionHandler != null && !string.IsNullOrEmpty(this.RecordIdentification))
            {
                this.CrmQuery = new UPContainerMetaInfo(new List <UPCRMField>(), this.DecisionFilter.InfoAreaId);
                this.CrmQuery.SetLinkRecordIdentification(this.RecordIdentification, linkId);
                this.CrmQuery.AddCrmFields(this.DecisionHandler.FieldDictionary.Values.ToList());
            }
            else if (!string.IsNullOrEmpty(infoAreaId) && !string.IsNullOrEmpty(this.RecordIdentification))
            {
                this.CrmQuery = new UPContainerMetaInfo(new List <UPCRMField>(), infoAreaId);
                this.CrmQuery.SetLinkRecordIdentification(this.RecordIdentification, linkId);
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Performs the detail action.
        /// </summary>
        /// <param name="_action">The action.</param>
        public void PerformDetailAction(object _action)
        {
            var           action = (UPMAction)_action;
            ViewReference detailViewReference = this.viewReferenceDict[action.Identifier];
            UPOrganizerModelController organizerModelController = OrganizerFromViewReference(detailViewReference);
            IModelControllerUIDelegate organizerDelegate        = UPMultipleOrganizerManager.CurrentOrganizerManager.ModelControllerOfCurrentOrganizer.ModelControllerDelegate;

            organizerDelegate?.TransitionToContentModelController(organizerModelController, MultiOrganizerMode.AlwaysNewWorkingOrganizer);

            string name = detailViewReference.Name;

            if (name.StartsWith("Menu:"))
            {
                // UPGoogleAnalytics.TrackMenuSource(name, "Search");
            }
        }
        /// <summary>
        /// Performs the organizer action.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="viewReference">The view reference.</param>
        /// <param name="onlineData">if set to <c>true</c> [online data].</param>
        public virtual void PerformOrganizerAction(object sender, ViewReference viewReference, bool onlineData)
        {
            var logProvider = SimpleIoc.Default.GetInstance <ILogger>();

            logProvider.LogInfo($"Perform PerformOrganizerAction -  {viewReference.ViewName}");
            var selectorName = string.Empty;

            if (viewReference.ViewName == "OrganizerAction")
            {
                selectorName = viewReference.ContextValueForKey(nameof(Action));
            }
            else if (viewReference.ViewName.StartsWith("Action:"))
            {
                selectorName = viewReference.ViewName.Substring(7);
            }

            if (!string.IsNullOrEmpty(selectorName))
            {
                if (selectorName == "switchOnRecord")
                {
                    this.ParentOrganizerModelController.SwitchOnRecord(viewReference);
                }
                else
                {
                    selectorName = selectorName.Replace(":", string.Empty);
                    selectorName = selectorName[0].ToString().ToUpper() + selectorName.Substring(1, selectorName.Length - 1);

                    this.ParentOrganizerModelController.FindAndInvokeMethod(selectorName, new object[] { viewReference });
                }

                return;
            }

            UPOrganizerModelController organizerModelController = UPOrganizerModelController.OrganizerFromViewReference(viewReference);

            if (organizerModelController == null)
            {
                logProvider.LogWarn($"{viewReference.ViewName} - Not Supported");
            }
            else
            {
                organizerModelController.OnlineData = onlineData;
                this.ModelControllerDelegate?.TransitionToContentModelController(organizerModelController);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Details the organizer for result row.
        /// </summary>
        /// <param name="resultRow">The result row.</param>
        /// <returns></returns>
        public override UPOrganizerModelController DetailOrganizerForResultRow(UPMResultRow resultRow)
        {
            RecordIdentifier           identifier          = (RecordIdentifier)resultRow.Identifier;
            ViewReference              viewReference       = HistoryManager.DefaultHistoryManager.ViewReferenceForRecordIdentifier(identifier.RecordIdentification);
            UPOrganizerModelController organizerController = UPOrganizerModelController.OrganizerFromViewReference(viewReference);

            if (resultRow.OnlineData)
            {
                organizerController.OnlineData = resultRow.OnlineData;
            }

            resultRow.DataValid = true;
            resultRow.Invalid   = true;
            UPChangeManager.CurrentChangeManager.RegisterChanges(new List <IIdentifier> {
                resultRow.Identifier
            });
            return(organizerController);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Reports the error continue operation.
        /// </summary>
        /// <param name="error">The error.</param>
        /// <param name="continueOperation">if set to <c>true</c> [continue operation].</param>
        public virtual void ReportError(Exception error, bool continueOperation)
        {
            if (continueOperation)
            {
                return;
            }
#if PORTING
            string response = error.UserInfo.ObjectForKey(kUPErrorUserInfoResponse);
            if (!string.IsNullOrEmpty(response))
            {
                var organizerModelController = new UPOrganizerModelController(response);
                if (NSThread.CurrentThread().IsMainThread())
                {
                    this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
                }
                else
                {
                    this.ModelControllerDelegate.PerformSelectorOnMainThreadWithObjectWaitUntilDone(@selector(transitionToContentModelController:), organizerModelController, false);
                }
            }
#endif
        }
 /// <summary>
 /// The exchange content view controller.
 /// </summary>
 /// <param name="modelController">The model controller.</param>
 public void ExchangeContentViewController(UPOrganizerModelController modelController)
 {
     this.Delegate.ExchangeContentViewController(modelController);
 }
 /// <summary>
 /// The transition to content model controller.
 /// </summary>
 /// <param name="modelController">The model controller.</param>
 public void TransitionToContentModelController(UPOrganizerModelController modelController)
 {
     this.Delegate.TransitionToContentModelController(modelController);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="OrganizerActionHandler"/> class.
 /// </summary>
 /// <param name="modelController">The model controller.</param>
 /// <param name="viewReference">The view reference.</param>
 public OrganizerActionHandler(UPOrganizerModelController modelController, ViewReference viewReference)
 {
     this.ModelController = modelController;
     this.ViewReference   = viewReference;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ModifyRecordActionHandler"/> class.
 /// </summary>
 /// <param name="modelController">The model controller.</param>
 /// <param name="viewReference">The view reference.</param>
 public ModifyRecordActionHandler(UPOrganizerModelController modelController, ViewReference viewReference)
     : base(modelController, viewReference)
 {
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewInBackgroundActionHandler"/> class.
 /// </summary>
 /// <param name="modelController">The model controller.</param>
 /// <param name="viewReference">The view reference.</param>
 public NewInBackgroundActionHandler(UPOrganizerModelController modelController, ViewReference viewReference)
     : base(modelController, viewReference)
 {
 }