示例#1
0
        public string SyncNow(TaskSyncProfile syncProfile, SyncMetric syncMetric, SyncCallback syncCallback)
        {
            try
            {
                if (syncProfile.GoogleSettings.GoogleAccount == null ||
                    syncProfile.GoogleSettings.GoogleCalendar == null ||
                    !syncProfile.ValidateOutlookSettings())
                {
                    MessageService.ShowMessageAsync(
                        "Please configure Google and Outlook calendar in settings to continue.");
                    return("Invalid Settings");
                }
                ResetSyncData();

                var isSyncComplete = TaskUpdateService.SyncTask(syncProfile, syncMetric, syncCallback);
                return(isSyncComplete ? null : "Error Occurred");
            }
            catch (AggregateException exception)
            {
                var flattenException = exception.Flatten();
                MessageService.ShowMessageAsync(flattenException.Message);
                Logger.Error(exception);
                return(flattenException.Message);
            }
            catch (Exception exception)
            {
                MessageService.ShowMessageAsync(exception.Message);
                Logger.Error(exception);
                return(exception.Message);
            }
        }
示例#2
0
        private void StartTaskSyncTask(TaskSyncProfile syncProfile)
        {
            lock (LockerObject)
            {
                if (IsSettingsLoading)
                {
                    MessageService.ShowMessageAsync("Unable to do the operation as settings are loading.");
                    return;
                }

                IsSyncInProgress     = true;
                IsSettingsVisible    = false;
                syncProfile.LastSync = DateTime.Now;
                ShowNotification(true);
                UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.SyncStarted, syncProfile.LastSync));
                UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.Line));
                UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.Profile, syncProfile.Name));
                UpdateStatus(StatusHelper.GetMessage(SyncStateEnum.Line));
                var syncMetric = new SyncMetric
                {
                    StartTime             = syncProfile.LastSync.GetValueOrDefault(),
                    ProfileName           = syncProfile.Name,
                    CalendarSyncDirection = syncProfile.SyncDirection.ToString()
                };
                SyncSummary.SyncMetrics.Add(syncMetric);
                var result = SyncStartService.SyncNow(syncProfile, syncMetric, SyncCallback);
                OnSyncCompleted(syncProfile, syncMetric, result);
            }
        }
 public bool GetDestEntriesToDelete(TaskSyncProfile syncProfile, TasksWrapper sourceList,
                                    TasksWrapper destinationList)
 {
     EvaluateTasksToDelete(syncProfile, sourceList, destinationList, DestTasksToDelete,
                           DestTasksToUpdate, SourceTasksToUpdate, DestOrphanEntries);
     return(true);
 }
        /// <summary>
        ///     Delete appointments from source
        /// </summary>
        /// <param name="syncProfile"></param>
        /// <param name="sourceCalendarSpecificData"></param>
        /// <param name="syncCallback"></param>
        /// <returns>
        /// </returns>
        private bool DeleteSourceTasks(TaskSyncProfile syncProfile, SyncMetric syncMetric,
                                       IDictionary <string, object> sourceCalendarSpecificData, SyncCallback syncCallback)
        {
            //if (syncProfile.SyncSettings.DisableDelete)
            //{
            //    return true;
            //}
            //Updating entry isDeleteOperation status
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.ReadingEntriesToDelete,
                                                     SourceTaskService.TaskServiceName);
            //Getting appointments to isDeleteOperation
            TaskSyncEngine.GetSourceEntriesToDelete(syncProfile, SourceTasks, DestinationTasks);
            var appointmentsToDelete = TaskSyncEngine.SourceTasksToDelete;

            //Updating Get entry isDeleteOperation status
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.EntriesToDelete, appointmentsToDelete.Count);
            if (appointmentsToDelete.Count == 0)
            {
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                return(true);
            }

            //Updating isDeleteOperation status
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.DeletingEntries,
                                                     SourceTaskService.TaskServiceName);
            //Deleting entries
            var deletedTasks =
                SourceTaskService.DeleteReminderTasks(appointmentsToDelete, sourceCalendarSpecificData).Result;
            var isSuccess = deletedTasks.IsSuccess;

            //Update status if entries were successfully deleted
            TaskSyncStatus =
                StatusHelper.GetMessage(isSuccess
                    ? SyncStateEnum.DeletingEntriesComplete
                    : SyncStateEnum.DeletingEntriesFailed);
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);

            if (isSuccess)
            {
                syncMetric.SourceMetric.DeleteCount       = appointmentsToDelete.Count;
                syncMetric.SourceMetric.DeleteFailedCount = appointmentsToDelete.Count - deletedTasks.Count;
                for (var index = 0; index < appointmentsToDelete.Count; index++)
                {
                    SourceTasks.Remove(appointmentsToDelete[index]);
                }
            }
            return(isSuccess);
        }
 private void GetDateRange(TaskSyncProfile syncProfile, out DateTime startDate, out DateTime endDate)
 {
     startDate = syncProfile.SyncSettings.StartDate.Date;
     endDate   = syncProfile.SyncSettings.EndDate.Date;
     if (syncProfile.SyncSettings.SyncRangeType == SyncRangeTypeEnum.SyncRangeInDays)
     {
         startDate = DateTime.Today.AddDays((-syncProfile.SyncSettings.DaysInPast));
         endDate   = DateTime.Today.AddDays((syncProfile.SyncSettings.DaysInFuture + 1));
     }
     else if (syncProfile.SyncSettings.SyncRangeType == SyncRangeTypeEnum.SyncEntireCalendar)
     {
         startDate = DateTime.Parse("1990/01/01 12:00:00 AM");
         endDate   = DateTime.Today.AddYears(10);
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="syncProfile"></param>
        /// <param name="syncMetric"></param>
        /// <param name="sourceCalendarSpecificData"></param>
        /// <param name="destinationCalendarSpecificData"></param>
        /// <returns></returns>
        private bool UpdateEntries(TaskSyncProfile syncProfile, SyncMetric syncMetric,
                                   IDictionary <string, object> sourceCalendarSpecificData,
                                   IDictionary <string, object> destinationCalendarSpecificData)
        {
            var isSuccess = true;

            if (TaskSyncEngine.SourceTasksToUpdate.Any())
            {
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                //Update status for reading entries to update
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.EntriesToUpdate,
                                                         TaskSyncEngine.SourceTasksToUpdate.Count,
                                                         SourceTaskService.TaskServiceName);
                var updatedTasks = SourceTaskService.UpdateReminderTasks(TaskSyncEngine.SourceTasksToUpdate,
                                                                         sourceCalendarSpecificData).Result;
                isSuccess      = updatedTasks.IsSuccess;
                TaskSyncStatus =
                    StatusHelper.GetMessage(isSuccess
                        ? SyncStateEnum.UpdateEntriesSuccess
                        : SyncStateEnum.UpdateEntriesFailed);
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                syncMetric.SourceMetric.UpdateCount       = TaskSyncEngine.SourceTasksToUpdate.Count;
                syncMetric.SourceMetric.UpdateFailedCount =
                    TaskSyncEngine.SourceTasksToUpdate.Count - updatedTasks.Count;
            }

            if (TaskSyncEngine.DestTasksToUpdate.Any())
            {
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                //Update status for reading entries to update
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.EntriesToUpdate,
                                                         TaskSyncEngine.DestTasksToUpdate.Count,
                                                         DestinationTaskService.TaskServiceName);
                var updatedTasks = DestinationTaskService.UpdateReminderTasks(TaskSyncEngine.DestTasksToUpdate,
                                                                              destinationCalendarSpecificData).Result;
                isSuccess      = updatedTasks.IsSuccess;
                TaskSyncStatus =
                    StatusHelper.GetMessage(isSuccess
                        ? SyncStateEnum.UpdateEntriesSuccess
                        : SyncStateEnum.UpdateEntriesFailed);
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                syncMetric.DestMetric.UpdateCount       = TaskSyncEngine.DestTasksToUpdate.Count;
                syncMetric.DestMetric.UpdateFailedCount =
                    TaskSyncEngine.DestTasksToUpdate.Count - updatedTasks.Count;
            }

            return(isSuccess);
        }
        /// <summary>
        ///     Add appointments to source
        /// </summary>
        /// <param name="syncProfile"></param>
        /// <param name="syncMetric"></param>
        /// <param name="sourceCalendarSpecificData"></param>
        /// <returns>
        /// </returns>
        private bool AddSourceTasks(TaskSyncProfile syncProfile, SyncMetric syncMetric,
                                    IDictionary <string, object> sourceCalendarSpecificData)
        {
            //Update status for reading entries to add
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.ReadingEntriesToAdd,
                                                     SourceTaskService.TaskServiceName);
            //Get entries to add
            TaskSyncEngine.GetSourceEntriesToAdd(syncProfile, SourceTasks, DestinationTasks);
            var appointmentsToAdd = TaskSyncEngine.SourceTasksToAdd;

            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.EntriesToAdd, appointmentsToAdd.Count);
            if (appointmentsToAdd.Count == 0)
            {
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                return(true);
            }
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.AddingEntries, SourceTaskService.TaskServiceName);

            //Add entries to calendar
            var addedTasks = SourceTaskService.AddReminderTasks(appointmentsToAdd,
                                                                sourceCalendarSpecificData)
                             .Result;
            var isSuccess = addedTasks.IsSuccess;

            //Update status if entries were successfully added
            TaskSyncStatus =
                StatusHelper.GetMessage(isSuccess ? SyncStateEnum.AddEntriesComplete : SyncStateEnum.AddEntriesFailed);
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);

            if (isSuccess)
            {
                syncMetric.SourceMetric.AddCount = appointmentsToAdd.Count;
                //LoadSourceId(addedTasks, DestinationTasks.TaskListId);
                SourceTasks.AddRange(addedTasks);
                if (syncProfile.SyncMode == SyncModeEnum.TwoWay)
                {
                    //var updateDestList = UpdateWithChildId(addedTasks, DestinationTasks);
                    //TaskSyncEngine.DestTasksToUpdate.AddRangeCompareForUpdate(updateDestList);
                }
            }

            return(isSuccess);
        }
        /// <summary>
        /// </summary>
        /// <param name="syncProfile"></param>
        /// <param name="sourceList"></param>
        /// <param name="destinationList"></param>
        /// <param name="destTasksToDelete"></param>
        /// <param name="destTasksToUpdate"></param>
        /// <param name="sourceTasksToUpdate"></param>
        /// <param name="destOrphanEntries"></param>
        /// <returns>
        /// </returns>
        private void EvaluateTasksToDelete(TaskSyncProfile syncProfile,
                                           TasksWrapper sourceList, TasksWrapper destinationList,
                                           List <ReminderTask> destTasksToDelete,
                                           List <ReminderTask> destTasksToUpdate,
                                           List <ReminderTask> sourceTasksToUpdate,
                                           List <ReminderTask> destOrphanEntries)
        {
            if (!destinationList.Any())
            {
                return;
            }

            foreach (var destTask in destinationList)
            {
                var sourceTask = sourceList.FirstOrDefault(t =>
                                                           t.Equals(destTask));
                if (sourceTask == null)
                {
                    destTasksToDelete.Add(destTask);
                }
                else if (destTask.IsCompleted != sourceTask.IsCompleted)
                {
                    if (destTask.Due.HasValue && sourceTask.Due.HasValue &&
                        !destTask.Due.Value.Equals(sourceTask.Due.Value))
                    {
                        if (destTask.Due.Value.Year < 4500 || destTask.Due.Value.Year < 4500)
                        {
                            if (destTask.UpdatedOn.GetValueOrDefault()
                                .CompareTo(sourceTask.UpdatedOn.GetValueOrDefault()) < 0)
                            {
                                destTask.CopyDetail(sourceTask);
                                destTasksToUpdate.Add(destTask);
                            }
                            else
                            {
                                sourceTasksToUpdate.Add(sourceTask);
                            }
                        }
                    }
                }
            }
        }
