コード例 #1
0
        private async void HandleMessage(WebSocketSession session, string message)
        {
            switch (message)
            {
            case "PokemonList":
                await PokemonListTask.Execute(_session);

                break;

            case "EggsList":
                await EggsListTask.Execute(_session);

                break;

            case "InventoryList":
                await InventoryListTask.Execute(_session);

                break;

            case "PokemonSnipeList":
                await HumanWalkSnipeTask.ExecuteFetchData(_session);

                break;
            }

            // Setup to only send data back to the session that requested it.
            try
            {
                dynamic decodedMessage = JObject.Parse(message);
                var     handle         = _websocketHandler?.Handle(_session, session, decodedMessage);
                if (handle != null)
                {
                    await handle;
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                //Logger.Write(ex.Message);
#endif
            }

            // When we first get a message from the web socket, turn off log buffering.
            // This allows us to flush out buffered LogEvent messages to the GUI.
            Logger.TurnOffLogBuffering();
        }
コード例 #2
0
        private async void HandleMessage(WebSocketSession session, string message)
        {
            switch (message)
            {
            case "PokemonList":
                await PokemonListTask.Execute(_session);

                break;

            case "EggsList":
                await EggsListTask.Execute(_session);

                break;

            case "InventoryList":
                await InventoryListTask.Execute(_session);

                break;

            case "PokemonSnipeList":
                await HumanWalkSnipeTask.ExecuteFetchData(_session);

                break;
            }

            // Setup to only send data back to the session that requested it.
            try
            {
                dynamic decodedMessage = JObject.Parse(message);
                var     handle         = _websocketHandler?.Handle(_session, session, decodedMessage);
                if (handle != null)
                {
                    await handle;
                }
            }
            catch
            {
                // ignored
            }
        }
コード例 #3
0
        public async Task Handle(ISession session, WebSocketSession webSocketSession, dynamic message)
        {
            await HumanWalkSnipeTask.ExecuteFetchData(session);

            //await GetPokemonSnipeListTask.Execute(session, webSocketSession, (string)message.RequestID);
        }