Example #1
0
        public static async Task ActivateInteractiveFlow(InteractiveFlow interactiveFlow)
        {
            // Acquire the semaphore
            await InteractiveFlowSemaphore.WaitAsync();

            // Set the page to the root
            await interactiveFlow.SetPage(0);

            // Add this to the active messages
            ActiveInteractiveFlows.Add(interactiveFlow);

            // Release the semaphore
            InteractiveFlowSemaphore.Release();
        }
Example #2
0
        public static async Task DeactivateInteractiveFlow(InteractiveFlow interactiveFlow, bool isBecauseInactive = false)
        {
            // Acquire the semaphore
            await InteractiveFlowSemaphore.WaitAsync();

            // Remove this from the active flows
            bool isSuccess = ActiveInteractiveFlows.Remove(interactiveFlow);

            // Deactivate the current interactive message if needed
            if (isSuccess && interactiveFlow.CurrentInteractiveMessage != null && interactiveFlow.CurrentInteractiveMessage.IsActive)
            {
                await DeactivateInteractiveMessage(interactiveFlow.CurrentInteractiveMessage, isBecauseInactive);
            }

            // Release the semaphore
            InteractiveFlowSemaphore.Release();
        }