mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-11 13:44:38 +00:00
40 lines
1.0 KiB
C#
40 lines
1.0 KiB
C#
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;
|
|
}
|
|
}
|
|
}
|