//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// AFXUI auxiliary module for Blazor-application (WASM) | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;

using CommonHelpers.WASM;

namespace AFXUI {

//**************************************************************************************************
partial class UComponentBase {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static bool IsEscapeRequested => UCircuit.IsEscapeRequested;

//==================================================================================================

public static void SetEscapeRequested() => UCircuit.SetEscapeRequested();
public static void ResetEscapeRequested() => UCircuit.ResetEscapeRequested();

//--------------------------------------------------------------------------------------------------

/// <exception cref="ArgumentNullException" />
/// <exception cref="UEscapeException" />
public static void ESC_Check( Type methodType,
                              [CallerMemberName][HRequired] string? methodNameOrSignature=null ) =>
   UCircuit.ESC_Check( methodType, HArgChecking.VerifyNotNull( methodNameOrSignature ) );

/// <exception cref="ArgumentNullException" />
/// <exception cref="UEscapeExceptionTN" />
public static void ESC_Check( string methodTypeName,
                              [CallerMemberName][HRequired] string? methodNameOrSignature=null ) =>
   UCircuit.ESC_Check( methodTypeName, methodNameOrSignature );

/// <exception cref="UEscapeException" />
public static void ESC_Check([HRequired] MethodBase? method) =>
   UCircuit.ESC_Check( method );

//==================================================================================================

/// <exception cref="UEscapeException" />
public static Task ESC_WaitFor_A( Type methodType,
                                  Func<bool> condition,
                                  [CallerMemberName][HRequired]
                                  string? methodNameOrSignature=null ) =>
   UCircuit.ESC_WaitFor_A( methodType, condition, methodNameOrSignature );

/// <exception cref="UEscapeException" />
public static Task ESC_WaitFor_A( string methodTypeName,
                                  Func<bool> condition,
                                  [CallerMemberName][HRequired]
                                  string? methodNameOrSignature=null ) =>
   UCircuit.ESC_WaitFor_A( methodTypeName, condition, methodNameOrSignature );

/// <exception cref="ArgumentNullException" />
/// <exception cref="UEscapeException" />
public static Task ESC_WaitFor_A( [HRequired] MethodBase? method, Func<bool> condition) =>
   UCircuit.ESC_WaitFor_A( method, condition );

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // UComponentBase
//**************************************************************************************************

} // AFXUI
