| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- // Copyright (c) The Avalonia Project. All rights reserved.
- // Licensed under the MIT license. See licence.md file in the project root for full license information.
- using System;
- using System.Threading.Tasks;
- namespace Avalonia.Controls
- {
- /// <summary>
- /// Defines a name scope.
- /// </summary>
- public interface INameScope
- {
- /// <summary>
- /// Registers an element in the name scope.
- /// </summary>
- /// <param name="name">The element name.</param>
- /// <param name="element">The element.</param>
- void Register(string name, object element);
- /// <summary>
- /// Finds a named element in the name scope, waits for the scope to be completely populated before returning null
- /// </summary>
- /// <param name="name">The name.</param>
- /// <returns>The element, or null if the name was not found.</returns>
- ValueTask<object> FindAsync(string name);
-
- /// <summary>
- /// Finds a named element in the name scope, returns immediately, doesn't traverse the name scope stack
- /// </summary>
- /// <param name="name">The name.</param>
- /// <returns>The element, or null if the name was not found.</returns>
- object Find(string name);
- /// <summary>
- /// Marks the name scope as completed, no further registrations will be allowed
- /// </summary>
- void Complete();
-
- /// <summary>
- /// Returns whether further registrations are allowed on the scope
- /// </summary>
- bool IsCompleted { get; }
- }
- }
|