示例#9
0
        /// <summary>
        ///     Gets appointments to add in the destination calendar
        /// </summary>
        /// <param name="syncProfile"></param>
        /// <param name="sourceList"></param>
        /// <param name="destinationList"></param>
        /// <param name="tasksToAdd"></param>
        /// <returns>
        /// </returns>
        private void EvaluateTasksToAdd(TaskSyncProfile syncProfile, List <ReminderTask> sourceList,
                                        List <ReminderTask> destinationList, List <ReminderTask> tasksToAdd)
        {
            if (!destinationList.Any())
            {
                tasksToAdd.AddRange(sourceList);
                //All entries need to be added
                return;
            }

            foreach (var sourceTask in sourceList)
            {
                var destTask = destinationList.FirstOrDefault(t =>
                                                              t.Equals(sourceTask));
                if (destTask == null)
                {
                    tasksToAdd.Add(sourceTask);
                }
            }
        }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        private async void CreateProfile(object parameter)
        {
            if (parameter == null)
            {
                return;
            }

            if (parameter.ToString().Equals("Calendars"))
            {
                await AddNewProfile(CalendarSyncProfiles, CalendarSyncProfile.GetDefaultSyncProfile());
            }
            else if (parameter.ToString().Equals("Tasks"))
            {
                await AddNewProfile(TaskSyncProfiles, TaskSyncProfile.GetDefaultSyncProfile());
            }
            else if (parameter.ToString().Equals("Contacts"))
            {
                await AddNewProfile(ContactsSyncProfiles, ContactSyncProfile.GetDefaultSyncProfile());
            }
        }
        private IDictionary <string, object> GetCalendarSpecificData(ServiceType serviceType,
                                                                     TaskSyncProfile syncProfile)
        {
            IDictionary <string, object> calendarSpecificData = null;

            switch (serviceType)
            {
            case ServiceType.Google:
                calendarSpecificData = new Dictionary <string, object>
                {
                    { "TaskListId", syncProfile.GoogleSettings.GoogleCalendar.Id },
                    { "AccountName", syncProfile.GoogleSettings.GoogleAccount.Name }
                };
                break;

            case ServiceType.OutlookDesktop:
                calendarSpecificData = new Dictionary <string, object>
                {
                    {
                        "ProfileName",
                        !syncProfile.OutlookSettings.OutlookOptions.HasFlag(OutlookOptionsEnum.DefaultProfile)
                                ? syncProfile.OutlookSettings.OutlookProfileName
                                : null
                    },
                    {
                        "OutlookTaskList",
                        !syncProfile.OutlookSettings.OutlookOptions.HasFlag(
                            OutlookOptionsEnum.DefaultMailBoxCalendar)
                                ? syncProfile.OutlookSettings.OutlookFolder
                                : null
                    }
                };
                break;

            case ServiceType.EWS:
                return(null);
            }

            return(calendarSpecificData);
        }
