2017-10-16 22:39:45 +02:00
|
|
|
|
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)
|
|
|
|
|
|
{
|
2021-09-15 11:14:45 +02:00
|
|
|
|
ThumbarButton result = new("");
|
2017-10-16 22:39:45 +02:00
|
|
|
|
|
|
|
|
|
|
foreach (var item in thumbarButtons)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (item.Id == id)
|
|
|
|
|
|
{
|
|
|
|
|
|
result = item;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|