mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-08-11 10:39:42 +00:00
implement all BrowserWindow API Events and the rest of missed functions
This commit is contained in:
File diff suppressed because it is too large
Load Diff
40
ElectronNET.API/Entities/ThumbarButton.cs
Normal file
40
ElectronNET.API/Entities/ThumbarButton.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace ElectronNET.API.Entities
|
||||
{
|
||||
public class ThumbarButton
|
||||
{
|
||||
public string Id { get; internal set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public Action Click { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Control specific states and behaviors of the button. By default, it is ["enabled"].
|
||||
///
|
||||
/// enabled - The button is active and available to the user.
|
||||
/// disabled - The button is disabled.It is present, but has a visual state indicating it will not respond to user action.
|
||||
/// dismissonclick - When the button is clicked, the thumbnail window closes immediately.
|
||||
/// nobackground - Do not draw a button border, use only the image.
|
||||
/// hidden - The button is not shown to the user.
|
||||
/// noninteractive - The button is enabled but not interactive; no pressed button state is drawn.This value is intended for instances where the button is used in a notification.
|
||||
/// </summary>
|
||||
public string[] Flags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The icon showing in thumbnail toolbar.
|
||||
/// </summary>
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The text of the button's tooltip.
|
||||
/// </summary>
|
||||
public string Tooltip { get; set; }
|
||||
|
||||
public ThumbarButton(string icon)
|
||||
{
|
||||
Icon = icon;
|
||||
}
|
||||
}
|
||||
}
|
||||
39
ElectronNET.API/Extensions/ThumbarButtonExtensions.cs
Normal file
39
ElectronNET.API/Extensions/ThumbarButtonExtensions.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using ElectronNET.API.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ElectronNET.API.Extensions
|
||||
{
|
||||
internal static class ThumbarButtonExtensions
|
||||
{
|
||||
public static ThumbarButton[] AddThumbarButtonsId(this ThumbarButton[] thumbarButtons)
|
||||
{
|
||||
for (int index = 0; index < thumbarButtons.Length; index++)
|
||||
{
|
||||
var thumbarButton = thumbarButtons[index];
|
||||
|
||||
if (string.IsNullOrEmpty(thumbarButton.Id))
|
||||
{
|
||||
thumbarButton.Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
|
||||
return thumbarButtons;
|
||||
}
|
||||
|
||||
public static ThumbarButton GetThumbarButton(this List<ThumbarButton> thumbarButtons, string id)
|
||||
{
|
||||
ThumbarButton result = new ThumbarButton("");
|
||||
|
||||
foreach (var item in thumbarButtons)
|
||||
{
|
||||
if (item.Id == id)
|
||||
{
|
||||
result = item;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user