Events and Callbacks
Provides hooks for external application logic by notifying when key interactions occur, such as state changes and double-click actions.
Overview
Feature Details
Event
Type
Description
Code Examples
Basic Event Integration
using System;
using System.Drawing;
using System.Windows.Forms;
using SiticoneNetFrameworkUI;
namespace EventsDemo
{
public partial class MainForm : Form
{
private SiticonePlayPauseButton playPauseButton;
public MainForm()
{
InitializeComponent();
InitializeEventsDemo();
}
private void InitializeEventsDemo()
{
playPauseButton = new SiticonePlayPauseButton
{
Location = new Point(50, 50),
Size = new Size(80, 80),
IsPlaying = false, // initial state
EnableDoubleClickAction = true,
DoubleClickActionCommand = "Stop"
};
// Subscribe to events
playPauseButton.StateChanged += PlayPauseButton_StateChanged;
playPauseButton.DoubleClickActionExecuted += PlayPauseButton_DoubleClickActionExecuted;
this.Controls.Add(playPauseButton);
}
private void PlayPauseButton_StateChanged(object sender, EventArgs e)
{
// Respond to state changes, such as updating a status label or logging
Console.WriteLine("State changed: IsPlaying = " + playPauseButton.IsPlaying);
}
private void PlayPauseButton_DoubleClickActionExecuted(object sender, EventArgs e)
{
// Execute custom logic on double-click, for example resetting a timer or updating UI elements
MessageBox.Show("Double-click action executed: " + playPauseButton.DoubleClickActionCommand);
}
}
}Advanced Event Handling
Key Points
Aspect
Details
Best Practices
Recommendation
Rationale
Common Pitfalls
Issue
Explanation
Prevention/Remedy
Usage Scenarios
Scenario
Description
Sample Code Reference
Review
Checklist Item
Recommendation
Summary
Additional Sections
Integration Tips
Tip
Explanation
Demo Projects
Demo Feature
Description
Last updated