private void LeagueSocket_OnClose(object sender, CloseEventArgs e)
        {
            Leaguemanager.HandleLobbyClosed();
            JoinLobbyView view = AppManager.ViewModel.GetView <JoinLobbyView>();

            view.setLeagueStatus(false);
        }
        private void LeagueSocket_OnOpen(object sender, EventArgs e)
        {
            Connected = true;
            JoinLobbyView view = AppManager.ViewModel.GetView <JoinLobbyView>();

            view.setLeagueStatus(true);
        }
 public LeagueClient(AppManager manager)
 {
     AppManager    = manager;
     clientManager = new ClientManager();
     Leaguemanager = new LeagueSocketManager(this);
     try
     {
         leagueSocket = new WebSocket($"wss://127.0.0.1:{clientManager.Port}/", "wamp");
         leagueSocket.SetCredentials("riot", clientManager.Password, true);
         leagueSocket.SslConfiguration.EnabledSslProtocols = SslProtocols.Tls12;
         leagueSocket.SslConfiguration.ServerCertificateValidationCallback = (sender, cert, chain, ssl) => true;
         leagueSocket.Connect();
         leagueSocket.Send("[5, \"OnJsonApiEvent\"]");
         leagueSocket.OnMessage += LeagueSocket_OnMessage;
         leagueSocket.OnOpen    += LeagueSocket_OnOpen;
         leagueSocket.OnClose   += LeagueSocket_OnClose;
         Connected = true;
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         JoinLobbyView view = AppManager.ViewModel.GetView <JoinLobbyView>();
         view.setLeagueStatus(false);
     }
 }