示例#12
0
 public bool GetDestEntriesToAdd(TaskSyncProfile syncProfile, TasksWrapper sourceList, TasksWrapper destinationList)
 {
     EvaluateTasksToAdd(syncProfile, sourceList, destinationList, DestTasksToAdd);
     return(true);
 }
        public bool SyncTask(TaskSyncProfile syncProfile, SyncMetric syncMetric, SyncCallback syncCallback)
        {
            InitiatePreSyncSetup(syncProfile);

            var isSuccess = false;

            if (syncProfile != null)
            {
                TaskSyncEngine.Clear();
                //Add log for sync mode
                TaskSyncStatus = string.Format("Calendar Sync : {0} {2} {1}", SourceTaskService.TaskServiceName,
                                               DestinationTaskService.TaskServiceName,
                                               syncProfile.SyncMode == SyncModeEnum.TwoWay ? "<===>" : "===>");
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                DateTime startDate, endDate;
                GetDateRange(syncProfile, out startDate, out endDate);
                //Add log for date range
                TaskSyncStatus = $"Date Range : {startDate.ToString("d")} - {endDate.ToString("d")}";

                //Load calendar specific data
                var sourceCalendarSpecificData =
                    GetCalendarSpecificData(syncProfile.Source, syncProfile);
                var destinationCalendarSpecificData =
                    GetCalendarSpecificData(syncProfile.Destination, syncProfile);

                //Get source and destination Tasks
                isSuccess = LoadTasks(sourceCalendarSpecificData,
                                      destinationCalendarSpecificData);

                if (isSuccess)
                {
                    syncMetric.SourceMetric.OriginalCount = SourceTasks.Count;
                    syncMetric.DestMetric.OriginalCount   = DestinationTasks.Count;
                    //LoadSourceId(DestinationTasks, SourceTasks.TaskListId);
                    //LoadSourceId(SourceTasks, DestinationTasks.TaskListId);
                }

                if (isSuccess)
                {
                    //Delete destination Tasks
                    isSuccess = DeleteDestinationTasks(syncProfile, syncMetric, destinationCalendarSpecificData, syncCallback);
                }

                if (isSuccess)
                {
                    //Add Tasks to destination
                    isSuccess = AddDestinationTasks(syncProfile, syncMetric, destinationCalendarSpecificData);
                }

                if (isSuccess && syncProfile.SyncMode == SyncModeEnum.TwoWay)
                {
                    //Delete destination appointments
                    isSuccess = DeleteSourceTasks(syncProfile, syncMetric, sourceCalendarSpecificData, syncCallback);
                    if (isSuccess)
                    {
                        //If sync mode is two way... add events to source
                        isSuccess = AddSourceTasks(syncProfile, syncMetric, sourceCalendarSpecificData);
                    }
                }

                if (isSuccess)
                {
                    isSuccess = UpdateEntries(syncProfile, syncMetric, sourceCalendarSpecificData, destinationCalendarSpecificData);
                }
            }
            syncMetric.IsSuccess   = isSuccess;
            SourceTasks            = null;
            DestinationTasks       = null;
            SourceTaskService      = null;
            DestinationTaskService = null;
            return(isSuccess);
        }
