Add ShellDemo sample with comprehensive XAML controls showcase
Complete ShellDemo application demonstrating all MAUI controls: - App/AppShell: Shell navigation with flyout menu - HomePage: Feature cards, theme toggle, quick actions - ButtonsPage: Button styles, states, variations, event logging - TextInputPage: Entry, Editor, SearchBar with keyboard shortcuts - SelectionPage: CheckBox, Switch, Slider with colored variants - PickersPage: Picker, DatePicker, TimePicker demos - ListsPage: CollectionView with fruits, colors, contacts - ProgressPage: ProgressBar, ActivityIndicator, interactive demo - GridsPage: Grid layouts - auto/star/absolute sizing, spans, nesting - AboutPage: OpenMaui Linux information - DetailPage: Push/pop navigation demo All pages use proper XAML with code-behind following MAUI patterns. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
84
samples/ShellDemo/Pages/ProgressPage.xaml.cs
Normal file
84
samples/ShellDemo/Pages/ProgressPage.xaml.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Maui.Controls;
|
||||
|
||||
namespace ShellDemo.Pages;
|
||||
|
||||
public partial class ProgressPage : ContentPage
|
||||
{
|
||||
private int _eventCount = 0;
|
||||
private bool _isAnimating = false;
|
||||
|
||||
public ProgressPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void LogEvent(string message)
|
||||
{
|
||||
_eventCount++;
|
||||
var timestamp = DateTime.Now.ToString("HH:mm:ss");
|
||||
EventLog.Text = $"[{timestamp}] {_eventCount}. {message}\n{EventLog.Text}";
|
||||
}
|
||||
|
||||
private void OnToggleIndicatorClicked(object? sender, EventArgs e)
|
||||
{
|
||||
ToggleIndicator.IsRunning = !ToggleIndicator.IsRunning;
|
||||
LogEvent($"ActivityIndicator: {(ToggleIndicator.IsRunning ? "Started" : "Stopped")}");
|
||||
}
|
||||
|
||||
private void OnProgressSliderChanged(object? sender, ValueChangedEventArgs e)
|
||||
{
|
||||
var value = e.NewValue / 100.0;
|
||||
AnimatedProgress.Progress = value;
|
||||
ProgressLabel.Text = $"Progress: {e.NewValue:0}%";
|
||||
}
|
||||
|
||||
private void OnResetClicked(object? sender, EventArgs e)
|
||||
{
|
||||
AnimatedProgress.Progress = 0;
|
||||
ProgressSlider.Value = 0;
|
||||
LogEvent("Progress reset to 0%");
|
||||
}
|
||||
|
||||
private async void OnAnimateClicked(object? sender, EventArgs e)
|
||||
{
|
||||
if (_isAnimating) return;
|
||||
_isAnimating = true;
|
||||
LogEvent("Animation started");
|
||||
|
||||
for (int i = (int)ProgressSlider.Value; i <= 100; i += 5)
|
||||
{
|
||||
AnimatedProgress.Progress = i / 100.0;
|
||||
ProgressSlider.Value = i;
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
_isAnimating = false;
|
||||
LogEvent("Animation completed");
|
||||
}
|
||||
|
||||
private async void OnSimulateClicked(object? sender, EventArgs e)
|
||||
{
|
||||
if (_isAnimating) return;
|
||||
_isAnimating = true;
|
||||
LogEvent("Download simulation started");
|
||||
|
||||
AnimatedProgress.Progress = 0;
|
||||
ProgressSlider.Value = 0;
|
||||
|
||||
var random = new Random();
|
||||
double progress = 0;
|
||||
while (progress < 1.0)
|
||||
{
|
||||
progress += random.NextDouble() * 0.1;
|
||||
if (progress > 1.0) progress = 1.0;
|
||||
AnimatedProgress.Progress = progress;
|
||||
ProgressSlider.Value = progress * 100;
|
||||
await Task.Delay(200 + random.Next(300));
|
||||
}
|
||||
|
||||
_isAnimating = false;
|
||||
LogEvent("Download simulation completed");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user