Example #1
0
        /// <summary>
        /// Discards the changes for conflict.
        /// </summary>
        /// <param name="syncConflict">The synchronize conflict.</param>
        public async void DiscardChangesForConflictAsync(UPMSyncConflict syncConflict)
        {
            this.discardedSyncConflict = syncConflict;

            await SimpleIoc.Default.GetInstance <IDialogService>()
            .ShowMessage(
                LocalizedString.Localize(LocalizationKeys.TextGroupBasic, LocalizationKeys.KeyBasicSyncConflictsDiscardChangesMessage),
                LocalizedString.Localize(LocalizationKeys.TextGroupBasic, LocalizationKeys.KeyBasicSyncConflictsDiscardChangesTitle),
                LocalizedString.TextYes,
                LocalizedString.TextCancel,
                c =>
            {
                if (c)
                {
                    this.DoDiscard();
                    Messenger.Default.Send(
                        new NotificationMessage(NavigateToOrganizerMessage.NavigateBack),
                        NavigateToOrganizerMessage.NavigateBack);
                }
                else
                {
                    this.discardedSyncConflict = null;
                }
            });
        }
Example #2
0
        /// <summary>
        /// Switches to detail.
        /// </summary>
        /// <param name="_syncConflict">The synchronize conflict.</param>
        public void SwitchToDetail(UPMSyncConflict _syncConflict)
        {
            var organizerModelController = new UPSyncConflictsDetailOrganizerModelController(_syncConflict);

            for (int index = 0; index < this.SyncConflictsPage.Children.Count; index++)
            {
                UPMSyncConflict syncConflict = this.SyncConflictsPage.SyncConflictAtIndex(index);
                if (syncConflict.Identifier.MatchesIdentifier(_syncConflict.Identifier))
                {
                    this.swipeRecordControllerStartPosition = index;
                    break;
                }
            }

            bool moreThanOneConflict = this.HasMoreThanOneConflict();

            if (moreThanOneConflict)
            {
                UPSearchResultCachingSwipeRecordController cachingRecordController = new UPSearchResultCachingSwipeRecordController(this);
                cachingRecordController.BuildCache();
                organizerModelController.ParentSwipePageRecordController = cachingRecordController;
            }

            this.ModelControllerDelegate.TransitionToContentModelController(organizerModelController);
        }
Example #3
0
        /// <summary>
        /// Removes the conflict.
        /// </summary>
        /// <param name="syncConflict">The synchronize conflict.</param>
        public void RemoveConflict(UPMSyncConflict syncConflict)
        {
            var conflict = this.Children.FirstOrDefault(x => x.Identifier.MatchesIdentifier(syncConflict.Identifier));

            if (conflict != null)
            {
                this.Children.Remove(conflict);
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="UPSyncConflictsDetailOrganizerModelController"/> class.
        /// </summary>
        /// <param name="syncConflict">The synchronize conflict.</param>
        public UPSyncConflictsDetailOrganizerModelController(UPMSyncConflict syncConflict)
            : base(null, new UPOrganizerInitOptions(true, true))
        {
            this.SyncConflict = syncConflict;
            this.BuildPagesFromViewReference();

            foreach (UPPageModelController pageModelController in this.PageModelControllers)
            {
                SyncConflictsPageModelController ctrl = pageModelController as SyncConflictsPageModelController;
                ctrl?.Page.AddChild(this.SyncConflict);
            }
        }
Example #5
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);
            }
        }
Example #6
0
        /// <summary>
        /// The detail organizer for record identification.
        /// </summary>
        /// <param name="recordIdentification">
        /// The record identification.
        /// </param>
        /// <param name="onlineData">
        /// The online data.
        /// </param>
        /// <returns>
        /// The <see cref="UPOrganizerModelController"/>.
        /// </returns>
        public UPOrganizerModelController DetailOrganizerForRecordIdentification(string recordIdentification, bool onlineData)
        {
            UPSyncConflictsDetailOrganizerModelController organizerModelController = null;

            for (int i = 0; i < this.SyncConflictsPage.Children.Count; i++)
            {
                UPMSyncConflict syncConflict = this.SyncConflictsPage.SyncConflictAtIndex(i);
                if (syncConflict.Identifier.ToString() == recordIdentification)
                {
                    organizerModelController = new UPSyncConflictsDetailOrganizerModelController(syncConflict)
                    {
                        NavControllerId = this.ParentOrganizerModelController.NavControllerId
                    };
                    break;
                }
            }

            return(organizerModelController);
        }
Example #7
0
        /// <summary>
        /// Loads the index of the table captions from index to index.
        /// </summary>
        /// <param name="fromIndex">From index.</param>
        /// <param name="toIndex">To index.</param>
        /// <returns></returns>
        public List <UPSwipePageRecordItem> LoadTableCaptionsFromIndexToIndex(int fromIndex, int toIndex)
        {
            List <UPSwipePageRecordItem> result = new List <UPSwipePageRecordItem>();

            fromIndex += this.swipeRecordControllerStartPosition;
            toIndex   += this.swipeRecordControllerStartPosition;
            for (int index = fromIndex; index < toIndex; index++)
            {
                UPMSyncConflict syncConflict = this.SyncConflictsPage.SyncConflictAtIndex(index);
                if (syncConflict != null)
                {
                    UPSwipePageRecordItem item = new UPSwipePageRecordItem((string)syncConflict.MainField.FieldValue,
                                                                           (string)syncConflict.DetailField.FieldValue, syncConflict.Identifier.ToString(), false);
                    result.Add(item);
                }
            }

            return(result);
        }
Example #8
0
        /// <summary>
        /// Reports the error for conflict.
        /// </summary>
        /// <param name="syncConflict">The synchronize conflict.</param>
        public void ReportErrorForConflict(UPMSyncConflict syncConflict)
        {
            UPMSyncConflictWithContext syncConflictWithContext = (UPMSyncConflictWithContext)syncConflict;

            this.SendReportForOfflineRequest(syncConflictWithContext.OfflineRequest);
        }
Example #9
0
 /// <summary>
 /// Adds the synchronize conflict.
 /// </summary>
 /// <param name="syncConflict">The synchronize conflict.</param>
 public void AddSyncConflict(UPMSyncConflict syncConflict)
 {
     this.AddChild(syncConflict);
 }