Join online for quick popup.

This commit is contained in:
Burak Kaan Köse
2026-01-06 12:07:22 +01:00
parent be6b23c47b
commit a23a99cc8d
2 changed files with 26 additions and 13 deletions
@@ -93,19 +93,15 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
#region Data Initialization #region Data Initialization
[ObservableProperty] [ObservableProperty]
private CalendarOrientation _calendarOrientation = CalendarOrientation.Horizontal; public partial CalendarOrientation CalendarOrientation { get; set; } = CalendarOrientation.Horizontal;
[ObservableProperty] [ObservableProperty]
private DayRangeCollection _dayRanges = []; public partial DayRangeCollection DayRanges { get; set; } = [];
[ObservableProperty] [ObservableProperty]
private int _selectedDateRangeIndex; public partial int SelectedDateRangeIndex { get; set; }
[ObservableProperty] [ObservableProperty]
private DayRangeRenderModel _selectedDayRange; public partial DayRangeRenderModel SelectedDayRange { get; set; }
[ObservableProperty] [ObservableProperty]
private bool _isCalendarEnabled = true; public partial bool IsCalendarEnabled { get; set; } = true;
#endregion #endregion
@@ -113,9 +109,13 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
public event EventHandler DetailsShowCalendarItemChanged; public event EventHandler DetailsShowCalendarItemChanged;
public bool CanJoinOnline => DisplayDetailsCalendarItemViewModel != null &&
!string.IsNullOrEmpty(DisplayDetailsCalendarItemViewModel.CalendarItem.HtmlLink);
[ObservableProperty] [ObservableProperty]
[NotifyPropertyChangedFor(nameof(IsEventDetailsVisible))] [NotifyPropertyChangedFor(nameof(IsEventDetailsVisible))]
private CalendarItemViewModel _displayDetailsCalendarItemViewModel; [NotifyCanExecuteChangedFor(nameof(JoinOnlineCommand))]
public partial CalendarItemViewModel DisplayDetailsCalendarItemViewModel { get; set; }
public bool IsEventDetailsVisible => DisplayDetailsCalendarItemViewModel != null; public bool IsEventDetailsVisible => DisplayDetailsCalendarItemViewModel != null;
@@ -127,6 +127,7 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
private readonly ICalendarService _calendarService; private readonly ICalendarService _calendarService;
private readonly INavigationService _navigationService; private readonly INavigationService _navigationService;
private readonly IKeyPressService _keyPressService; private readonly IKeyPressService _keyPressService;
private readonly INativeAppService _nativeAppService;
private readonly IPreferencesService _preferencesService; private readonly IPreferencesService _preferencesService;
private readonly IWinoRequestDelegator _winoRequestDelegator; private readonly IWinoRequestDelegator _winoRequestDelegator;
@@ -147,6 +148,7 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
ICalendarService calendarService, ICalendarService calendarService,
INavigationService navigationService, INavigationService navigationService,
IKeyPressService keyPressService, IKeyPressService keyPressService,
INativeAppService nativeAppService,
IAccountCalendarStateService accountCalendarStateService, IAccountCalendarStateService accountCalendarStateService,
IPreferencesService preferencesService, IPreferencesService preferencesService,
IWinoRequestDelegator winoRequestDelegator) IWinoRequestDelegator winoRequestDelegator)
@@ -157,6 +159,7 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
_calendarService = calendarService; _calendarService = calendarService;
_navigationService = navigationService; _navigationService = navigationService;
_keyPressService = keyPressService; _keyPressService = keyPressService;
_nativeAppService = nativeAppService;
_preferencesService = preferencesService; _preferencesService = preferencesService;
_winoRequestDelegator = winoRequestDelegator; _winoRequestDelegator = winoRequestDelegator;
@@ -203,6 +206,14 @@ public partial class CalendarPageViewModel : CalendarBaseViewModel,
}); });
} }
[RelayCommand(CanExecute = nameof(CanJoinOnline))]
private async Task JoinOnlineAsync()
{
if (DisplayDetailsCalendarItemViewModel == null || string.IsNullOrEmpty(DisplayDetailsCalendarItemViewModel.CalendarItem.HtmlLink)) return;
await _nativeAppService.LaunchUriAsync(new Uri(DisplayDetailsCalendarItemViewModel.CalendarItem.HtmlLink));
}
// TODO: Replace when calendar settings are updated. // TODO: Replace when calendar settings are updated.
// Should be a field ideally. // Should be a field ideally.
private BaseCalendarTypeDrawingStrategy GetDrawingStrategy(CalendarDisplayType displayType) private BaseCalendarTypeDrawingStrategy GetDrawingStrategy(CalendarDisplayType displayType)
@@ -6,6 +6,7 @@
xmlns:animations="using:CommunityToolkit.WinUI.Animations" xmlns:animations="using:CommunityToolkit.WinUI.Animations"
xmlns:calendarControls="using:Wino.Calendar.Controls" xmlns:calendarControls="using:Wino.Calendar.Controls"
xmlns:calendarHelpers="using:Wino.Calendar.Helpers" xmlns:calendarHelpers="using:Wino.Calendar.Helpers"
xmlns:collections="using:CommunityToolkit.Mvvm.Collections"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:data="using:Wino.Calendar.ViewModels.Data" xmlns:data="using:Wino.Calendar.ViewModels.Data"
xmlns:domain="using:Wino.Core.Domain" xmlns:domain="using:Wino.Core.Domain"
@@ -13,7 +14,7 @@
xmlns:local="using:Wino.Calendar.Views" xmlns:local="using:Wino.Calendar.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls" xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
xmlns:shared="using:Wino.Core.Domain.Entities.Shared" xmlns:collections="using:CommunityToolkit.Mvvm.Collections" xmlns:shared="using:Wino.Core.Domain.Entities.Shared"
mc:Ignorable="d"> mc:Ignorable="d">
<Page.Resources> <Page.Resources>
@@ -350,11 +351,12 @@
<TextBlock Text="{x:Bind ViewModel.DisplayDetailsCalendarItemViewModel.CalendarItem.OrganizerDisplayName, Mode=OneWay}" /> <TextBlock Text="{x:Bind ViewModel.DisplayDetailsCalendarItemViewModel.CalendarItem.OrganizerDisplayName, Mode=OneWay}" />
</StackPanel> </StackPanel>
<!-- TODO: HtmlLink visibility -->
<HyperlinkButton <HyperlinkButton
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Right"> HorizontalAlignment="Right"
Command="{x:Bind ViewModel.JoinOnlineCommand}"
Visibility="{x:Bind ViewModel.CanJoinOnline, Mode=OneWay}">
<StackPanel Orientation="Horizontal" Spacing="6"> <StackPanel Orientation="Horizontal" Spacing="6">
<PathIcon <PathIcon
HorizontalAlignment="Center" HorizontalAlignment="Center"