コード例 #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)));
 }