Siticone Circular Battery Indicator
The SiticoneCircularBatteryIndicator is a specialized radial gauge designed specifically for power monitoring applications.
It features built-in state logic (Charging, Critical, Full), health tracking, and visual alerts for low battery conditions.
Charge & Capacity
Core properties for managing battery levels and state.
| Property | Type | Description & Usage Example |
|---|---|---|
ChargeLevel |
double | battery.ChargeLevel = 85.5; Current battery charge. Setting this triggers state checks (e.g., auto-switch to Critical if low). |
MaxCapacity |
double | battery.MaxCapacity = 5000; Total battery capacity (mAh or Wh). Default is 100 for percentage-based usage. |
BatteryState |
BatteryState |
battery.BatteryState = BatteryState.Charging;
Current power state. Options: Discharging, Charging, Full, Critical, PowerSaving.
|
BatteryType |
BatteryType |
battery.BatteryType = BatteryType.LithiumIon;
Used for label display. Options: LithiumIon, LeadAcid, NiMH, etc.
|
Visual Style
Customize the indicator's look, including colors for different charge states.
| Property | Type | Description & Usage Example |
|---|---|---|
DesignStyle |
DesignStyle |
battery.DesignStyle = BatteryIndicatorDesignStyle.RainBow;
Solid: Single color based on state.RainBow: Gradient color based on percentage.Animated: Cycling color animation.
|
FullChargeColor |
Color | battery.FullChargeColor = Color.Green; Color used when charge is high (>70%). |
MediumChargeColor |
Color | battery.MediumChargeColor = Color.Orange; Color used when charge is medium (30-70%). |
LowChargeColor |
Color | battery.LowChargeColor = Color.Red; Color used when charge is critical (<20%). |
ChargingColor |
Color | battery.ChargingColor = Color.Blue; Color used when state is Charging. |
ShowChargingIndicator |
bool | battery.ShowChargingIndicator = true; Displays a lightning bolt icon when charging. |
Alerts & Thresholds
Configure automatic state transitions based on charge percentage.
| Property | Type | Description & Usage Example |
|---|---|---|
LowBatteryThreshold |
double | battery.LowBatteryThreshold = 20; Percentage at which to trigger "Low Battery" alerts and color change. |
CriticalBatteryThreshold |
double | battery.CriticalBatteryThreshold = 10; Percentage at which to trigger "Critical" alerts. |
EnableBatteryAlerts |
bool |
battery.EnableBatteryAlerts = true;
Fires the BatteryLevelAlert event when thresholds are crossed.
|
Public Methods
// Sets state to Charging and records start time.
battery.StartCharging(ChargingSpeed.Fast);
// Sets state to Discharging (or Full if 100%).
battery.StopCharging();
// Returns TimeSpan since charging started.
TimeSpan duration = battery.GetChargingDuration();
Events
// 1. BatteryLevelAlert Event
// Fires when charge drops below Low or Critical thresholds.
battery.BatteryLevelAlert += (s, e) =>
{
if (e.IsEnteringAlert)
MessageBox.Show($"Warning: {e.AlertMessage}");
};
// 2. BatteryStateChanged Event
// Fires when switching between Charging, Discharging, etc.
battery.BatteryStateChanged += (s, e) =>
{
lblStatus.Text = e.StateMessage;
};
// 3. ChargingCompleted Event
// Fires when a charging session reaches 100%.
battery.ChargingCompleted += (s, e) =>
{
Console.WriteLine($"Full charge in {e.ChargingDuration.TotalMinutes} mins");
};
Designer & Smart Tags
Quickly configure battery types and simulation modes in Visual Studio.
| Feature | Description |
|---|---|
Battery Presets |
Smartphone: Standard Li-ion look. Laptop: Rainbow gradient style. EV: Animated charging style. PowerBank: Multi-segment look. |
Simulation |
Start/Stop Charging: Test visual states. Simulate Low/Full: Instantly set levels to test alerts. |
Detailed Usage Examples
Example 1: Mobile Device Battery
A standard indicator for a phone or tablet application.
private void SetupPhoneBattery()
{
battery.BatteryType = BatteryType.LithiumPolymer;
battery.DesignStyle = BatteryIndicatorDesignStyle.Solid;
battery.ShowChargingIndicator = true;
// Alerts
battery.LowBatteryThreshold = 15;
battery.CriticalBatteryThreshold = 5;
battery.BatteryLevelAlert += (s, e) =>
{
if (e.AlertLevel == "critical") EnablePowerSavingMode();
};
}
Example 2: EV Charging Monitor
Uses animation to show active charging status for an electric vehicle.
private void SetupEVCharger()
{
battery.BatteryType = BatteryType.LithiumIon;
battery.DesignStyle = BatteryIndicatorDesignStyle.Animated;
battery.MaxCapacity = 75000; // 75 kWh
battery.ChargeLevelFormat = "0.0 kWh";
// Start Charging
battery.StartCharging(ChargingSpeed.SuperFast);
}