builttoroam / device_calendar

A cross platform plugin for modifying calendars on the user's device
https://pub.dev/packages/device_calendar
BSD 3-Clause "New" or "Revised" License
267 stars 267 forks source link

Windows support #479

Closed kingvhit closed 1 year ago

kingvhit commented 1 year ago

Is your feature request related to a problem? Please describe. The device_calendar for now support almost environment, and I think that is possible todo it on Windows (start from Windows 10 and above)

Describe the solution you'd like I am not Windows app developer, however, It might bellow is good solution for entry point when we implement in Windows App.

On main entry point, we can include the Appointment namesapce though winrt

#include <windows.h>
#include <winrt/Windows.ApplicationModel.Appointments.h>
#include <winrt/Windows.Foundation.Collections.h>

using namespace winrt;
using namespace Windows::ApplicationModel::Appointments;
using namespace Windows::Foundation::Collections;

int main()
{
    CoInitializeEx(nullptr, COINIT_MULTITHREADED);
    RoInitialize(RO_INIT_MULTITHREADED);

    // ...
}

Then, we can create AppointmentManager

    auto activationFactory = get_activation_factory<AppointmentManager>();
    auto appointmentManager = activationFactory.as<AppointmentManager>();

Then, we can get all device calendar with bellow methods.

    auto appointmentStore = appointmentManager.RequestStoreAsync(AppointmentStoreAccessType::AllCalendarsReadOnly).get();

That is just idea, not tested yet. Additionally, we can do more with that namespace. Reference https://github.com/TheAlmightyBob/Calendars/blob/master/Calendars/Calendars.Plugin.UWP/CalendarsImplementation.cs

Describe alternatives you've considered I am not expert in Windows, still investigate, but if someone know anything, we can contribute together.

IVLIVS-III commented 1 year ago

Hi @kingvhit did you close this issue by accident or are you no longer interested in Windows support?