Add method to get window by id

This commit is contained in:
rafael-aero
2021-09-15 11:02:54 +02:00
parent 75d7924251
commit 664d5f7236
2 changed files with 20 additions and 3 deletions

View File

@@ -66,6 +66,15 @@ namespace ElectronNET.API
/// </value>
public IReadOnlyCollection<BrowserWindow> BrowserWindows { get { return _browserWindows.Values.ToList().AsReadOnly(); } }
/// <summary>
/// Get a browser window using the ID
/// </summary>
/// <param name="id">The id of the browser window</param>
/// <param name="window">The window, if any</param>
/// <returns>True if it found the window</returns>
public bool TryGetBrowserWindows(int id, out BrowserWindow window) => _browserWindows.TryGetValue(id, out window);
private ConcurrentDictionary<int, BrowserWindow> _browserWindows = new ();
/// <summary>
@@ -77,6 +86,14 @@ namespace ElectronNET.API
public IReadOnlyCollection<BrowserView> BrowserViews { get { return _browserViews.Values.ToList().AsReadOnly(); } }
private ConcurrentDictionary<int, BrowserView> _browserViews = new ();
/// <summary>
/// Get a browser view using the ID
/// </summary>
/// <param name="id">The id of the browser view</param>
/// <param name="view">The view, if any</param>
/// <returns>True if it found the view</returns>
public bool TryGetBrowserViews(int id, out BrowserView view) => _browserViews.TryGetValue(id, out view);
/// <summary>
/// Creates the window asynchronous.
/// </summary>