Skip to content

Commit 1e065cb

Browse files
committed
Revert changes
1 parent 6e5699b commit 1e065cb

File tree

10 files changed

+83
-1018
lines changed

10 files changed

+83
-1018
lines changed

maui/samples/Gallery/SampleList/CalendarSamplesList.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<Sample Title="Selection" SampleName="DateSelection"/>
1818
<Sample Title="Calendar Identifier" SampleName="CalendarIdentifier"/>
1919
<Sample Title="Appointment Booking" SampleName="AppointmentBooking"/>
20-
<Sample Title ="Flight Booking" SampleName="FlightBooking"/>
2120
<Sample Title="Color Scheme" SampleName="HighlightDates" />
2221
<Sample Title="Customization" SampleName="AppearanceCustomization" />
2322
</Control>

maui/samples/Gallery/Samples/Calendar/AppointmentBooking/View/AppointmentBooking.xaml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
33
x:Class="Syncfusion.Maui.ControlsGallery.Calendar.Calendar.AppointmentBooking"
44
xmlns:calendar="clr-namespace:Syncfusion.Maui.Toolkit.Calendar;assembly=Syncfusion.Maui.Toolkit"
5-
xmlns:popUp="clr-namespace:Syncfusion.Maui.Toolkit.Popup;assembly=Syncfusion.Maui.Toolkit"
65
xmlns:buttons="clr-namespace:Syncfusion.Maui.Toolkit.Buttons;assembly=Syncfusion.Maui.Toolkit"
76
xmlns:localCore="clr-namespace:Syncfusion.Maui.ControlsGallery;assembly=Syncfusion.Maui.ControlsGallery" BackgroundColor="{AppThemeBinding Light={StaticResource BackgroundLight}, Dark={StaticResource BackgroundDark}}" Margin="-4,-4,-6,-6">
87

@@ -256,13 +255,8 @@
256255
</FlexLayout>
257256
</Grid>
258257
<Grid Grid.Row="3" HorizontalOptions="Center" Padding="0,0,0,30">
259-
<Button Text="Book Appointment" HorizontalOptions="Center" Clicked="AppointmentanBooking" VerticalOptions="End" WidthRequest="150" HeightRequest="50" CornerRadius="20"/>
260-
<popUp:SfPopup Grid.Row="0" Grid.RowSpan="3" IsVisible="false" x:Name="popUp" FooterHeight="70" ShowHeader="True" HeaderHeight="65" ShowFooter="True" HeightRequest="200">
261-
<popUp:SfPopup.PopupStyle>
262-
<popUp:PopupStyle CornerRadius="15" MessageFontSize="15" HeaderFontSize="17" HeaderFontAttribute="Bold" />
263-
</popUp:SfPopup.PopupStyle>
264-
</popUp:SfPopup>
265-
</Grid>
258+
<Button Text="Book Appointment" HorizontalOptions="Center" Clicked="AppointmentanBooking" VerticalOptions="End" WidthRequest="150" HeightRequest="50" CornerRadius="20"/>
259+
</Grid>
266260
</Grid>
267261
</Grid>
268262
</localCore:SampleView>

maui/samples/Gallery/Samples/Calendar/AppointmentBooking/View/AppointmentBooking.xaml.cs

Lines changed: 5 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Globalization;
22
using Syncfusion.Maui.Toolkit.Calendar;
33
using Syncfusion.Maui.Toolkit.Buttons;
4-
using Syncfusion.Maui.Toolkit.Popup;
54
using Color = Microsoft.Maui.Graphics.Color;
65

76
namespace Syncfusion.Maui.ControlsGallery.Calendar.Calendar
@@ -28,13 +27,6 @@ public partial class AppointmentBooking : SampleView
2827
public AppointmentBooking()
2928
{
3029
InitializeComponent();
31-
32-
if (popUp != null)
33-
{
34-
popUp.FooterTemplate = GetFooterTemplate(popUp);
35-
popUp.ContentTemplate = GetContentTemplate(popUp);
36-
}
37-
3830
#if MACCATALYST
3931
border.IsVisible = true;
4032
border.Stroke = Colors.Transparent;
@@ -57,128 +49,6 @@ public AppointmentBooking()
5749
#endif
5850
}
5951

