/// <summary> /// Close the modal dialog. /// </summary> public void Hide() { IsOpen = false; Closed.InvokeAsync(null); StateHasChanged(); }
private async Task ReceiveMessagesAsync(CancellationToken token) { try { var sb = new StringBuilder(); while (_clientWebSocket.State == WebSocketState.Open) { WebSocketReceiveResult result; _buffer = new ArraySegment <byte>(new byte[BufferSize]); sb.Clear(); do { result = await _clientWebSocket.ReceiveAsync(_buffer, token); var message = Encoding.UTF8.GetString(_buffer.Array, 0, result.Count); sb.Append(message); } while (!result.EndOfMessage); await TextReceived.InvokeAsync(this, sb.ToString()); } } catch (Exception e) { await Closed.InvokeAsync(this, EventArgs.Empty); } }
private void RaiseEvents(bool visible) { if (!visible) { _ = Closed.InvokeAsync(new SnackbarClosedEventArgs(Key, closeReason)); } }
private void RaiseEvents(bool visible) { if (!visible) { Closed.InvokeAsync(null); } }
/// <summary> /// Hides the snackbar. /// </summary> public void Hide() { Visible = false; _ = Closed.InvokeAsync(null); StateHasChanged(); }
private void RaiseEvents(bool visible) { StateChanged?.Invoke(this, new ModalStateEventArgs(visible)); if (!visible) { Closed.InvokeAsync(null); } }
private Task OnSnackbarClosed(string key, SnackbarCloseReason closeReason) { var info = snackbarInfos.FirstOrDefault(x => x.Key == key); if (info != null) { snackbarInfos.Remove(info); } StateHasChanged(); return(Closed.InvokeAsync(new SnackbarClosedEventArgs(key, closeReason))); }
/// <summary> /// Handles the <see cref="Snackbar.Snackbar"/> closing event. /// </summary> /// <param name="eventArgs"></param> /// <returns></returns> protected virtual Task OnSnackbarClosed(SnackbarClosedEventArgs eventArgs) { return(eventArgs.CloseReason == SnackbarCloseReason.UserClosed ? Okayed.InvokeAsync() : Closed.InvokeAsync()); }
private async Task OnMenuItemClick(IMenuItem item) { await Closed.InvokeAsync(item); }
protected Task OnOpenedChange(bool isOpen) => !isOpen?Closed.InvokeAsync() : Task.CompletedTask;