98 lines
3.1 KiB
C#
98 lines
3.1 KiB
C#
using MarketAlly.SpotlightTour.Maui;
|
|
using MarketAlly.SpotlightTour.Maui.Animations;
|
|
|
|
namespace Test.SpotlightTour;
|
|
|
|
public partial class MainPage : ContentPage
|
|
{
|
|
private const string HasSeenTourKey = "MainPage_HasSeenTour";
|
|
private bool _hasCheckedFirstRun;
|
|
|
|
public MainPage()
|
|
{
|
|
InitializeComponent();
|
|
|
|
// Configure animations for a polished experience
|
|
TourHost.AnimationConfiguration = new AnimationConfiguration
|
|
{
|
|
CalloutEntrance = EntranceAnimation.SlideUpFade,
|
|
NavigatorEntrance = EntranceAnimation.SlideFromRight,
|
|
OverlayEntrance = EntranceAnimation.FadeIn,
|
|
SpotlightEffect = SpotlightEffect.Pulse,
|
|
StepTransition = StepTransition.Slide,
|
|
EntranceEasing = AnimationEasing.CubicInOut,
|
|
EntranceDurationMs = 350,
|
|
ExitDurationMs = 250
|
|
};
|
|
}
|
|
|
|
protected override async void OnAppearing()
|
|
{
|
|
base.OnAppearing();
|
|
|
|
// Show tour on first visit
|
|
if (!_hasCheckedFirstRun)
|
|
{
|
|
_hasCheckedFirstRun = true;
|
|
|
|
// Small delay to let the page fully render
|
|
await Task.Delay(500);
|
|
|
|
if (!Preferences.Get(HasSeenTourKey, false))
|
|
{
|
|
await StartWelcomeTourAsync();
|
|
}
|
|
}
|
|
}
|
|
|
|
private async Task StartWelcomeTourAsync()
|
|
{
|
|
var result = await TourHost.StartTourWithIntroAsync(this.Content);
|
|
|
|
if (result == TourResult.Completed)
|
|
{
|
|
Preferences.Set(HasSeenTourKey, true);
|
|
}
|
|
}
|
|
|
|
private async void OnTakeTourClicked(object? sender, EventArgs e)
|
|
{
|
|
await TourHost.StartTourWithIntroAsync(this.Content);
|
|
}
|
|
|
|
private async void OnIntroStartClicked(object? sender, EventArgs e)
|
|
{
|
|
await TourHost.DismissIntroAsync();
|
|
}
|
|
|
|
private async void OnBasicTourTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//BasicTourPage");
|
|
|
|
private async void OnShapesTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//ShapesPage");
|
|
|
|
private async void OnAutoStartTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//AutoStartPage");
|
|
|
|
private async void OnScrollDemoTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//ScrollDemoPage");
|
|
|
|
private async void OnDisplayModesTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//DisplayModesPage");
|
|
|
|
private async void OnPositioningModesTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//PositioningModesPage");
|
|
|
|
private async void OnThemesTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//ThemesPage");
|
|
|
|
private async void OnIntroTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//IntroPage");
|
|
|
|
private async void OnAnimationsTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//AnimationsPage");
|
|
|
|
private async void OnStepActionsTapped(object? sender, EventArgs e)
|
|
=> await Shell.Current.GoToAsync("//StepActionsPage");
|
|
}
|