Exemplo n.º 1
0
        private void onTimeEntryUpdated(EntityUpdate <IThreadSafeTimeEntry> update)
        {
            var timeEntry = update.Entity;

            if (timeEntry == null)
            {
                return;
            }

            if (timeEntry.IsDeleted || timeEntry.IsRunning())
            {
                onTimeEntryRemoved(timeEntry.Id);
            }
            else
            {
                var timeEntryViewModel = new TimeEntryViewModel(timeEntry, durationFormat);
                if (timeEntry.Id == timeEntryToDelete?.Id)
                {
                    // Ignore this update because the entity is hidden and might be deleted unless the user
                    // undoes the action. In that case bring the time entry but with the updated data.
                    timeEntryToDelete = timeEntryViewModel;
                }
                else
                {
                    TimeEntries.UpdateItem(update.Id, timeEntryViewModel);
                }
            }
        }