Exemplo n.º 1
0
        private void OnItemSavedOrDeleted(object item, bool wasDeleted)
        {
            IIdWithHints <string, DateTime> entryId = null;

            var appointment = item as AppointmentItem;

            if (appointment != null)
            {
                entryId = IdWithHints.Create(appointment.EntryID, (DateTime?)appointment.LastModificationTime, wasDeleted);
            }
            else
            {
                var task = item as TaskItem;
                if (task != null)
                {
                    entryId = IdWithHints.Create(task.EntryID, (DateTime?)task.LastModificationTime, wasDeleted);
                }
                else
                {
                    var contact = item as ContactItem;
                    if (contact != null)
                    {
                        entryId = IdWithHints.Create(contact.EntryID, (DateTime?)contact.LastModificationTime, wasDeleted);
                    }
                }
            }

            if (entryId != null)
            {
                OnItemSavedOrDeleted(entryId);
            }
        }
 protected void SynchronizePartialTwoWay (
     GenericConflictResolution winner,
     IIdWithHints<Identifier, int>[] aEntitesToSynchronize,
     IIdWithHints<Identifier, int>[] bEntitesToSynchronize)
 {
   var strategy = CreateTwoWaySyncStrategy (winner);
   PartialSynchronizeInternal (strategy, aEntitesToSynchronize, bEntitesToSynchronize);
 }
        public ItemSavedEventArgs(IIdWithHints <string, DateTime> entryId)
        {
            if (entryId == null)
            {
                throw new ArgumentNullException(nameof(entryId));
            }

            _entryId = entryId;
        }
        private void OnItemSavedOrDeleted(object item, ItemAction action)
        {
            IIdWithHints <string, DateTime> entryId = null;

            bool wasDeleted = action == ItemAction.Delete;

            var appointment = item as AppointmentItem;

            if (appointment != null)
            {
                s_logger.Debug($"'{nameof (ItemAction)}.{action}': Appointment '{appointment.Subject}' '{appointment.EntryID}' ");
                entryId = IdWithHints.Create(appointment.EntryID, (DateTime?)appointment.LastModificationTime, wasDeleted);
            }
            else
            {
                var task = item as TaskItem;
                if (task != null)
                {
                    s_logger.Debug($"'{nameof (ItemAction)}.{action}': Task '{task.Subject}' '{task.EntryID}' ");
                    entryId = IdWithHints.Create(task.EntryID, (DateTime?)task.LastModificationTime, wasDeleted);
                }
                else
                {
                    var contact = item as ContactItem;
                    if (contact != null)
                    {
                        s_logger.Debug($"'{nameof (ItemAction)}.{action}': Contact '{contact.LastNameAndFirstName}' '{contact.EntryID}' ");
                        entryId = IdWithHints.Create(contact.EntryID, (DateTime?)contact.LastModificationTime, wasDeleted);
                    }
                }
            }

            if (entryId != null)
            {
                OnItemSavedOrDeleted(entryId);
            }
        }
Exemplo n.º 5
0
 protected virtual void OnItemSavedOrDeleted(IIdWithHints <string, DateTime> entryId)
 {
     ItemSavedOrDeleted?.Invoke(
         this,
         new ItemSavedEventArgs(entryId));
 }
 public GenericId(string entryId, DateTime lastModificationTime, bool wasDeleted)
 {
     Inner = IdWithHints.Create(entryId, (DateTime?)lastModificationTime, wasDeleted);
 }
 public AppointmentId (Implementation.Events.AppointmentId appointmentId, DateTime lastModificationTime, bool wasDeleted)
 {
   Inner = IdWithHints.Create(appointmentId, (DateTime?) lastModificationTime, wasDeleted);
 }
Exemplo n.º 8
0
 public AppointmentId(Implementation.Events.AppointmentId appointmentId, DateTime lastModificationTime, bool wasDeleted)
 {
     Inner = IdWithHints.Create(appointmentId, (DateTime?)lastModificationTime, wasDeleted);
 }
 public GenericId (string entryId, DateTime lastModificationTime, bool wasDeleted)
 {
   Inner = IdWithHints.Create (entryId, (DateTime?) lastModificationTime, wasDeleted);
 }
    private void PartialSynchronizeInternal (
        IInitialSyncStateCreationStrategy<Identifier, int, string, Identifier, int, string> strategy,
        IIdWithHints<Identifier,int>[] aEntitesToSynchronize = null,
        IIdWithHints<Identifier, int>[] bEntitesToSynchronize = null)
    {
      var synchronizer = CreateSynchronizer (strategy);

      synchronizer.SynchronizePartialNoThrow (
          aEntitesToSynchronize ?? new IIdWithHints<Identifier, int>[] { },
          bEntitesToSynchronize ?? new IIdWithHints<Identifier, int>[] { },
          NullSynchronizationLogger.Instance).Wait();
    }