Esempio n. 1
0
        private async Task DisposeSocketAsync(bool writeNotification = true)
        {
            try
            {
                if (socketClient != null)
                {
                    await socketClient.DisposeAsync();
                }
            }
            catch (Exception ex)
            {
                Logger.Log($"DisposeSocketAsync {ex.Message}", Prism.Logging.Category.Exception, Prism.Logging.Priority.High);

                if (writeNotification)
                {
                    ViewModelContext.UiDispatcher.Invoke(() =>
                    {
                        NotificationsAdd(new Message {
                            MessageType = MessageType.Error, Text = $"Disconnect - {ex.Message}", TextVerbose = ex.ToString()
                        });
                    });
                }
            }
            finally
            {
                socketClient = null;
                IsConnected  = false;
            }
        }
Esempio n. 2
0
        public async Task DisposeSocketAsync()
        {
            try
            {
                if (socketClient != null)
                {
                    await socketClient.DisposeAsync();
                }

                OnNotification();
            }
            catch (Exception ex)
            {
                OnException(ex.Message, ex);
            }
            finally
            {
                socketClient = null;
                IsConnecting = false;
                IsConnected  = false;
            }
        }
Esempio n. 3
0
 private async void OnDisconnect(object args)
 {
     await dipSocketClient.DisposeAsync();
 }