示例#14
0
        private void ValidateSettings(Settings result)
        {
            if (result.GoogleAccounts == null)
            {
                result.GoogleAccounts = new ObservableCollection <GoogleAccount>();
            }

            if (result.CalendarSyncProfiles == null || result.CalendarSyncProfiles.Count == 0)
            {
                result.CalendarSyncProfiles = new ObservableCollection <CalendarSyncProfile>()
                {
                    CalendarSyncProfile.GetDefaultSyncProfile()
                };
            }
            else
            {
                foreach (var syncProfile in result.CalendarSyncProfiles)
                {
                    syncProfile.SetSourceDestTypes();
                    if (syncProfile.SyncSettings == null)
                    {
                        syncProfile.SyncSettings = CalendarSyncSettings.GetDefault();
                    }
                    else if (syncProfile.SyncSettings.SyncRangeType == SyncRangeTypeEnum.SyncEntireCalendar)
                    {
                        syncProfile.SyncSettings.SyncRangeType = SyncRangeTypeEnum.SyncRangeInDays;
                        syncProfile.SyncSettings.DaysInPast    = 120;
                        syncProfile.SyncSettings.DaysInFuture  = 120;
                    }

                    if (syncProfile.SyncFrequency == null)
                    {
                        syncProfile.SyncFrequency = new IntervalSyncFrequency();
                    }
                }
            }

            if (result.TaskSyncProfiles == null || result.TaskSyncProfiles.Count == 0)
            {
                result.TaskSyncProfiles = new ObservableCollection <TaskSyncProfile>()
                {
                    TaskSyncProfile.GetDefaultSyncProfile()
                };
            }
            else
            {
                foreach (var syncProfile in result.TaskSyncProfiles)
                {
                    syncProfile.SetSourceDestTypes();
                    if (syncProfile.SyncSettings == null)
                    {
                        syncProfile.SyncSettings = TaskSyncSettings.GetDefault();
                    }

                    if (syncProfile.SyncFrequency == null)
                    {
                        syncProfile.SyncFrequency = new IntervalSyncFrequency();
                    }
                }
            }
            if (result.ContactSyncProfiles == null || result.ContactSyncProfiles.Count == 0)
            {
                result.ContactSyncProfiles = new ObservableCollection <ContactSyncProfile>()
                {
                    ContactSyncProfile.GetDefaultSyncProfile()
                };
            }

            if (result.AppSettings == null)
            {
                result.AppSettings = AppSettings.GetDefault();
            }
            else if (result.AppSettings.ProxySettings == null)
            {
                result.AppSettings.ProxySettings = new ProxySetting
                {
                    ProxyType = ProxyType.Auto
                };
            }
        }
