GamaLearn.Maui.Core API Reference
Comprehensive API documentation for GamaLearn.Maui.Core library - essential utilities and foundational components for .NET MAUI applications.
📚 API Reference by Category
🔄 Threading & Utilities
Utilities for managing asynchronous operations and UI thread synchronization.
Debouncer - Delay method execution until a pause in calls
- Perfect for search-as-you-type scenarios
- Prevents excessive API calls or UI updates
Throttler - Limit method execution frequency
- Rate-limit expensive operations
- Prevent overwhelming APIs or resources
DispatchHelper - UI thread dispatching utilities
- Safely execute code on the main thread
- Thread-safe UI updates from background threads
TaskExtensions - Task utility extension methods
- Fire-and-forget task execution
- Timeout handling
- UI thread continuations
📦 Collections
High-performance observable collections with advanced features.
ObservableRangeCollection<T> - Observable collection with bulk operations
- Add/remove multiple items with single notification
- Replace entire collection efficiently
- Significantly improves UI performance with large datasets
ReactiveCollection<T> - Advanced reactive collection with filtering and sorting
- Real-time filtering and sorting
- Detailed change tracking (add, remove, replace, move)
- Thread-safe operations
- Automatic UI updates via binding
- Perfect for dynamic lists with search/filter functionality
CollectionExtensions - Collection utility extension methods
- Bulk operations
- Null-safe operations
- LINQ integration helpers
✅ Validation
Robust argument validation and guard clauses.
- Guard - Argument validation utilities
- Guard against null, empty strings, out-of-range values
- Fluent API:
Guard.Against.Null(value, nameof(value)) - Clear exception messages
- Reduces boilerplate validation code
🌟 Services
Cross-platform services for common app scenarios.
AppRatingService - Cross-platform in-app rating prompts
- Native rating dialogs on iOS, Android, macOS, Windows
- Configurable trigger logic (session counts, days elapsed)
- Respectful rating prompts (honors user preferences)
- Full event tracking for analytics
BatteryService - Battery level and status monitoring
- Real-time battery level and charging state
- Power source detection (AC, battery, wireless)
- Energy saver status monitoring
- Battery change events for reactive updates
DeviceInfoService - Device information and characteristics
- Device model, manufacturer, and platform details
- Device type detection (phone, tablet, desktop)
- Platform-specific version information
- Stable device identification for analytics
🎨 Extensions
Extension methods for common tasks and utilities.
- ColorExtensions - Color manipulation and utilities
- Lighten, darken, and blend colors
- Alpha channel manipulation
- Luminance calculation and contrast checking
- Hex color parsing and formatting
- Accessibility helpers for text contrast
📱 Platform Helpers
Cross-platform helpers for device-specific features.
SafeAreaHelper - Safe area insets management
- Get safe area insets for notches and system UI
- Automatic padding adjustment for views
- Status bar and navigation bar height detection
- Support for display cutouts and rounded corners
KeyboardHelper - Keyboard control and monitoring
- Show and hide soft keyboard programmatically
- Get current keyboard height
- Keyboard visibility events
- Platform-specific keyboard handling
🔗 Quick Links
- Getting Started Guide - Installation and quick start
- GitHub Repository - Source code and issues
- NuGet Package - Latest releases
🖥️ Platform Support
All components are designed for cross-platform compatibility:
| Platform | Support | Notes |
|---|---|---|
| Android | ✅ Full | API 26+ (Android 8.0+) |
| iOS | ✅ Full | iOS 15.0+ |
| MacCatalyst | ✅ Full | macOS 11.0+ |
| Windows | ✅ Full | Windows 10 (Build 19041+) |
Requirements
- .NET 9.0 or later
- .NET MAUI workload installed
- Target framework:
net9.0-android,net9.0-ios,net9.0-maccatalyst,net9.0-windows
💡 Usage Examples
Debouncing Search Input
var debouncer = new Debouncer();
// Delay search until user stops typing for 300ms
await debouncer.DebounceAsync(async () =>
{
await PerformSearchAsync(searchText);
}, TimeSpan.FromMilliseconds(300));
Reactive Collection with Filtering
var products = new ReactiveCollection<Product>();
products.Load(allProducts);
// Apply filter - UI updates automatically
products.Filter(p => p.IsInStock && p.Price < 100);
// Bind in XAML: ItemsSource="{Binding Products.View}"
Bulk Collection Updates
var items = new ObservableRangeCollection<string>();
// Single notification for multiple items
items.AddRange(new[] { "Item1", "Item2", "Item3" });
items.ReplaceRange(newItems);
Argument Validation
public void ProcessData(string name, int count)
{
Guard.Against.NullOrWhiteSpace(name, nameof(name));
Guard.Against.NegativeOrZero(count, nameof(count));
// Process safely...
}
📖 Additional Resources
- Samples - Example applications
- Contributing Guide - How to contribute
- Release Notes - What's new
© GamaLearn - All rights reserved