Class LogExporterControl
- Namespace
- SharpConsoleUI.Plugins.DeveloperTools
- Assembly
- SharpConsoleUI.dll
A control that provides log export functionality. Displays an export button and status information about the last export.
public class LogExporterControl : IInteractiveControl, IFocusableControl, IMouseAwareControl, IWindowControl, IDisposable, IDOMPaintable
- Inheritance
-
LogExporterControl
- Implements
- Inherited Members
- Extension Methods
Constructors
LogExporterControl()
Initializes a new instance of the LogExporterControl class.
public LogExporterControl()
Properties
ActualWidth
Gets the actual rendered width of the control.
public int? ActualWidth { get; }
Property Value
- int?
CanFocusWithMouse
Whether this control can receive focus via mouse clicks
public bool CanFocusWithMouse { get; }
Property Value
CanReceiveFocus
Whether this control can receive focus
public bool CanReceiveFocus { get; }
Property Value
Container
Gets or sets the parent container that hosts this control.
public IContainer? Container { get; set; }
Property Value
HasFocus
Gets or sets whether this control currently has keyboard focus.
public bool HasFocus { get; set; }
Property Value
HorizontalAlignment
Gets or sets the horizontal alignment of the control within its container.
public HorizontalAlignment HorizontalAlignment { get; set; }
Property Value
IsEnabled
Gets or sets whether the control is enabled.
public bool IsEnabled { get; set; }
Property Value
Margin
Gets or sets the margin (spacing) around the control.
public Margin Margin { get; set; }
Property Value
Name
Gets or sets the unique name identifier for this control, used for lookup.
public string? Name { get; set; }
Property Value
StickyPosition
Gets or sets whether this control should stick to the top or bottom during scrolling.
public StickyPosition StickyPosition { get; set; }
Property Value
Tag
Gets or sets an arbitrary object value that can be used to store custom data.
public object? Tag { get; set; }
Property Value
VerticalAlignment
Gets or sets the vertical alignment of the control within its container.
public VerticalAlignment VerticalAlignment { get; set; }
Property Value
Visible
Gets or sets whether this control is visible.
public bool Visible { get; set; }
Property Value
WantsMouseEvents
Whether this control wants to receive mouse events
public bool WantsMouseEvents { get; }
Property Value
Width
Gets or sets the fixed width of the control.
public int? Width { get; set; }
Property Value
- int?
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
ExportLogs(string)
Exports logs to the specified file path.
public void ExportLogs(string filePath)
Parameters
filePathstringThe path to export logs to.
ExportLogsAsync()
Exports logs to a file selected via save file dialog.
public Task ExportLogsAsync()
Returns
GetLogicalContentSize()
Gets the logical size of the control's content without rendering.
public Size GetLogicalContentSize()
Returns
- Size
The size representing the content's natural dimensions.
Invalidate()
Marks this control as needing to be re-rendered.
public void Invalidate()
Invalidate(bool)
public void Invalidate(bool contentChanged)
Parameters
contentChangedbool
MeasureDOM(LayoutConstraints)
Measures the control's desired size given the available constraints.
public LayoutSize MeasureDOM(LayoutConstraints constraints)
Parameters
constraintsLayoutConstraintsThe layout constraints (min/max width/height).
Returns
- LayoutSize
The desired size of the control.
PaintDOM(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)
Paints the control's content directly to a CharacterBuffer.
public void PaintDOM(CharacterBuffer buffer, LayoutRect contentRect, LayoutRect clipRect, Color foregroundColor, Color backgroundColor)
Parameters
bufferCharacterBufferThe buffer to paint to.
contentRectLayoutRectclipRectLayoutRectThe clipping rectangle (visible area).
foregroundColorColorbackgroundColorColor
ProcessKey(ConsoleKeyInfo)
Processes a keyboard input event.
public bool ProcessKey(ConsoleKeyInfo keyInfo)
Parameters
keyInfoConsoleKeyInfo
Returns
- bool
True if the key was handled by this control; otherwise, false.
ProcessMouseEvent(MouseEventArgs)
Processes a mouse event for this control
public bool ProcessMouseEvent(MouseEventArgs e)
Parameters
Returns
- bool
True if the event was handled and should not propagate further
SetFocus(bool, FocusReason)
Sets focus to this control
public void SetFocus(bool focused, FocusReason reason)
Parameters
focusedboolreasonFocusReasonThe reason for the focus change
SetLogService(ILogService)
Sets the log service to export logs from.
public void SetLogService(ILogService logService)
Parameters
logServiceILogServiceThe log service instance.
Events
GotFocus
Event fired when the control gains focus
public event EventHandler? GotFocus
Event Type
LogsExported
Raised when logs are successfully exported.
public event EventHandler<LogExportEventArgs>? LogsExported
Event Type
LostFocus
Event fired when the control loses focus
public event EventHandler? LostFocus
Event Type
MouseClick
Event fired when the control is clicked
public event EventHandler<MouseEventArgs>? MouseClick
Event Type
MouseDoubleClick
Event fired when the control is double-clicked
public event EventHandler<MouseEventArgs>? MouseDoubleClick
Event Type
MouseEnter
Event fired when the mouse enters the control area
public event EventHandler<MouseEventArgs>? MouseEnter
Event Type
MouseLeave
Event fired when the mouse leaves the control area
public event EventHandler<MouseEventArgs>? MouseLeave
Event Type
MouseMove
Event fired when the mouse moves over the control
public event EventHandler<MouseEventArgs>? MouseMove