Create a new Xamarin Forms application or open your existing application.
Android
If targeting Android:
- Add a reference to MindFusion.Scheduling.dll, MindFusion.Scheduling.Android.dll, MindFusion.Common.dll and MindFusion.Common.Android.dll to your solution's Android project.
- In MainActivity.cs, call MindFusion.Scheduling.Android.Platform.Init after Xamarin initialization code.
C#
Copy Code
|
---|
protected override void OnCreate(Bundle savedInstanceState) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar;
base.OnCreate(savedInstanceState);
Xamarin.Essentials.Platform.Init(this, savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); MindFusion.Scheduling.Android.Platform.Init();
LoadApplication(new App()); } |
iOS
If targeting iOS:
- Add a reference to MindFusion.Scheduling.dll, MindFusion.Scheduling.iOS.dll, MindFusion.Common.dll and MindFusion.Common.iOS.dll to your solution's iOS project.
- In AppDelegate.cs, call MindFusion.Scheduling.iOS.Platform.Init after Xamarin initialization code.
C#
Copy Code
|
---|
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); MindFusion.Scheduling.iOS.Platform.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options); } |
Universal Windows
If targeting UWP:
- Add a reference to MindFusion.Scheduling.dll, MindFusion.Scheduling.Universal.dll, MindFusion.Common.dll and MindFusion.Common.Universal.dll assemblies to your solution's UWP project.
- In App.xaml.cs, call MindFusion.Scheduling.Universal.Platform.Init after Xamarin initialization code.
C#
Copy Code
|
---|
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame();
rootFrame.NavigationFailed += OnNavigationFailed;
Xamarin.Forms.Forms.Init(e); MindFusion.Scheduling.Universal.Platform.Init(); ... } |
Shared project
- Add a reference to MindFusion.Scheduling.dll and MindFusion.Common.dll to the shared Xamarin UI project.
- Open the content page xaml file and add scheduling namespace definition and Calendar instance:
Xaml
Copy Code
|
---|
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:calendar="clr-namespace:MindFusion.Scheduling;assembly=MindFusion.Scheduling" xmlns:local="clr-namespace:MinApp" x:Class="MinApp.MainPage">
<calendar:Calendar x:Name="calendar" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"/>
</ContentPage> |
- In C# code-behind file you can now access members of the Calendar class -
C#
Copy Code
|
---|
public MainPage() { InitializeComponent();
calendar.Date = DateTime.Today;
var appointment = new Appointment(); appointment.StartTime = DateTime.Today; appointment.EndTime = DateTime.Today.AddDays(1); appointment.HeaderText = "Hello, world!";
calendar.Schedule.Items.Add(appointment); } |
Running
From the context menu of the platform project you wish to run select 'Set as StartUp project'. In CPU and target device drop down boxes of Visual Studio select the appropriate device and hit the Run toolbar icon. If there are no compilation or deployment errors, you should see this simple calendar:
