Calendar rendering improvements.
This commit is contained in:
@@ -327,7 +327,18 @@ public partial class CalendarEventComposePageViewModel : CalendarBaseViewModel
|
||||
CalendarSynchronizerOperation.CreateEvent,
|
||||
ComposeResult: createdResult));
|
||||
|
||||
_navigationService.GoBack();
|
||||
NavigateBackToCalendar(createdResult.StartDate);
|
||||
}
|
||||
|
||||
private void NavigateBackToCalendar(DateTime targetDate)
|
||||
{
|
||||
_navigationService.Navigate(
|
||||
WinoPage.CalendarPage,
|
||||
new CalendarPageNavigationArgs
|
||||
{
|
||||
NavigationDate = targetDate,
|
||||
ForceReload = true
|
||||
});
|
||||
}
|
||||
|
||||
public async Task<List<AccountContact>> SearchContactsAsync(string queryText)
|
||||
|
||||
@@ -569,33 +569,39 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
|
||||
if (!IsPageActive(lifetimeVersion))
|
||||
return;
|
||||
|
||||
RefreshSettings();
|
||||
var currentSettings = CurrentSettings;
|
||||
if (currentSettings == null)
|
||||
{
|
||||
RefreshSettings();
|
||||
currentSettings = CurrentSettings;
|
||||
}
|
||||
|
||||
var today = _dateContextProvider.GetToday();
|
||||
var visibleRange = CalendarRangeResolver.Resolve(request, CurrentSettings, today);
|
||||
var previousRange = CalendarRangeResolver.Navigate(visibleRange, -1, CurrentSettings, today);
|
||||
var nextRange = CalendarRangeResolver.Navigate(visibleRange, 1, CurrentSettings, today);
|
||||
var visibleRange = CalendarRangeResolver.Resolve(request, currentSettings, today);
|
||||
var previousRange = CalendarRangeResolver.Navigate(visibleRange, -1, currentSettings, today);
|
||||
var nextRange = CalendarRangeResolver.Navigate(visibleRange, 1, currentSettings, today);
|
||||
var loadedDateWindow = new DateRange(
|
||||
previousRange.StartDate.ToDateTime(TimeOnly.MinValue),
|
||||
nextRange.EndDate.AddDays(1).ToDateTime(TimeOnly.MinValue));
|
||||
|
||||
var shouldReload = forceReload || !IsSameVisibleRange(CurrentVisibleRange, visibleRange) || !IsSameDateRange(LoadedDateWindow, loadedDateWindow);
|
||||
List<CalendarItemViewModel> loadedItems = null;
|
||||
|
||||
if (shouldReload)
|
||||
{
|
||||
var loadedItems = await LoadCalendarItemsAsync(loadedDateWindow, lifetimeVersion).ConfigureAwait(false);
|
||||
loadedItems = await LoadCalendarItemsAsync(loadedDateWindow, lifetimeVersion).ConfigureAwait(false);
|
||||
if (!IsPageActive(lifetimeVersion))
|
||||
return;
|
||||
|
||||
await ExecuteUIThreadIfActiveAsync(lifetimeVersion, () =>
|
||||
{
|
||||
_loadedCalendarItems = loadedItems;
|
||||
CalendarItems = loadedItems;
|
||||
}).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await ExecuteUIThreadIfActiveAsync(lifetimeVersion, () =>
|
||||
{
|
||||
if (loadedItems != null)
|
||||
{
|
||||
_loadedCalendarItems = loadedItems;
|
||||
CalendarItems = loadedItems;
|
||||
}
|
||||
|
||||
CurrentVisibleRange = visibleRange;
|
||||
LoadedDateWindow = loadedDateWindow;
|
||||
VisibleDateRangeText = _calendarRangeTextFormatter.Format(visibleRange, _dateContextProvider);
|
||||
|
||||
@@ -228,7 +228,7 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel
|
||||
// If the current event was deleted, navigate back
|
||||
if (CurrentEvent?.CalendarItem?.Id == calendarItem.Id || CurrentEvent?.CalendarItem.RecurringCalendarItemId == calendarItem.Id)
|
||||
{
|
||||
_navigationService.GoBack();
|
||||
NavigateBackToCalendar(forceReload: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,7 +453,7 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel
|
||||
|
||||
await _winoRequestDelegator.ExecuteAsync(preparationRequest);
|
||||
|
||||
_navigationService.GoBack();
|
||||
NavigateBackToCalendar(forceReload: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -490,8 +490,7 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel
|
||||
|
||||
await _winoRequestDelegator.ExecuteAsync(preparationRequest);
|
||||
|
||||
// Navigate back after successful deletion
|
||||
_navigationService.GoBack();
|
||||
NavigateBackToCalendar(forceReload: true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -499,6 +498,19 @@ public partial class EventDetailsPageViewModel : CalendarBaseViewModel
|
||||
}
|
||||
}
|
||||
|
||||
private void NavigateBackToCalendar(bool forceReload)
|
||||
{
|
||||
var navigationDate = CurrentEvent?.CalendarItem.LocalStartDate ?? DateTime.Now;
|
||||
|
||||
_navigationService.Navigate(
|
||||
WinoPage.CalendarPage,
|
||||
new CalendarPageNavigationArgs
|
||||
{
|
||||
NavigationDate = navigationDate,
|
||||
ForceReload = forceReload
|
||||
});
|
||||
}
|
||||
|
||||
public override async Task KeyboardShortcutHook(KeyboardShortcutTriggerDetails args)
|
||||
{
|
||||
if (args.Handled || args.Mode != WinoApplicationMode.Calendar || args.Action != KeyboardShortcutAction.Delete)
|
||||
|
||||
Reference in New Issue
Block a user