Добавлены новые методы отправки сообщений
This commit is contained in:
@@ -16,9 +16,14 @@ public sealed class PageContext
|
||||
|
||||
/// <summary>Хранилище состояния.</summary>
|
||||
public required IStateStorage StateStorage { get; init; }
|
||||
|
||||
/// <summary>Сервис навигации.</summary>
|
||||
public required NavigationService Navigation { get; init; }
|
||||
/// <summary>Адаптер мессенджера.</summary>
|
||||
|
||||
/// <summary>Фабрика адаптеров (для получения других адаптеров).</summary>
|
||||
public required IMessengerAdapterFactory AdapterFactory { get; init; }
|
||||
|
||||
/// <summary>Текущий адаптер мессенджера.</summary>
|
||||
public required IMessengerAdapter Adapter { get; init; }
|
||||
|
||||
/// <summary>
|
||||
@@ -26,4 +31,36 @@ public sealed class PageContext
|
||||
/// </summary>
|
||||
public IAlbumBuilder Albums => Adapter.CreateAlbumBuilder(this);
|
||||
|
||||
/// <summary>
|
||||
/// Получить адаптер по ID.
|
||||
/// </summary>
|
||||
public IMessengerAdapter GetAdapter(string adapterId)
|
||||
=> AdapterFactory.Resolve(adapterId);
|
||||
|
||||
/// <summary>
|
||||
/// Попытаться получить адаптер по ID.
|
||||
/// </summary>
|
||||
public bool TryGetAdapter(string adapterId, out IMessengerAdapter? adapter)
|
||||
=> AdapterFactory.TryResolve(adapterId, out adapter);
|
||||
|
||||
/// <summary>
|
||||
/// Получить все адаптеры определенного типа.
|
||||
/// </summary>
|
||||
public IReadOnlyList<IMessengerAdapter> GetAdaptersByType(string adapterType)
|
||||
=> AdapterFactory.GetAdaptersByType(adapterType);
|
||||
|
||||
/// <summary>
|
||||
/// Получить текущий тип адаптера.
|
||||
/// </summary>
|
||||
public string CurrentAdapterType => Update.AdapterType;
|
||||
|
||||
/// <summary>
|
||||
/// Получить текущий ID адаптера.
|
||||
/// </summary>
|
||||
public string CurrentAdapterId => Update.AdapterId;
|
||||
|
||||
/// <summary>
|
||||
/// Получить все адаптеры.
|
||||
/// </summary>
|
||||
public IReadOnlyList<IMessengerAdapter> AllAdapters => AdapterFactory.AllAdapters;
|
||||
}
|
||||
Reference in New Issue
Block a user