Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squash Merge #72

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
201 commits
Select commit Hold shift + click to select a range
7fddb2a
Added Calendar sample page with viewmodel
nickrandolph Oct 26, 2019
825622e
#1 - Allow Cheking and retrieving of permissions for android and iOS
ScottBTR Oct 29, 2019
d176387
Allow Android to make a get calendars request.
ScottBTR Oct 30, 2019
9eb8660
Fixing issue with disappearing properties on CalendarObject
nickrandolph Oct 30, 2019
9c6ed16
Tidying up implementation code for Android
nickrandolph Oct 30, 2019
f8a17ca
#2 Allow Xamarin to pull back a list of calendars for both iOS and An…
ScottBTR Oct 30, 2019
d58d862
Amend changes set by PR for Issues - #1 #2 #3
ScottBTR Oct 31, 2019
1d35376
Merge pull request #14 from builttoroam/feature/permissions
ScottBTR Oct 31, 2019
f18d803
Calendar Events able to be displayed for all or a specified calendar
ScottBTR Oct 31, 2019
4b4d3c2
Get Calendars working in sample for both all or specificed calendar o…
ScottBTR Oct 31, 2019
7a78fef
Reorder properties so that functionality comes after all properties.
ScottBTR Oct 31, 2019
8590229
Trial including start and end dates for event requests.
ScottBTR Oct 31, 2019
9412f51
Allow Date & Time pickers to control event display (also works with s…
ScottBTR Nov 1, 2019
6b8fbff
Revert Linker change.
ScottBTR Nov 1, 2019
ea71161
Provide code reference point
ScottBTR Nov 1, 2019
a378b1e
Added Checkboxes to enable and disable start date/time and end date/t…
ScottBTR Nov 1, 2019
342f830
Added sort by datestart, changed listview to HasUnevenRows to make al…
ScottBTR Nov 4, 2019
19cca71
Added new CalendarEventAddPage as a modal to enter data required to c…
ScottBTR Nov 4, 2019
ea964ce
Add backend data call to be able to create new event when provided wi…
ScottBTR Nov 4, 2019
581e44d
Clean up according to PR comments - Removal of not-needed converter E…
ScottBTR Nov 4, 2019
7ac173d
Calendar Events able to be displayed for all or a specified calendar
ScottBTR Oct 31, 2019
87469fb
Get Calendars working in sample for both all or specificed calendar o…
ScottBTR Oct 31, 2019
258df82
Reorder properties so that functionality comes after all properties.
ScottBTR Oct 31, 2019
a5c2ff2
Trial including start and end dates for event requests.
ScottBTR Oct 31, 2019
f35a14d
Allow Date & Time pickers to control event display (also works with s…
ScottBTR Nov 1, 2019
2f99c7e
Revert Linker change.
ScottBTR Nov 1, 2019
e65ba63
Provide code reference point
ScottBTR Nov 1, 2019
080fecd
Added Checkboxes to enable and disable start date/time and end date/t…
ScottBTR Nov 1, 2019
429680f
Added Github repository reference to class pulled from outside source.
ScottBTR Nov 4, 2019
37c3ea3
Added sort by datestart, changed listview to HasUnevenRows to make al…
ScottBTR Nov 4, 2019
e863f4a
Added new CalendarEventAddPage as a modal to enter data required to c…
ScottBTR Nov 4, 2019
a625af4
Add backend data call to be able to create new event when provided wi…
ScottBTR Nov 4, 2019
3372492
Clean up according to PR comments - Removal of not-needed converter E…
ScottBTR Nov 4, 2019
241eb04
Remove Calendar Add Event feature [Android] - May be reimplemented at…
ScottBTR Nov 4, 2019
dcbab34
FiX calendareventpage to also use stringformat instead of EpochToDate…
ScottBTR Nov 4, 2019
c05f486
Bring back backing fields, or else fields outside the checkbox are no…
ScottBTR Nov 4, 2019
46026e5
Made changes, addressing PR feedback
ScottBTR Nov 4, 2019
800c50f
Moved comment to top of file (above usings)
ScottBTR Nov 4, 2019
7d94996
Grids within Grids don't seem to work properly, have tried using vert…
ScottBTR Nov 4, 2019
41cd5ac
Addressing PR comment regarding reuse of static string.
ScottBTR Nov 4, 2019
973df83
Working out pulling back events for ios for any and specific calendar…
ScottBTR Nov 5, 2019
751f05d
Revert "Working out pulling back events for ios for any and specific …
ScottBTR Nov 5, 2019
341bd1f
Revert "Revert "Working out pulling back events for ios for any and s…
ScottBTR Nov 5, 2019
b7c0a8a
Adjustments made to meet PR requests
ScottBTR Nov 6, 2019
80faf5a
iOS requesting events now works with date from/to, also sorts the res…
ScottBTR Nov 6, 2019
58f4991
fix bug that occurs when end date is updated it is resulting in a nul…
ScottBTR Nov 6, 2019
7df0421
Alter Description to be iOS 'Notes' as 'Description' is actually the …
ScottBTR Nov 6, 2019
d492ffe
Using PushAsync instead of PushModalAsync as an easy way to allow bac…
ScottBTR Nov 6, 2019
4c8e8b7
Small text fix ups.
ScottBTR Nov 6, 2019
0441e24
don't need to await read access from viewmodel, each request already …
ScottBTR Nov 6, 2019
5fb812f
Added GetEventByIdAsycn --> Works at [Android] and [iOS] level curren…
ScottBTR Nov 6, 2019
03f296c
Default EndTime to 11:59pm so that if you turn both start date and en…
ScottBTR Nov 6, 2019
93e194d
[Android] Attendees can now be retrieved and rules are about half way…
ScottBTR Nov 6, 2019
318e32f
Don't break when BYDAY= is the last parameter, Should add this on all…
ScottBTR Nov 6, 2019
084ee01
Checks to make sure rules are non-nullable to prevent an unnessacary/…
ScottBTR Nov 7, 2019
cbeef9c
UWP working with requesting read/write, pulling back calendares, pull…
ScottBTR Nov 7, 2019
ceef969
Added sort by datestart, changed listview to HasUnevenRows to make al…
ScottBTR Nov 4, 2019
46e018d
Added new CalendarEventAddPage as a modal to enter data required to c…
ScottBTR Nov 4, 2019
3af862b
Add backend data call to be able to create new event when provided wi…
ScottBTR Nov 4, 2019
d866522
Clean up according to PR comments - Removal of not-needed converter E…
ScottBTR Nov 4, 2019
9de7a2e
Remove Calendar Add Event feature [Android] - May be reimplemented at…
ScottBTR Nov 4, 2019
995c597
FiX calendareventpage to also use stringformat instead of EpochToDate…
ScottBTR Nov 4, 2019
253c2eb
Bring back backing fields, or else fields outside the checkbox are no…
ScottBTR Nov 4, 2019
1a8b47a
Made changes, addressing PR feedback
ScottBTR Nov 4, 2019
252ab5d
Moved comment to top of file (above usings)
ScottBTR Nov 4, 2019
9c78050
Grids within Grids don't seem to work properly, have tried using vert…
ScottBTR Nov 4, 2019
b014603
Addressing PR comment regarding reuse of static string.
ScottBTR Nov 4, 2019
c4b776a
Working out pulling back events for ios for any and specific calendar…
ScottBTR Nov 5, 2019
426d565
Revert "Working out pulling back events for ios for any and specific …
ScottBTR Nov 5, 2019
a3f2ae0
iOS Attendee Calendars
ScottBTR Nov 7, 2019
666cde8
Don't try to build attendee list when there are none.
ScottBTR Nov 7, 2019
8314adc
Allow Android to hold Deleted bool for Calendar and Event, so that us…
ScottBTR Nov 8, 2019
b69bd34
Add tests, and use default end date of 14 days away (there is a funct…
ScottBTR Nov 8, 2019
a027167
iOS Hot.Reload and Hot.Restart
ScottBTR Nov 8, 2019
1e31fb5
Adjustments made to meet PR requests
ScottBTR Nov 6, 2019
dadb40b
iOS requesting events now works with date from/to, also sorts the res…
ScottBTR Nov 6, 2019
6cbae50
fix bug that occurs when end date is updated it is resulting in a nul…
ScottBTR Nov 6, 2019
36b92ff
Alter Description to be iOS 'Notes' as 'Description' is actually the …
ScottBTR Nov 6, 2019
19af067
Using PushAsync instead of PushModalAsync as an easy way to allow bac…
ScottBTR Nov 6, 2019
3b08abc
Small text fix ups.
ScottBTR Nov 6, 2019
0863ce1
don't need to await read access from viewmodel, each request already …
ScottBTR Nov 6, 2019
509e928
Addressing PR changes
ScottBTR Nov 11, 2019
5699cec
Creating Extension Methods
ScottBTR Nov 11, 2019
0838afb
Merge branch 'feature/calendar' into feature/requesteventuniquely
ScottBTR Nov 11, 2019
c2eb58c
Allow Uwp To see appointments, fix android trying to throw SQLExcepti…
ScottBTR Nov 11, 2019
cd634b2
Merge branch 'feature/calendartests' into feature/inclusionofandroida…
ScottBTR Nov 13, 2019
02d305f
Code cleanup to allow merge to be functional
ScottBTR Nov 13, 2019
db85a5e
Create event with provided values for android and return id of event …
ScottBTR Nov 13, 2019
963e5e9
Have Calendar creation (somewhat) working with creation, has strange …
ScottBTR Nov 13, 2019
b2d78f4
Create Event for iOS
ScottBTR Nov 14, 2019
bed639f
Create Event requires string because iOS uses guids.
ScottBTR Nov 14, 2019
f490a1e
Addressing PR Feedback
ScottBTR Nov 14, 2019
85abcef
Revert not needed csproj changes to address PR feedback.
ScottBTR Nov 14, 2019
7927e58
Merge pull request #30 from builttoroam/feature/requesteventuniquely
ScottBTR Nov 14, 2019
5c300c6
Merge branch 'feature/calendar' into feature/uwpintegration
ScottBTR Nov 14, 2019
38ea410
Merge branch 'feature/requesteventuniquely' into feature/uwpintegration
ScottBTR Nov 14, 2019
f3b09a7
Spacing issue, damn you style cop!
ScottBTR Nov 14, 2019
ccd87d1
Address PR Comments
ScottBTR Nov 14, 2019
5685d7f
Addressing PR Comment in relation to not disposing of Cursor.
ScottBTR Nov 14, 2019
36f647b
Adjusted to PR Comments, removed double up of Description
ScottBTR Nov 18, 2019
b2970e3
Change Cursor to using for auto dispose purposes.
ScottBTR Nov 18, 2019
07e2ee0
Allow AllDay to turn on/off time pickers, as if it's an all day event…
ScottBTR Nov 19, 2019
d0cc6ac
Add missing AllDay parameters for ios and uwp
ScottBTR Nov 19, 2019
d27f4a2
Disable AddEvent button unless an event has a proper start/end date a…
ScottBTR Nov 19, 2019
27c2e81
Adjusted according to PR comments
ScottBTR Nov 19, 2019
689489a
Moved Content into a scroll view incase either there are too many att…
ScottBTR Nov 20, 2019
388e0b8
Merge pull request #31 from builttoroam/feature/uwpintegration
ScottBTR Nov 20, 2019
da0d0d4
Merge branch 'feature/calendar' into feature/calendartests
ScottBTR Nov 20, 2019
ce4343b
Merge branch 'feature/calendartests' into feature/inclusionofandroida…
ScottBTR Nov 20, 2019
091112a
Fixes to bad auto-merge plus add the ability to change the defaultsta…
ScottBTR Nov 20, 2019
8224c6e
Calendar Read-Only API
nickrandolph Dec 4, 2019
a5a8a8c
Return exceptions that match test case System.NotImplementedException…
ScottBTR Dec 5, 2019
3077d00
Merge branch 'feature/readonly-calendar' into feature/inclusionofandr…
ScottBTR Dec 9, 2019
5feb4e1
Merge creation code with current readonly branch
ScottBTR Dec 9, 2019
e19703e
Replicate behaviour accross platforms for getevents when passing in a…
ScottBTR Dec 9, 2019
2810895
Added word to make id more descriptive for comment.
ScottBTR Dec 9, 2019
d5f6c57
Undo space removal.
ScottBTR Dec 9, 2019
93b4356
Remove test code and make code runnable
ScottBTR Dec 9, 2019
f690cde
Adding On Delete Button
ScottBTR Dec 10, 2019
274a2b1
When requesting events for a calendar that does not exist, an excepti…
ScottBTR Dec 10, 2019
4179fbb
Alter test to meet PR feedback. Argument exception when event id is n…
ScottBTR Dec 11, 2019
d18c960
iOS - Should validate the eventId is not null/whitespace prior to ret…
ScottBTR Dec 11, 2019
aeb1d62
No need to catch exceptions if behaviour is to re-throw them
ScottBTR Dec 12, 2019
9944415
Merge pull request #48 from builttoroam/feature/readonly-calendar-pla…
ScottBTR Dec 12, 2019
dac94bd
Merge branch 'feature/readonly-calendar' into feature/inclusionofandr…
ScottBTR Dec 12, 2019
9d0e266
Don't try to verify calendar when no events are found if the calendar…
ScottBTR Dec 12, 2019
26111e3
Allow Creation of Calendars to work cross platform. (iOS still needs …
ScottBTR Dec 12, 2019
999b86b
Replace fake ios calendar event delete code with throw not implemente…
ScottBTR Dec 12, 2019
450bb72
Revert xamarin essential project alterations.
ScottBTR Dec 12, 2019
20c356f
Cross-platform deletion
ScottBTR Dec 13, 2019
69fd0a1
[UWP] - Add/Remove Attendees for Events now functional
ScottBTR Dec 13, 2019
284ed0b
PR Feedback: Reminders aren't implemented at this stage so this chang…
ScottBTR Dec 13, 2019
144e7c5
[Android] Add/Remove attendee from event working, if duplicate attend…
ScottBTR Dec 13, 2019
b57c584
Naming Conventions.
ScottBTR Dec 15, 2019
6648809
undo csproj changes.
ScottBTR Dec 15, 2019
a97192d
Improve user navigation + add remove attendee for iOS
ScottBTR Dec 16, 2019
7460ce7
Merge pull request #53 from builttoroam/feature/readonly-calendar-nam…
ScottBTR Dec 16, 2019
b4c0339
Updates - UWP/workflow
ScottBTR Dec 17, 2019
5011b83
ios: Update Add Attendee with details about ios limitations, fix add …
ScottBTR Dec 17, 2019
d1dc2cf
Android/ios/uwp Calendar creation and Event creation/update/delete no…
ScottBTR Dec 17, 2019
a645717
Fix android not being able to remove attendees
ScottBTR Dec 17, 2019
25847a1
[iOS]: Add Commented code that shows the idea behind removing attendees
ScottBTR Dec 17, 2019
6b6d324
Fix formatting of event page and add calendar title when editing an e…
ScottBTR Dec 17, 2019
90e7436
Split Create and Update into two functions to create separation of co…
ScottBTR Dec 17, 2019
3860dd1
Attendance required status can now be set and visible by color
ScottBTR Dec 18, 2019
ce68037
Recurrence Rule Changes
ScottBTR Dec 18, 2019
5d5eb02
Added a basis for Rules/Reminder retrieval
ScottBTR Dec 19, 2019
8356245
Bring accross UI code for displaying Recurrence Rules
ScottBTR Jan 5, 2020
32139fb
Allow Recurrence Rules to be Updated for UWP (plus some other require…
ScottBTR Jan 6, 2020
4fc3d29
Recognition of month week+day offset for UWP
ScottBTR Jan 6, 2020
e6c46b0
UWP: Create and Update working to a degree, collection view still req…
ScottBTR Jan 7, 2020
ec8a1e7
UWP+Android+Ios - Can allow for an optional end date, so I've added s…
ScottBTR Jan 7, 2020
48c9237
Using new UWP recurrence rule model
ScottBTR Jan 7, 2020
6f83573
Converted CollectionView of Observable collection to use Switches
ScottBTR Jan 8, 2020
8ae75b7
Added crossplatform URI field
ScottBTR Jan 8, 2020
b0a5c23
Code Tidy up
ScottBTR Jan 8, 2020
93740b2
UI more Mobile Friendly
ScottBTR Jan 8, 2020
47b42a3
Include the Appointment Organizer in list of Attendees
ScottBTR Jan 8, 2020
8fd3702
Changes to be more consistent with our OSs
ScottBTR Jan 9, 2020
c2f1913
Updating to UI and initial set up for iOS
ScottBTR Jan 9, 2020
17d4e5a
Updates to UI and cross-platform attendee types implemented
ScottBTR Jan 10, 2020
3337f0e
Android fixes, plus timezone fixes for android + iOS
ScottBTR Jan 13, 2020
e0c5a25
Updates
ScottBTR Jan 13, 2020
cbf3e4e
Get TimeZones && Recurrence Rule Frequencies working more reliably ac…
ScottBTR Jan 14, 2020
275a830
Meeting PR Feedback
ScottBTR Jan 14, 2020
370a047
Fix binding issue caused by bad conversion between class and enum + a…
ScottBTR Jan 14, 2020
a9146b4
Changes List below:
ScottBTR Jan 15, 2020
34efc82
Set up for some expected pass test cases, will be refactored at a lat…
ScottBTR Jan 15, 2020
399943f
PR feedback alterations.
ScottBTR Jan 21, 2020
a04a8e9
Merge pull request #55 from builttoroam/feature/calendar-recurrence-r…
ScottBTR Jan 21, 2020
f561ba0
Merge pull request #54 from builttoroam/feature/calendar-attendees
ScottBTR Jan 21, 2020
4b97471
Add Share Source Position (#1002)
Redth Dec 9, 2019
022f9cf
Rename GetCompliment to GetComplementary (#1016)
mrlacey Dec 12, 2019
80b0d05
Update Xamarin.Essentials.csproj
jamesmontemagno Dec 12, 2019
ded9811
Fix issue with checking mainthread to early on UWP. (#1021)
jamesmontemagno Dec 13, 2019
9ec706e
Update FileSystem.xml (#1015)
jamesmontemagno Dec 13, 2019
baace4c
Cleanup permissions check for Geolocation (#1022)
jamesmontemagno Dec 14, 2019
676c2fb
Cleanup equals in IEquatable so no boxing occurs. (#1019)
jamesmontemagno Dec 15, 2019
c539545
[WIP] GH-923 Implement AppTheme for iOS/tvOS/Android/UWP (Need Tizen …
jamesmontemagno Dec 16, 2019
035268e
Fixes #990 - only pull in utils when needed (#1033)
jamesmontemagno Dec 18, 2019
9029388
Update azure-pipelines.yml
jamesmontemagno Dec 18, 2019
5d80674
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
f2910ac
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
eb99dad
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
39b564f
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
2dfb373
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
48e0522
GH-969 Clipboard Changed (#720)
Dec 19, 2019
5893132
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
3e6f510
Update azure-pipelines.yml for Azure Pipelines
Redth Dec 19, 2019
96472a3
Disable the pesky comments?
Redth Dec 19, 2019
906042f
Update azure-pipelines.yml
Redth Dec 19, 2019
61ca02b
Permissions API (#949)
Redth Dec 19, 2019
cd4c817
First attempt at cellular data on iOS fix (#1034)
jamesmontemagno Dec 19, 2019
a22d4ea
Read-only Calendar API (#46)
ScottBTR Dec 5, 2019
6f1aba7
Fixing up permissions usage
nickrandolph Dec 24, 2019
832300a
Merging in naming convention changes + Fixing permissions not accepti…
ScottBTR Jan 22, 2020
1ce7bcb
Merge branch 'feature/bridge-naming-convention-changes' of https://gi…
ScottBTR Jan 22, 2020
cb125ac
Remove old-named folder + undo uwp upgrades.
ScottBTR Jan 22, 2020
10e2595
Merge branch 'feature/bridge-naming-convention-changes' into feature/…
ScottBTR Jan 22, 2020
59f3d39
Merge in permission and name convention changes brought in during rea…
ScottBTR Jan 22, 2020
9cd6983
Merge branch 'temp/test_merge_write_calendar' into feature/merge-read…
nickrandolph Jan 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.BATTERY_STATS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.INTERNET" />
Expand Down
390 changes: 390 additions & 0 deletions DeviceTests/DeviceTests.Shared/Calendar_Tests.cs

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Samples/Samples.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-feature android:name="android.hardware.location" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
<uses-feature android:name="android.hardware.location.network" android:required="false" />
Expand Down
32 changes: 32 additions & 0 deletions Samples/Samples/Converters/AttendeeRequiredColorConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace Samples.Converters
{
public class AttendeeRequiredColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (!(value is AttendeeType attendeeType))
{
return Color.PaleVioletRed;
}

switch (attendeeType)
{
case AttendeeType.Required:
return Color.LightGoldenrodYellow;
case AttendeeType.Resource:
return Color.PaleGreen;
default:
return Color.LightGray;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
}
32 changes: 32 additions & 0 deletions Samples/Samples/Converters/RecurrenceEndTypeToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using Samples.ViewModel;
using Xamarin.Forms;

namespace Samples.Converters
{
public class RecurrenceEndTypeToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || !(value is string type))
{
return false;
}
switch (type)
{
case RecurrenceEndType.AfterOccurences:
return true;
case RecurrenceEndType.UntilEndDate:
case RecurrenceEndType.Indefinitely:
default:
return false;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
86 changes: 86 additions & 0 deletions Samples/Samples/Converters/RecurrenceRuleTextConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using Xamarin.Essentials;
using Xamarin.Forms;

namespace Samples.Converters
{
public class RecurrenceRuleTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || !(value is RecurrenceRule rule))
return null;

var toReturn = $"Occurs ";

if (rule.Interval > 0)
{
if (rule.Interval == 1)
{
toReturn += $"Every ";
}
else
{
toReturn += $"Every {((int)rule.Interval).ToOrdinal()} ";
}
switch (rule.Frequency)
{
case RecurrenceFrequency.Daily:
toReturn += "Day ";
break;
case RecurrenceFrequency.Weekly:
toReturn += "Week ";
break;
case RecurrenceFrequency.Monthly:
case RecurrenceFrequency.MonthlyOnDay:
toReturn += "Month ";
break;
case RecurrenceFrequency.Yearly:
case RecurrenceFrequency.YearlyOnDay:
toReturn += "Year ";
break;
default:
throw new ArgumentOutOfRangeException();
}
}

if (rule.WeekOfMonth != null && (rule.Frequency == RecurrenceFrequency.MonthlyOnDay || rule.Frequency == RecurrenceFrequency.YearlyOnDay))
{
toReturn += $"on the {rule.WeekOfMonth} ";
if (rule.DaysOfTheWeek?.Count > 0)
{
toReturn += $"[";
toReturn = rule.DaysOfTheWeek.Aggregate(toReturn, (current, d) => current + $"{d}, ");
toReturn = toReturn.Substring(0, toReturn.Length - 2) + "] ";
}
if (rule.Frequency == RecurrenceFrequency.YearlyOnDay)
{
toReturn += $"in {rule.MonthOfTheYear.ToString()} ";
}
}
else if (rule.DaysOfTheWeek?.Count > 0)
{
toReturn += $"On: [";
toReturn = rule.DaysOfTheWeek.Aggregate(toReturn, (current, d) => current + $"{d}, ");
toReturn = toReturn.Substring(0, toReturn.Length - 2) + "] ";
}

if (rule.TotalOccurrences > 0)
{
toReturn += $"For the next {rule.TotalOccurrences} occurrences ";
}

if (rule.EndDate.HasValue)
{
toReturn += $"Until {rule.EndDate.Value.DateTime.ToShortDateString()} ";
}

return toReturn;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
}
32 changes: 32 additions & 0 deletions Samples/Samples/Converters/RecurrenceUntilTypeToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.Globalization;
using Samples.ViewModel;
using Xamarin.Forms;

namespace Samples.Converters
{
public class RecurrenceUntilTypeToBoolConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || !(value is string type))
{
return false;
}
switch (type)
{
case RecurrenceEndType.UntilEndDate:
return true;
case RecurrenceEndType.Indefinitely:
case RecurrenceEndType.AfterOccurences:
default:
return false;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
19 changes: 19 additions & 0 deletions Samples/Samples/Converters/ReminderTextConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Globalization;
using Xamarin.Forms;

namespace Samples.Converters
{
public class ReminderTextConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || !(value is int minutes))
return null;

return minutes > 0 ? $"{minutes} minutes prior" : "No Reminders";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
}
20 changes: 20 additions & 0 deletions Samples/Samples/Converters/StartWidthDisplayConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Globalization;
using Xamarin.Forms;

namespace Samples.Converters
{
public class StartWidthDisplayConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || !(value is bool b))
{
return 1;
}
return b ? 3 : 1;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}
}
31 changes: 31 additions & 0 deletions Samples/Samples/View/CalendarAddPage.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<views:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:views="clr-namespace:Samples.View"
xmlns:viewmodels="clr-namespace:Samples.ViewModel"
xmlns:essentials="clr-namespace:Xamarin.Essentials;assembly=Xamarin.Essentials"
xmlns:converters="clr-namespace:Samples.Converters;assembly=Samples"
x:Class="Samples.View.CalendarAddPage"
x:DataType="viewmodels:CalendarAddViewModel"
Title="CalendarAddPage"
Padding="20,20,20,20">
<views:BasePage.Content>
<StackLayout>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label Text="Title"
HorizontalTextAlignment="Center"
Grid.Column="0"/>
<Entry Placeholder="Title..."
Text="{Binding CalendarName}"
Grid.Column="1"/>
</Grid>
<Button Text="Add Calendar"
Command="{Binding CreateCalendar}"
IsEnabled="{Binding CanCreateCalendar}"/>
</StackLayout>
</views:BasePage.Content>
</views:BasePage>
10 changes: 10 additions & 0 deletions Samples/Samples/View/CalendarAddPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace Samples.View
{
public partial class CalendarAddPage : BasePage
{
public CalendarAddPage()
{
InitializeComponent();
}
}
}
Loading