Skip to content

Commit de50453

Browse files
Integrated RecursiveExceptionAppointment sample
1 parent b01b2bd commit de50453

35 files changed

Lines changed: 1018 additions & 0 deletions
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Application
2+
x:Class="RecursiveExceptionAppointment.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:RecursiveExceptionAppointment">
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>
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 RecursiveExceptionAppointment
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
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<Page
2+
x:Class="RecursiveExceptionAppointment.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:RecursiveExceptionAppointment"
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:SchedulerViewModel/>
14+
</Page.DataContext>
15+
16+
<Grid>
17+
<scheduler:SfScheduler x:Name="scheduler"
18+
ItemsSource="{Binding RecursiveExceptionAppointmentCollection}"
19+
ViewType="{Binding ElementName=viewtypecombobox, Path=SelectedValue,Mode=TwoWay}">
20+
<scheduler:SfScheduler.MonthViewSettings>
21+
<scheduler:MonthViewSettings AppointmentDisplayMode="Appointment"
22+
AppointmentDisplayCount="2"/>
23+
</scheduler:SfScheduler.MonthViewSettings>
24+
</scheduler:SfScheduler>
25+
26+
<StackPanel Orientation="Horizontal"
27+
HorizontalAlignment="Right"
28+
VerticalAlignment="Top"
29+
Margin="0,5,10,0">
30+
<ComboBox Width="180" Height="30" x:Name="viewtypecombobox" SelectedIndex="2"/>
31+
</StackPanel>
32+
</Grid>
33+
34+
</Page>

0 commit comments

Comments
 (0)