60-
/// <summary>
61-
/// Method to get the dynamic color.
62-
/// </summary>
63-
/// <param name="resourceName">The resource name.</param>
64-
/// <returns>The color.</returns>
65-
Color GetDynamicColor(string? resourceName = null)
66-
{
67-
if (resourceName != null && App.Current != null && App.Current.Resources.TryGetValue(resourceName, out var colorValue) && colorValue is Color color)
68-
{
69-
return color;
70-
}
71-
else
72-
{
73-
if (App.Current != null && App.Current.RequestedTheme == AppTheme.Light)
74-
{
75-
return Color.FromRgb(0xFF, 0xFF, 0xFF);
76-
}
77-
else if (App.Current != null && App.Current.RequestedTheme == AppTheme.Dark)
78-
{
79-
return Color.FromRgb(0x38, 0x1E, 0x72);
80-
}
81-
}
82-
83-
return Colors.Transparent;
84-
}
85-
86-
/// <summary>
87-
/// Method to get the Ok button style.
88-
/// </summary>
89-
/// <returns>The button style.</returns>
90-
Style GetOkButtonStyle()
91-
{
92-
return new Style(typeof(Button))
93-
{
94-
Setters =
95-
{
96-
new Setter { Property = Button.CornerRadiusProperty, Value = 15 },
97-
new Setter { Property = Button.BorderColorProperty, Value = Color.FromArgb("#6750A4") },
98-
new Setter { Property = Button.BorderWidthProperty, Value = 1 },
99-
new Setter { Property = Button.BackgroundColorProperty, Value = GetDynamicColor("SfCalendarTodayHighlightColor") },
100-
new Setter { Property = Button.TextColorProperty, Value = GetDynamicColor() },
101-
new Setter { Property = Button.FontSizeProperty, Value = 14 },
102-
}
103-
};
104-
}
105-
106-
/// <summary>
107-
/// Method to get the footer template.
108-
/// </summary>
109-
/// <param name="popup">The pop up.</param>
110-
/// <returns>The data template.</returns>
111-
DataTemplate GetFooterTemplate(SfPopup popup)
112-
{
113-
var footerTemplate = new DataTemplate(() =>
114-
{
115-
var grid = new Grid
116-
{
117-
ColumnSpacing = 12,
118-
Padding = new Thickness(24)
119-
};
120-
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
121-
grid.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
122-
var oKButton = new Button
123-
{
124-
Text = "OK",
125-
Style = GetOkButtonStyle(),
126-
WidthRequest = 96,
127-
HeightRequest = 40
128-
};
129-
oKButton.Clicked += (sender, args) =>
130-
{
131-
popup.Dismiss();
132-
};
133-
grid.Children.Add(oKButton);
134-
Grid.SetColumn(oKButton, 1);
135-
return grid;
136-
});
137-
138-
return footerTemplate;
139-
}
140-
141-
/// <summary>
142-
/// Method to get the content template.
143-
/// </summary>
144-
/// <param name="popup">The pop up.</param>
145-
/// <returns>The data template.</returns>
146-
DataTemplate GetContentTemplate(SfPopup popup)
147-
{
148-
var contentTemplate = new DataTemplate(() =>
149-
{
150-
var grid = new Grid();
151-
grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Star });
152-
grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0.1, GridUnitType.Star) });
153-
var label = new Label
154-
{
155-
LineBreakMode = LineBreakMode.WordWrap,
156-
Padding = new Thickness(20, 0, 0, 0),
157-
FontSize = 16,
158-
HorizontalOptions = LayoutOptions.Start,
159-
HorizontalTextAlignment = TextAlignment.Start,
160-
WidthRequest = 300,
161-
};
162-
163-
label.BindingContext = popup;
164-
label.SetBinding(Label.TextProperty, "Message");
165-
var stackLayout = new StackLayout
166-
{
167-
Margin = new Thickness(0, 2, 0, 0),
168-
HeightRequest = 1,
169-
};
170-
171-
stackLayout.BackgroundColor = _isLightTheme ? Color.FromArgb("#611c1b1f") : Color.FromArgb("#61e6e1e5");
172-
grid.Children.Add(label);
173-
grid.Children.Add(stackLayout);
174-
Grid.SetRow(label, 0);
175-
Grid.SetRow(stackLayout, 1);
176-
return grid;
177-
});
178-
179-
return contentTemplate;
180-
}
181-
18252
/// <summary>
18353
/// Initialize the calendar.
18454
/// </summary>
@@ -265,8 +135,6 @@ void AppointmentanBooking(object sender, EventArgs e)
265135
BookAppointment(mobileAppointmentBooking, mobileFlexLayout);
266136
}
267137
#endif
268-
269-
popUp.Show();
270138
}
271139

