Skip to content

Commit 35740f6

Browse files
authored
Merge pull request #10 from SyncfusionExamples/Scheduler_SampleIntegrated
Special time region customization sample
2 parents dc91f2a + 5948585 commit 35740f6

156 files changed

Lines changed: 5774 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

RecurringAppointment/App.xaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Application
2+
x:Class="RecurringAppointment.App"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:RecurringAppointment">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" />
10+
<!-- Other merged dictionaries here -->
11+
</ResourceDictionary.MergedDictionaries>
12+
<!-- Other app resources here -->
13+
</ResourceDictionary>
14+
</Application.Resources>
15+
</Application>

RecurringAppointment/App.xaml.cs

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Runtime.InteropServices.WindowsRuntime;
6+
using Windows.ApplicationModel;
7+
using Windows.ApplicationModel.Activation;
8+
using Windows.Foundation;
9+
using Windows.Foundation.Collections;
10+
using Microsoft.UI.Xaml;
11+
using Microsoft.UI.Xaml.Controls;
12+
using Microsoft.UI.Xaml.Controls.Primitives;
13+
using Microsoft.UI.Xaml.Data;
14+
using Microsoft.UI.Xaml.Input;
15+
using Microsoft.UI.Xaml.Media;
16+
using Microsoft.UI.Xaml.Navigation;
17+
18+
// To learn more about WinUI, the WinUI project structure,
19+
// and more about our project templates, see: http://aka.ms/winui-project-info.
20+
21+
namespace RecurringAppointment
22+
{
23+
/// <summary>
24+
/// Provides application-specific behavior to supplement the default Application class.
25+
/// </summary>
26+
sealed partial class App : Application
27+
{
28+
/// <summary>
29+
/// Initializes the singleton application object. This is the first line of authored code
30+
/// executed, and as such is the logical equivalent of main() or WinMain().
31+
/// </summary>
32+
public App()
33+
{
34+
this.InitializeComponent();
35+
#if !WinUI_Desktop
36+
this.Suspending += OnSuspending;
37+
#endif
38+
}
39+
40+
#if WinUI_Desktop
41+
/// <summary>
42+
/// Invoked when the application is launched normally by the end user. Other entry points
43+
/// will be used such as when the application is launched to open a specific file.
44+
/// </summary>
45+
/// <param name="args">Details about the launch request and process.</param>
46+
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
47+
{
48+
m_window = new MainWindow();
49+
m_window.Activate();
50+
}
51+
#else
52+
/// <summary>
53+
/// Invoked when the application is launched normally by the end user. Other entry points
54+
/// will be used such as when the application is launched to open a specific file.
55+
/// </summary>
56+
/// <param name="e">Details about the launch request and process.</param>
57+
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs e)
58+
{
59+
Frame rootFrame = Window.Current.Content as Frame;
60+
61+
// Do not repeat app initialization when the Window already has content,
62+
// just ensure that the window is active
63+
if (rootFrame == null)
64+
{
65+
// Create a Frame to act as the navigation context and navigate to the first page
66+
rootFrame = new Frame();
67+
68+
rootFrame.NavigationFailed += OnNavigationFailed;
69+
70+
if (e.UWPLaunchActivatedEventArgs.PreviousExecutionState == ApplicationExecutionState.Terminated)
71+
{
72+
//TODO: Load state from previously suspended application
73+
}
74+
75+
// Place the frame in the current Window
76+
Window.Current.Content = rootFrame;
77+
}
78+
79+
if (e.UWPLaunchActivatedEventArgs.PrelaunchActivated == false)
80+
{
81+
if (rootFrame.Content == null)
82+
{
83+
// When the navigation stack isn't restored navigate to the first page,
84+
// configuring the new page by passing required information as a navigation
85+
// parameter
86+
rootFrame.Navigate(typeof(MainPage), e.Arguments);
87+
}
88+
// Ensure the current window is active
89+
Window.Current.Activate();
90+
}
91+
}
92+
93+
/// <summary>
94+
/// Invoked when Navigation to a certain page fails
95+
/// </summary>
96+
/// <param name="sender">The Frame which failed navigation</param>
97+
/// <param name="e">Details about the navigation failure</param>
98+
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
99+
{
100+
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
101+
}
102+
103+
#endif
104+
105+
#if WinUI_Desktop
106+
/// <summary>
107+
/// Invoked when application execution is being suspended. Application state is saved
108+
/// without knowing whether the application will be terminated or resumed with the contents
109+
/// of memory still intact.
110+
/// </summary>
111+
/// <param name="sender">The source of the suspend request.</param>
112+
/// <param name="e">Details about the suspend request.</param>
113+
private void OnSuspending(object sender, SuspendingEventArgs e)
114+
{
115+
// Save application state and stop any background activity
116+
}
117+
private Window m_window;
118+
#else
119+
/// <summary>
120+
/// Invoked when application execution is being suspended. Application state is saved
121+
/// without knowing whether the application will be terminated or resumed with the contents
122+
/// of memory still intact.
123+
/// </summary>
124+
/// <param name="sender">The source of the suspend request.</param>
125+
/// <param name="e">Details about the suspend request.</param>
126+
private void OnSuspending(object sender, SuspendingEventArgs e)
127+
{
128+
var deferral = e.SuspendingOperation.GetDeferral();
129+
//TODO: Save application state and stop any background activity
130+
deferral.Complete();
131+
}
132+
#endif
133+
}
134+
}
1.4 KB
Loading
7.52 KB
Loading
2.87 KB
Loading
1.61 KB
Loading
1.23 KB
Loading
1.42 KB
Loading
3.13 KB
Loading

RecurringAppointment/MainPage.xaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<Page
2+
x:Class="RecurringAppointment.MainPage"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:local="using:RecurringAppointment"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
mc:Ignorable="d"
9+
xmlns:scheduler="using:Syncfusion.UI.Xaml.Scheduler"
10+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
11+
12+
<Page.DataContext>
13+
<local:RecurringAppointmentViewModel/>
14+
</Page.DataContext>
15+
16+
<Grid>
17+
<scheduler:SfScheduler x:Name="scheduler"
18+
ItemsSource="{Binding RecursiveAppointmentCollection}"
19+
ViewType="{Binding ElementName=viewtypecombobox, Path=SelectedValue,Mode=TwoWay}">
20+
<scheduler:SfScheduler.AppointmentMapping>
21+
<scheduler:AppointmentMapping
22+
Subject="EventName"
23+
StartTime="From"
24+
EndTime="To"
25+
AppointmentBackground="Color"
26+
Foreground="ForegroundColor"
27+
IsAllDay="IsAllDay"
28+
StartTimeZone="StartTimeZone"
29+
EndTimeZone="EndTimeZone"
30+
RecurrenceRule="RecurrenceRule"
31+
RecurrenceId="RecurrenceId"
32+
Id="Id"/>
33+
</scheduler:SfScheduler.AppointmentMapping>
34+
<scheduler:SfScheduler.MonthViewSettings>
35+
<scheduler:MonthViewSettings AppointmentDisplayMode="Appointment"
36+
AppointmentDisplayCount="2"/>
37+
</scheduler:SfScheduler.MonthViewSettings>
38+
</scheduler:SfScheduler>
39+
40+
<StackPanel Orientation="Horizontal"
41+
HorizontalAlignment="Right"
42+
VerticalAlignment="Top"
43+
Margin="0,5,10,0">
44+
<ComboBox Width="180" Height="30" x:Name="viewtypecombobox" SelectedIndex="2"/>
45+
</StackPanel>
46+
</Grid>
47+
</Page>

0 commit comments

Comments
 (0)