Пример #1
0
        protected async Task ShareRequestedInternal(IShareRequest shareRequest)
        {
            // Find the first page element that implements IShareable and forward the data request

            PageInfo currentPage = _navigationManager.NavigationStack.CurrentPage;
            bool hasRequestBeenProcessed = false;

            if (currentPage != null)
            {
                foreach (object element in _navigationManager.GetPageElements(currentPage))
                {
                    if (element is IShareable)
                    {
                        await ((IShareable)element).ShareRequested(shareRequest);
                        hasRequestBeenProcessed = true;
                    }
                }
            }

            // If there is nothing to share and their is a default failure text specified then return this

            if (!hasRequestBeenProcessed && !string.IsNullOrEmpty(DefaultFailureText))
                shareRequest.FailWithDisplayText(DefaultFailureText);
        }