Exemple #1
0
        private CalendarItem(IThreadSafeTimeEntry timeEntry)
            : this(
                timeEntry.Id.ToString(),
                CalendarItemSource.TimeEntry,
                timeEntry.Start,
                timeEntry.Duration.HasValue ? TimeSpan.FromSeconds(timeEntry.Duration.Value) : null as TimeSpan?,
                timeEntry.Description,
                CalendarIconKind.None,
                timeEntry.Project?.Color ?? ColorHelper.NoProject,
                timeEntry.Id)
        {
            switch (timeEntry.SyncStatus)
            {
            case SyncStatus.SyncNeeded:
                IconKind = CalendarIconKind.Unsynced;
                break;

            case SyncStatus.SyncFailed:
                IconKind = CalendarIconKind.Unsyncable;
                break;

            default:
                break;
            }
        }
Exemple #2
0
            public void SetsTheAppropriateCalendarIconKind(SyncStatus syncStatus, CalendarIconKind expectedCalendarIcon)
            {
                var timeEntry = new MockTimeEntry {
                    SyncStatus = syncStatus
                };

                var calendarItem = CalendarItem.From(timeEntry);

                calendarItem.IconKind.Should().Be(expectedCalendarIcon);
            }
Exemple #3
0
 public CalendarItem(
     string id,
     CalendarItemSource source,
     DateTimeOffset startTime,
     TimeSpan?duration,
     string description,
     CalendarIconKind iconKind,
     string color      = ColorHelper.NoProject,
     long?timeEntryId  = null,
     string calendarId = "")
 {
     Id          = id;
     Source      = source;
     StartTime   = startTime;
     Duration    = duration;
     Description = string.IsNullOrEmpty(description) ? Resources.NoDescription : description;
     Color       = ColorHelper.IsValidHexColor(color) ? color : ColorHelper.NoProject;
     TimeEntryId = timeEntryId;
     CalendarId  = calendarId;
     IconKind    = iconKind;
 }