Merge of theolivenbaum PR

This commit is contained in:
Gregor Biswanger
2022-07-28 11:51:18 +02:00
185 changed files with 6155 additions and 6135 deletions

View File

@@ -16,7 +16,7 @@ namespace ElectronNET.API
public sealed class Menu : IMenu
{
private static Menu _menu;
private static object _syncRoot = new object();
private static readonly object _syncRoot = new();
internal Menu() { }
@@ -46,7 +46,7 @@ namespace ElectronNET.API
/// The menu items.
/// </value>
public IReadOnlyCollection<MenuItem> MenuItems { get { return _menuItems.AsReadOnly(); } }
private List<MenuItem> _menuItems = new List<MenuItem>();
private readonly List<MenuItem> _menuItems = new();
/// <summary>
/// Sets the application menu.
@@ -76,7 +76,7 @@ namespace ElectronNET.API
/// The context menu items.
/// </value>
public IReadOnlyDictionary<int, ReadOnlyCollection<MenuItem>> ContextMenuItems { get; internal set; }
private Dictionary<int, List<MenuItem>> _contextMenuItems = new Dictionary<int, List<MenuItem>>();
private readonly Dictionary<int, List<MenuItem>> _contextMenuItems = new();
/// <summary>
/// Sets the context menu.
@@ -114,7 +114,7 @@ namespace ElectronNET.API
BridgeConnector.Emit("menu-contextMenuPopup", browserWindow.Id);
}
private JsonSerializer _jsonSerializer = new JsonSerializer()
private readonly JsonSerializer _jsonSerializer = new()
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore