Пример #1
0
        public void AnswerActivation(string json)
        {
            string answer = string.Empty;

            if (json != string.Empty)
            {
                var key = (JObject)JsonConvert.DeserializeObject(json);
                answer = key["Key"].Value <string>();
            }
            switch (answer)
            {
            case "sendmessage":
                SendMessageJSON sendMessageJSON = System.Text.Json.JsonSerializer.Deserialize <SendMessageJSON>(json);
                AddChatMessage(sendMessageJSON);
                break;

            case "statusonline":
                StatusOnlineJSON statusOnlineJSON = System.Text.Json.JsonSerializer.Deserialize <StatusOnlineJSON>(json);
                StartRefreshUsersOnline(statusOnlineJSON);
                break;

            default:
                MessageBox.Show("Server send string.Empty Answer. Stream 2.");
                break;
            }
        }
Пример #2
0
 private void StartRefreshUsersOnline(StatusOnlineJSON statusOnlineJSON)
 {
     MessengerForm.RefreshFriendsToList(CreateRequests.GetFriendList());
     MessengerForm.RefreshUsersStatus(statusOnlineJSON.UserList);
 }