Пример #1
0
        private async void OnConnected(object sender, EventArgs args)
        {
            var stat = Statuses.GetStatus(EventStatus.Success);

            stat.Description = "Connection réussie";
            OnUpdateHandlerEvent(new ConnectionEventArgs()
            {
                Status = stat
            });
        }
Пример #2
0
        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();
        }
Пример #3
0
        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);
        }
Пример #4
0
 public ViewResult Edit(int id)
 {
     return(View(statuses.GetStatus(id)));
 }