コード例 #1
0
ファイル: BaseContentPage.cs プロジェクト: teyouale/Hunt
        async public void ShowToast(string message, NoticationType type, int timeout = 3500)
        {
            if (_toastRoot == null || _toastRoot.IsVisible)
            {
                return;
            }

            if (_hudRoot != null && _hudRoot.IsVisible)
            {
                await Dismiss();
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                _toastLabel.Text     = message;
                _toastRoot.IsVisible = true;
            });

            await _toastRoot.TranslateTo(0, 0, 250);

            await Task.Delay(timeout).ConfigureAwait(false);

            await _toastRoot.TranslateTo(0, NavigationBar.YOffset * -1, 250);

            Device.BeginInvokeOnMainThread(() =>
            {
                _toastRoot.IsVisible = false;
            });
        }
コード例 #2
0
ファイル: BaseContentPage.cs プロジェクト: malirezai/Hunt
        async public void ShowToast(string message, NoticationType type, int timeout = 3500)
        {
            if (_toastRoot == null || _toastRoot.IsVisible)
            {
                return;
            }

            if (_hudRoot != null && _hudRoot.IsVisible)
            {
                await Dismiss();
            }

            if (_toastHeight == null)
            {
                _toastHeight = 40;
            }

            Device.BeginInvokeOnMainThread(() =>
            {
                _toastLabel.Text     = message;
                _toastRoot.IsVisible = true;
            });

            await _toastRoot.LayoutTo(new Rectangle(0, _toastRoot.Y, _toastRoot.Width, _toastHeight.Value), 350);

            await Task.Delay(timeout).ConfigureAwait(false);

            await _toastRoot.LayoutTo(new Rectangle(0, _toastRoot.Y, _toastRoot.Width, 0), 350);

            Device.BeginInvokeOnMainThread(() =>
            {
                _toastRoot.IsVisible = false;
            });
        }