272140
/// <summary>
@@ -276,29 +144,22 @@ void AppointmentanBooking(object sender, EventArgs e)
276144
/// <param name="buttonLayout">Time slot button layout.</param>
277145
void BookAppointment(SfCalendar calendar, FlexLayout buttonLayout)
278146
{
279-
if (popUp == null)
280-
{
281-
return;
282-
}
283-
284147
if (calendar.SelectedDate == null)
285148
{
286-
popUp.HeaderTitle = "Alert !";
287-
popUp.Message = "Please select a date to book an appointment";
149+
Application.Current?.Windows[0].Page?.DisplayAlert("Alert !", "Please select a date to book an appointment ", "Ok");
288150
return;
289151
}
290152

291153
if (_timeSlot == string.Empty)
292154
{
293-
popUp.HeaderTitle = "Alert !";
294-
popUp.Message = "Please select a time to book an appointment";
155+
Application.Current?.Windows[0].Page?.DisplayAlert("Alert !", "Please select a time to book an appointment ", "Ok");
295156
return;
296157
}
297158

298-
popUp.HeaderTitle = "Confirmation";
299159
DateTime dateTime = calendar.SelectedDate.Value;
300160
string dayText = dateTime.ToString("MMMM" + " " + dateTime.Day.ToString() + ", " + dateTime.ToString("yyyy"), CultureInfo.CurrentUICulture);
301-
popUp.Message = "Appointment booked for " + dayText + " " + _timeSlot;
161+
string text = "Appointment booked for " + dayText + " " + _timeSlot;
162+
Application.Current?.Windows[0].Page?.DisplayAlert("Confirmation", text, "Ok");
302163
calendar.SelectedDate = DateTime.Now.Date;
303164
calendar.DisplayDate = DateTime.Now.Date;
304165
_timeSlot = string.Empty;
@@ -342,9 +203,7 @@ void UpdateTimeSlotSelection(SfCalendar calendar, SfButton selectedButton, FlexL
342203
{
343204
if (calendar.SelectedDate == null)
344205
{
345-
popUp.HeaderTitle = "Alert !";
346-
popUp.Message = "Please select a date to book an appointment ";
347-
popUp.Show();
206+
Application.Current?.Windows[0].Page?.DisplayAlert("Alert !", "Please select a date to book an appointment ", "Ok");
348207
return;
349208
}
350209

maui/src/Calendar/Helper/CalendarViewHelper.cs

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,43 +1619,23 @@ internal static string GetLanguage(string calendarIdentifier)
16191619
/// <returns>A calendar instance.</returns>
16201620
internal static Globalization.Calendar GetCalendar(string calendarIdentifier)
16211621
{
1622-
switch (calendarIdentifier)
1622+
var type = Type.GetType("System.Globalization." + calendarIdentifier + "Calendar");
1623+
if (type != null)
16231624
{
1624-
1625-
case "Gregorian":
1626-
1627-
return new GregorianCalendar();
1628-
1629-
case "Hijri":
1630-
1631-
return new HijriCalendar();
1632-
1633-
case "Persian":
1634-
1635-
return new PersianCalendar();
1636-
1637-
case "ThaiBuddhist":
1638-
1639-
return new ThaiBuddhistCalendar();
1640-
1641-
case "Taiwan":
1642-
1643-
return new TaiwanCalendar();
1644-
1645-
case "UmAlQura":
1646-
1647-
return new UmAlQuraCalendar();
1648-
1649-
case "Korean":
1650-
1651-
return new KoreanCalendar();
1652-
1653-
default:
1654-
1655-
// If calendar identifier is specified wrongly, then default calendar will be used.
1656-
1625+
var calendar = Activator.CreateInstance(type) as Globalization.Calendar;
1626+
if (calendar != null)
1627+
{
1628+
return calendar;
1629+
}
1630+
else
1631+
{
16571632
return CultureInfo.CurrentUICulture.DateTimeFormat.Calendar;
1658-
1633+
}
1634+
}
1635+
else
1636+
{
1637+
// If calendar identifier is specified wrongly, then default calendar will be used.
1638+
return CultureInfo.CurrentUICulture.DateTimeFormat.Calendar;
16591639
}
16601640
}
16611641

maui/src/Calendar/Interface/ICalendar.cs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Collections.ObjectModel;
2-
using System.ComponentModel;
32
using Syncfusion.Maui.Toolkit.Internals;
43

54
namespace Syncfusion.Maui.Toolkit.Calendar
@@ -30,30 +29,6 @@ internal interface ICalendar : ICalendarYear, ICalendarMonth, IInteractionInfo,
3029
/// <param name="date">The date value.</param>
3130
/// <returns>The calendar special day icon details.</returns>
3231
CalendarIconDetails? IsSpecialDayPredicate(DateTime date);
33-
34-
/// <summary>
35-
/// Method to trigger the calendar popup closed.
36-
/// </summary>
37-
/// <param name="e">The Event args.</param>
38-
void OnPopupClosed(EventArgs e);
39-
40-
/// <summary>
41-
/// Method to trigger the calendar popup closing.
42-
/// </summary>
43-
/// <param name="e">The cancel event args.</param>
44-
void OnPopupClosing(CancelEventArgs e);
45-
46-
/// <summary>
47-
/// Method to trigger the calendar popup open.
48-
/// </summary>
49-
/// <param name="e">The event args.</param>
50-
void OnPopupOpened(EventArgs e);
51-
52-
/// <summary>
53-
/// Method to trigger the calendar popup opening.
54-
/// </summary>
55-
/// <param name="e">The event args.</param>
56-
void OnPopupOpening(CancelEventArgs e);
5732
}
5833

5934
/// <summary>

maui/src/Calendar/Model/Settings/MonthViewSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ public CalendarTextStyle SelectionTextStyle
806806
/// <seealso cref="SfCalendar.SelectionMode"/>
807807
/// <example>
808808
/// The following code demonstrates, how to use the Cell Template property in the month view.
809-
/// # [XAML](#tab/tabid-1)
809+
/// #[XAML](#tab/tabid-1)
810810
/// <code Lang="XAML"><![CDATA[
811811
/// <calendar:SfCalendar x:Name= "Calendar">
812812
/// < calendar:SfCalendar.MonthView>

maui/src/Calendar/Model/Settings/YearViewSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ public CalendarTextStyle SelectionTextStyle
472472
/// <seealso cref="SfCalendar.SelectionMode"/>
473473
/// <example>
474474
/// The following code demonstrates, how to use the Cell Template property in the year view.
475-
/// # [XAML](#tab/tabid-1)
475+
/// #[XAML](#tab/tabid-1)
476476
/// <code Lang="XAML"><![CDATA[
477477
/// <calendar:SfCalendar x:Name= "Calendar" View = "Decade">
478478
/// < calendar:SfCalendar.YearView>

0 commit comments

Comments
 (0)