Compare commits
1 Commits
fix/win2d-
...
feature/Da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aba7539e7d |
@@ -142,5 +142,7 @@ public partial class AccountManagementViewModel : AccountManagementPageViewModel
|
||||
};
|
||||
|
||||
var synchronizationResponse = await WinoServerConnectionManager.GetResponseAsync<CalendarSynchronizationResult, NewCalendarSynchronizationRequested>(new NewCalendarSynchronizationRequested(synchronizationOptions, SynchronizationSource.Client));
|
||||
accountCreationDialog.Complete(cancel: false);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,20 +237,20 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
|
||||
{
|
||||
var durationSeconds = (QuickEventEndTime - QuickEventStartTime).TotalSeconds;
|
||||
|
||||
var testCalendarItem = new CalendarItem
|
||||
{
|
||||
CalendarId = SelectedQuickEventAccountCalendar.Id,
|
||||
StartDate = QuickEventStartTime,
|
||||
DurationInSeconds = durationSeconds,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
Description = string.Empty,
|
||||
Location = Location,
|
||||
Title = EventName,
|
||||
Id = Guid.NewGuid()
|
||||
};
|
||||
//var testCalendarItem = new CalendarItem
|
||||
//{
|
||||
// CalendarId = SelectedQuickEventAccountCalendar.Id,
|
||||
// StartDate = QuickEventStartTime,
|
||||
// DurationInSeconds = durationSeconds,
|
||||
// CreatedAt = DateTime.UtcNow,
|
||||
// Description = string.Empty,
|
||||
// Location = Location,
|
||||
// Title = EventName,
|
||||
// Id = Guid.NewGuid()
|
||||
//};
|
||||
|
||||
IsQuickEventDialogOpen = false;
|
||||
await _calendarService.CreateNewCalendarItemAsync(testCalendarItem, null);
|
||||
//IsQuickEventDialogOpen = false;
|
||||
//await _calendarService.CreateNewCalendarItemAsync(testCalendarItem, null);
|
||||
|
||||
// TODO: Create the request with the synchronizer.
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@ public partial class CalendarItemViewModel : ObservableObject, ICalendarItem, IC
|
||||
|
||||
public IAccountCalendar AssignedCalendar => CalendarItem.AssignedCalendar;
|
||||
|
||||
public DateTime StartDate { get => CalendarItem.StartDate; set => CalendarItem.StartDate = value; }
|
||||
public DateTime StartDate => CalendarItem.StartDate;
|
||||
|
||||
public DateTime EndDate => CalendarItem.EndDate;
|
||||
|
||||
public double DurationInSeconds { get => CalendarItem.DurationInSeconds; set => CalendarItem.DurationInSeconds = value; }
|
||||
public double DurationInSeconds => CalendarItem.DurationInSeconds;
|
||||
|
||||
public ITimePeriod Period => CalendarItem.Period;
|
||||
|
||||
|
||||
@@ -17,24 +17,23 @@ public class CalendarItem : ICalendarItem
|
||||
public string Description { get; set; }
|
||||
public string Location { get; set; }
|
||||
|
||||
public DateTime StartDate { get; set; }
|
||||
public string StartTimeOffset { get; set; }
|
||||
public string EndTimeOffset { get; set; }
|
||||
|
||||
public DateTime EndDate
|
||||
{
|
||||
get
|
||||
{
|
||||
return StartDate.AddSeconds(DurationInSeconds);
|
||||
}
|
||||
}
|
||||
public DateTimeOffset StartDateTimeOffset => DateTimeOffset.Parse(StartTimeOffset);
|
||||
public DateTimeOffset EndDateTimeOffsete => DateTimeOffset.Parse(EndTimeOffset);
|
||||
|
||||
public TimeSpan StartDateOffset { get; set; }
|
||||
public TimeSpan EndDateOffset { get; set; }
|
||||
public DateTime StartDate => StartDateTimeOffset.DateTime;//TimeZoneInfo.ConvertTime(StartDateTimeOffset, TimeZoneInfo.Local).DateTime;
|
||||
public DateTime EndDate => EndDateTimeOffsete.DateTime;// TimeZoneInfo.ConvertTime(, TimeZoneInfo.Local).DateTime;
|
||||
|
||||
private ITimePeriod _period;
|
||||
public ITimePeriod Period
|
||||
{
|
||||
get
|
||||
{
|
||||
// Period must be loaded by user's current UI culture based on StartDateTimeOffset and EndDateTimeOffset
|
||||
// Get the time zone corresponding to the current culture
|
||||
|
||||
_period ??= new TimeRange(StartDate, EndDate);
|
||||
|
||||
return _period;
|
||||
@@ -94,7 +93,7 @@ public class CalendarItem : ICalendarItem
|
||||
}
|
||||
}
|
||||
|
||||
public double DurationInSeconds { get; set; }
|
||||
public double DurationInSeconds => Period.Duration.TotalSeconds;
|
||||
public string Recurrence { get; set; }
|
||||
|
||||
public string OrganizerDisplayName { get; set; }
|
||||
@@ -144,7 +143,7 @@ public class CalendarItem : ICalendarItem
|
||||
/// </summary>
|
||||
public Guid EventTrackingId => IsOccurrence ? RecurringCalendarItemId.Value : Id;
|
||||
|
||||
public CalendarItem CreateRecurrence(DateTime startDate, double durationInSeconds)
|
||||
public CalendarItem CreateRecurrence(DateTimeOffset startDateOffset, DateTimeOffset endDateOffset)
|
||||
{
|
||||
// Create a copy with the new start date and duration
|
||||
|
||||
@@ -154,8 +153,8 @@ public class CalendarItem : ICalendarItem
|
||||
Title = Title,
|
||||
Description = Description,
|
||||
Location = Location,
|
||||
StartDate = startDate,
|
||||
DurationInSeconds = durationInSeconds,
|
||||
StartTimeOffset = startDateOffset.ToString("o"),
|
||||
EndTimeOffset = endDateOffset.ToString("o"),
|
||||
Recurrence = Recurrence,
|
||||
OrganizerDisplayName = OrganizerDisplayName,
|
||||
OrganizerEmail = OrganizerEmail,
|
||||
@@ -168,8 +167,6 @@ public class CalendarItem : ICalendarItem
|
||||
Status = Status,
|
||||
CustomEventColorHex = CustomEventColorHex,
|
||||
HtmlLink = HtmlLink,
|
||||
StartDateOffset = StartDateOffset,
|
||||
EndDateOffset = EndDateOffset,
|
||||
RemoteEventId = RemoteEventId,
|
||||
IsHidden = IsHidden,
|
||||
IsLocked = IsLocked,
|
||||
|
||||
@@ -8,9 +8,9 @@ public interface ICalendarItem
|
||||
string Title { get; }
|
||||
Guid Id { get; }
|
||||
IAccountCalendar AssignedCalendar { get; }
|
||||
DateTime StartDate { get; set; }
|
||||
DateTime StartDate { get; }
|
||||
DateTime EndDate { get; }
|
||||
double DurationInSeconds { get; set; }
|
||||
double DurationInSeconds { get; }
|
||||
ITimePeriod Period { get; }
|
||||
|
||||
bool IsAllDayEvent { get; }
|
||||
|
||||
@@ -190,7 +190,7 @@ public static class GoogleIntegratorExtensions
|
||||
return calendar;
|
||||
}
|
||||
|
||||
public static DateTimeOffset? GetEventDateTimeOffset(EventDateTime calendarEvent)
|
||||
public static DateTimeOffset GetEventDateTimeOffset(EventDateTime calendarEvent)
|
||||
{
|
||||
if (calendarEvent != null)
|
||||
{
|
||||
@@ -212,7 +212,7 @@ public static class GoogleIntegratorExtensions
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
throw new Exception("Invalid date format in Google Calendar event date.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -66,12 +66,6 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
||||
var eventStartDateTimeOffset = GoogleIntegratorExtensions.GetEventDateTimeOffset(calendarEvent.Start);
|
||||
var eventEndDateTimeOffset = GoogleIntegratorExtensions.GetEventDateTimeOffset(calendarEvent.End);
|
||||
|
||||
double totalDurationInSeconds = 0;
|
||||
|
||||
if (eventStartDateTimeOffset != null && eventEndDateTimeOffset != null)
|
||||
{
|
||||
totalDurationInSeconds = (eventEndDateTimeOffset.Value - eventStartDateTimeOffset.Value).TotalSeconds;
|
||||
}
|
||||
|
||||
CalendarItem calendarItem = null;
|
||||
|
||||
@@ -80,12 +74,6 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
||||
// Exceptions of parent events might not have all the fields populated.
|
||||
// We must use the parent event's data for fields that don't exists.
|
||||
|
||||
// Update duration if it's not populated.
|
||||
if (totalDurationInSeconds == 0)
|
||||
{
|
||||
totalDurationInSeconds = parentRecurringEvent.DurationInSeconds;
|
||||
}
|
||||
|
||||
var organizerMail = GetOrganizerEmail(calendarEvent, organizerAccount);
|
||||
var organizerName = GetOrganizerName(calendarEvent, organizerAccount);
|
||||
|
||||
@@ -96,10 +84,8 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
Description = calendarEvent.Description ?? parentRecurringEvent.Description,
|
||||
Id = Guid.NewGuid(),
|
||||
StartDate = eventStartDateTimeOffset.Value.DateTime,
|
||||
StartDateOffset = eventStartDateTimeOffset.Value.Offset,
|
||||
EndDateOffset = eventEndDateTimeOffset?.Offset ?? parentRecurringEvent.EndDateOffset,
|
||||
DurationInSeconds = totalDurationInSeconds,
|
||||
StartTimeOffset = eventStartDateTimeOffset.ToString("o"),
|
||||
EndTimeOffset = eventEndDateTimeOffset.ToString("o"),
|
||||
Location = string.IsNullOrEmpty(calendarEvent.Location) ? parentRecurringEvent.Location : calendarEvent.Location,
|
||||
|
||||
// Leave it empty if it's not populated.
|
||||
@@ -120,22 +106,14 @@ public class GmailChangeProcessor : DefaultChangeProcessor, IGmailChangeProcesso
|
||||
// This is a parent event creation.
|
||||
// Start-End dates are guaranteed to be populated.
|
||||
|
||||
if (eventStartDateTimeOffset == null || eventEndDateTimeOffset == null)
|
||||
{
|
||||
Log.Error("Failed to create parent event because either start or end date is not specified.");
|
||||
return;
|
||||
}
|
||||
|
||||
calendarItem = new CalendarItem()
|
||||
{
|
||||
CalendarId = assignedCalendar.Id,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
Description = calendarEvent.Description,
|
||||
Id = Guid.NewGuid(),
|
||||
StartDate = eventStartDateTimeOffset.Value.DateTime,
|
||||
StartDateOffset = eventStartDateTimeOffset.Value.Offset,
|
||||
EndDateOffset = eventEndDateTimeOffset.Value.Offset,
|
||||
DurationInSeconds = totalDurationInSeconds,
|
||||
StartTimeOffset = eventStartDateTimeOffset.ToString("o"),
|
||||
EndTimeOffset = eventEndDateTimeOffset.ToString("o"),
|
||||
Location = calendarEvent.Location,
|
||||
Recurrence = GoogleIntegratorExtensions.GetRecurrenceString(calendarEvent),
|
||||
Status = GetStatus(calendarEvent.Status),
|
||||
|
||||
@@ -61,18 +61,21 @@ public class OutlookChangeProcessor(IDatabaseService databaseService,
|
||||
DateTimeOffset eventStartDateTimeOffset = OutlookIntegratorExtensions.GetDateTimeOffsetFromDateTimeTimeZone(calendarEvent.Start);
|
||||
DateTimeOffset eventEndDateTimeOffset = OutlookIntegratorExtensions.GetDateTimeOffsetFromDateTimeTimeZone(calendarEvent.End);
|
||||
|
||||
var durationInSeconds = (eventEndDateTimeOffset - eventStartDateTimeOffset).TotalSeconds;
|
||||
|
||||
|
||||
savingItem.RemoteEventId = calendarEvent.Id;
|
||||
savingItem.StartDate = eventStartDateTimeOffset.DateTime;
|
||||
savingItem.StartDateOffset = eventStartDateTimeOffset.Offset;
|
||||
savingItem.EndDateOffset = eventEndDateTimeOffset.Offset;
|
||||
savingItem.DurationInSeconds = durationInSeconds;
|
||||
savingItem.StartTimeOffset = eventStartDateTimeOffset.ToString("O");
|
||||
savingItem.EndTimeOffset = eventEndDateTimeOffset.ToString("O");
|
||||
|
||||
savingItem.Title = calendarEvent.Subject;
|
||||
savingItem.Description = calendarEvent.Body?.Content;
|
||||
savingItem.Location = calendarEvent.Location?.DisplayName;
|
||||
|
||||
if (savingItem.Title.Contains("Atatürk"))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (calendarEvent.Type == EventType.Exception && !string.IsNullOrEmpty(calendarEvent.SeriesMasterId))
|
||||
{
|
||||
// This is a recurring event exception.
|
||||
|
||||
@@ -160,7 +160,7 @@ public class CalendarService : BaseDatabaseService, ICalendarService
|
||||
// There is no exception for the period.
|
||||
// Change the instance StartDate and Duration.
|
||||
|
||||
var recurrence = ev.CreateRecurrence(occurrence.Period.StartTime.Value, occurrence.Period.Duration.TotalSeconds);
|
||||
var recurrence = ev.CreateRecurrence(occurrence.Period.StartTime.Value, occurrence.Period.EndTime.Value);
|
||||
|
||||
result.Add(recurrence);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user