Ejemplo n.º 1
0
 private void FriendList_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         Views.FriendListEntry entry = (Views.FriendListEntry)FriendList.SelectedItem;
         //friendListViewModel.OpenChat(entry.UserId);
     }
 }
Ejemplo n.º 2
0
        private void DeleteFriend()
        {
            if (_friendList != null && _friendList.SelectedItem != null)
            {
                Views.FriendListEntry friend = (Views.FriendListEntry)_friendList.SelectedItem;
                AccountManager.DeleteFriend(friend.UserId);

                UpdateFriendList();
            }
        }
Ejemplo n.º 3
0
        internal void UpdateFriendList()
        {
            if (_friendList != null)
            {
                _friendList.Items.Clear();

                var friends = AccountManager.GetFriendList();
                for (int i = 0; i < friends.Count; i++)
                {
                    var friend = new Views.FriendListEntry(friends[i].Id.Value, friends[i].DisplayName, friends[i].Username);
                    friend.MouseDoubleClick += Friend_MouseDoubleClick;
                    _friendList.Items.Add(friend);
                }
            }
        }
Ejemplo n.º 4
0
        private void UpdateChat()
        {
            DefaultApi     api = new DefaultApi("http://localhost:8080/api/");
            AccountManager lm  = AccountManager.GetInstance();

            var chatInfo     = AccountManager.GetChatInfo(ChatId);
            var chatMessages = AccountManager.GetChatMessages(ChatId);

            ChatTitle = chatInfo.ChatTitle;
            ChatId    = chatInfo.Id.Value;

            string chatLog = "";

            foreach (var message in chatMessages)
            {
                var profile     = AccountManager.GetProfileById(message.UserId.Value);
                var displayName = profile.DisplayName;
                chatLog += String.Format("[{0}] {1}: {2}", message.Timestamp, displayName, message._Message) + Environment.NewLine;
            }
            ChatLog = chatLog;

            if (_chatScrollViewer != null)
            {
                _chatScrollViewer.ScrollToBottom();
            }

            if (_chatlist != null)
            {
                _chatlist.Items.Clear();
                foreach (var userId in chatInfo.Users)
                {
                    var profile = AccountManager.GetProfileById(userId.Value);
                    Views.FriendListEntry entry = new Views.FriendListEntry(userId.Value, profile.DisplayName, profile.Username);
                    _chatlist.Items.Add(entry);
                }
            }
        }
Ejemplo n.º 5
0
        internal void UpdateFriendList()
        {
            if (_friendList != null)
            {
                _friendList.Items.Clear();

                var friends = AccountManager.GetFriendList();
                for (int i = 0; i < friends.Count; i++)
                {
                    var friend = new Views.FriendListEntry(friends[i].Id.Value, friends[i].DisplayName, friends[i].Username);
                    friend.MouseDoubleClick += Friend_MouseDoubleClick;
                    _friendList.Items.Add(friend);
                }
            }
        }
Ejemplo n.º 6
0
 private void Friend_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     Views.FriendListEntry entry = (Views.FriendListEntry)sender;
     //OpenChat(entry.UserId);
 }
Ejemplo n.º 7
0
        private void UpdateChat()
        {
            DefaultApi api = new DefaultApi("http://localhost:8080/api/");
            AccountManager lm = AccountManager.GetInstance();

            var chatInfo = AccountManager.GetChatInfo(ChatId);
            var chatMessages = AccountManager.GetChatMessages(ChatId);

            ChatTitle = chatInfo.ChatTitle;
            ChatId = chatInfo.Id.Value;

            string chatLog = "";
            foreach(var message in chatMessages)
            {
                var profile = AccountManager.GetProfileById(message.UserId.Value);
                var displayName = profile.DisplayName;
                chatLog += String.Format("[{0}] {1}: {2}", message.Timestamp, displayName, message._Message) + Environment.NewLine;
            }
            ChatLog = chatLog;

            if(_chatScrollViewer != null)
            {
                _chatScrollViewer.ScrollToBottom();
            }

            if (_chatlist != null)
            {
                _chatlist.Items.Clear();
                foreach (var userId in chatInfo.Users)
                {
                    var profile = AccountManager.GetProfileById(userId.Value);
                    Views.FriendListEntry entry = new Views.FriendListEntry(userId.Value, profile.DisplayName, profile.Username);
                    _chatlist.Items.Add(entry);
                }
            }
        }