示例#15
0
 private async Task StartTaskSyncProfile(TaskSyncProfile profile)
 {
     await Task.Run(() => StartTaskSyncTask(profile));
 }
        /// <summary>
        ///     Delete appointments in destination
        /// </summary>
        /// <param name="syncProfile"></param>
        /// <param name="syncMetric"></param>
        /// <param name="destinationCalendarSpecificData"></param>
        /// <param name="syncCallback"></param>
        /// <returns>
        /// </returns>
        private bool DeleteDestinationTasks(TaskSyncProfile syncProfile, SyncMetric syncMetric,
                                            IDictionary <string, object> destinationCalendarSpecificData, SyncCallback syncCallback)
        {
            //if (syncProfile.SyncSettings.DisableDelete)
            //{
            //    return true;
            //}
            //Updating entry isDeleteOperation status
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.ReadingEntriesToDelete,
                                                     DestinationTaskService.TaskServiceName);
            //Getting appointments to isDeleteOperation
            TaskSyncEngine.GetDestEntriesToDelete(syncProfile,
                                                  SourceTasks, DestinationTasks);
            var appointmentsToDelete = TaskSyncEngine.DestTasksToDelete;

            if (syncProfile.SyncMode == SyncModeEnum.OneWay)
            {
                //if (syncProfile.SyncSettings.ConfirmOnDelete && syncCallback != null)
                //{
                //    var orphanEntries = Environment.NewLine +
                //                        string.Join(Environment.NewLine, TaskSyncEngine.DestOrphanEntries);
                //    //Log Orphan Entries
                //    Logger.Warn("Orphan entries to delete: " + orphanEntries);

                //    var message = string.Format("Are you sure you want to delete {0} orphan entries from {1}?{2}",
                //        appointmentsToDelete.Count, DestinationTaskService.TaskServiceName,
                //        orphanEntries);
                //    var e = new SyncEventArgs(message, UserActionEnum.ConfirmDelete);

                //    var task = syncCallback(e);
                //    if (task.Result)
                //    {
                //        appointmentsToDelete.AddRange(TaskSyncEngine.DestOrphanEntries);
                //    }
                //}
                //else if (!syncProfile.SyncSettings.DisableDelete)
                //{
                //    appointmentsToDelete.AddRange(TaskSyncEngine.DestOrphanEntries);
                //}
            }

            //Updating Get entry isDeleteOperation status
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.EntriesToDelete, appointmentsToDelete.Count);

            if (appointmentsToDelete.Count == 0)
            {
                TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
                return(true);
            }

            //Updating isDeleteOperation status
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.DeletingEntries,
                                                     DestinationTaskService.TaskServiceName);

            //Deleting entries

            var deletedTasks = DestinationTaskService.DeleteReminderTasks(appointmentsToDelete, destinationCalendarSpecificData)
                               .Result;
            var isSuccess = deletedTasks.IsSuccess;

            //Update status if entries were successfully deleted
            TaskSyncStatus =
                StatusHelper.GetMessage(isSuccess
                    ? SyncStateEnum.DeletingEntriesComplete
                    : SyncStateEnum.DeletingEntriesFailed);
            TaskSyncStatus = StatusHelper.GetMessage(SyncStateEnum.Line);
            if (isSuccess)
            {
                syncMetric.DestMetric.DeleteCount       = appointmentsToDelete.Count;
                syncMetric.DestMetric.DeleteFailedCount = appointmentsToDelete.Count - deletedTasks.Count;
                for (var index = 0; index < appointmentsToDelete.Count; index++)
                {
                    DestinationTasks.Remove(appointmentsToDelete[index]);
                }
            }

            return(isSuccess);
        }
 void InitiatePreSyncSetup(TaskSyncProfile syncProfile)
 {
     SourceTaskService      = TaskServiceFactory.GetTaskService(syncProfile.Source);
     DestinationTaskService = TaskServiceFactory.GetTaskService(syncProfile.Destination);
 }