private async void OnConnected(object sender, EventArgs args) { var stat = Statuses.GetStatus(EventStatus.Success); stat.Description = "Connection réussie"; OnUpdateHandlerEvent(new ConnectionEventArgs() { Status = stat }); }
private async void OnDisconnected(object sender, string args) { if (DisconnectedByUser) { return; } var stat = Statuses.GetStatus(EventStatus.Error); stat.Description = "Déconnecté du serveur, reconnection en cours"; OnUpdateHandlerEvent(new ConnectionEventArgs() { Status = stat }); await Connect(); }
public async Task <bool> Connect() { try { DisconnectedByUser = false; await _client.ConnectAsync(); } catch // Error case => on connection failed (e.g. target unavailable) { var Status = Statuses.GetStatus(EventStatus.Error); Status.Description = "Impossible de se connecter au serveur"; OnUpdateHandlerEvent(new ConnectionEventArgs() { Status = Status }); Task.Delay(5000).ContinueWith(t => Connect()); return(false); } return(true); }
public ViewResult Edit(int id) { return(View(statuses.GetStatus(id))); }