Example #1
0
        /// <summary>
        /// Retries all conflicts.
        /// </summary>
        public void RetryAllConflicts()
        {
            UPOfflineStorage.DefaultStorage.ClearAllErrors();
            UPSyncManager syncManager = ServerSession.CurrentSession.SyncManager;

            syncManager.PerformUpSync();
        }
 /// <summary>
 /// Performs the data refresh.
 /// </summary>
 public void PerformDataRefresh()
 {
     if (this.CheckConnectivity())
     {
         UPSyncManager syncManager = ServerSession.CurrentSession.SyncManager;
         syncManager.PerformIncrementalSync();
     }
 }
 /// <summary>
 /// Performs the metadata refresh.
 /// </summary>
 public void PerformMetadataRefresh()
 {
     if (this.CheckConnectivity())
     {
         UPSyncManager syncManager = ServerSession.CurrentSession.SyncManager;
         syncManager.PerformMetadataSync();
         HistoryManager.ReleaseHistoryManager();
     }
 }
        /// <summary>
        /// Views will appear handler.
        /// </summary>
        public override void ViewWillAppear()
        {
            //this.idleTimeManager.Activate();
            UPSyncManager syncManager = ServerSession.CurrentSession.SyncManager;

            if (syncManager.FullSyncRequirementStatus == FullSyncRequirementStatus.Resumable)
            {
                //UIAlertView alert = new UIAlertView("Full sync resumable", "Resume?", null, "No", "Yes", null);
                //alert.Show();
            }
        }
        /// <summary>
        /// Builds the page.
        /// </summary>
        private void BuildPage()
        {
            IConfigurationUnitStore configStore = ConfigurationUnitStore.DefaultStore;
            UPMDataSyncPage         page        = new UPMDataSyncPage(null);

            if (ServerSession.CurrentSession == null)
            {
                return;
            }

            UPSyncManager syncManager = ServerSession.CurrentSession.SyncManager;

            page.LastSyncDate            = syncManager.LastSyncDate;
            page.CanStartIncrementalSync = true;
            this.syncMessage             = string.Empty;

            if (syncManager.FullSyncRunning)
            {
                this.syncMessage = LocalizedString.Localize(
                    LocalizationKeys.TextGroupBasic,
                    LocalizationKeys.KeyBasicSyncOrganizerFullSyncRunningMessage);

                page.CanStartIncrementalSync = false;
            }
            else if (syncManager.IncrementalSyncRunning)
            {
                this.syncMessage = LocalizedString.Localize(
                    LocalizationKeys.TextGroupBasic,
                    LocalizationKeys.KeyBasicSyncOrganizerIncrementalSyncRunningMessage);

                page.CanStartIncrementalSync = false;
            }
            else if (syncManager.UpSyncRunning)
            {
                this.syncMessage = LocalizedString.Localize(
                    LocalizationKeys.TextGroupBasic,
                    LocalizationKeys.KeyBasicSyncOrganizerUpSyncRunningMessage);

                page.CanStartIncrementalSync = false;
            }
            else if (syncManager.MetadataSyncRunning)
            {
                this.syncMessage = LocalizedString.Localize(
                    LocalizationKeys.TextGroupBasic,
                    LocalizationKeys.KeyBasicSyncOrganizerConfigurationSyncRunningMessage);

                page.CanStartIncrementalSync = false;
            }
            else if (syncManager.ResourcesSyncRunning)
            {
                this.syncMessage             = "Resources Sync is running";
                page.CanStartIncrementalSync = false;
            }

            page.CanPerformConfigurationSync = configStore.ConfigValueIsSetDefaultValue("Sync.ConfigOnOff", true);
            page.CanPerformLanguageChange    = configStore.ConfigValueIsSetDefaultValue("Sync.LanguageOnOff", true);
            page.FullSyncRequirementStatus   = syncManager.FullSyncRequirementStatus;

            switch (page.FullSyncRequirementStatus)
            {
            case FullSyncRequirementStatus.Recommended:
                DateTime blockOnlineAccessDate = DateExtensions.AddTimeSpanToUtcNow(syncManager.TimeIntervalFromNowUntilOfflineOnline());
                page.FullSyncRequirementStatusText = string.Format(
                    LocalizedString.Localize(
                        LocalizationKeys.TextGroupBasic,
                        LocalizationKeys.KeyBasicSyncOrganizerFullSyncRecommendedWarningMessage).ToDotnetStringFormatTemplate(),
                    blockOnlineAccessDate.ToString("d"));
                break;

            case FullSyncRequirementStatus.MandatoryForOnlineAccess:
                DateTime blockAccessDate = DateExtensions.AddTimeSpanToUtcNow(syncManager.TimeIntervalFromNowUntilBlock());
                page.FullSyncRequirementStatusText = string.Format(
                    LocalizedString.Localize(
                        LocalizationKeys.TextGroupBasic,
                        LocalizationKeys.KeyBasicSyncOrganizerFullSyncMandatoryForOnlineErrorMessage).ToDotnetStringFormatTemplate(),
                    blockAccessDate.ToString("d"));
                break;

            default:
                page.FullSyncRequirementStatusText = string.Empty;
                break;
            }

            this.TopLevelElement = page;
            this.BuildSyncMessage();
        }