コード例 #1
0
        public void AcceptCurrentFriendRequest()
        {
            if (CurrentFriendRequest == null)
            {
                return;
            }

            var error        = ToxErrorFriendAdd.Ok;
            int friendNumber = ProfileManager.Instance.Tox.AddFriendNoRequest(new ToxKey(ToxKeyType.Public, CurrentFriendRequest.PublicKey), out error);

            if (error != ToxErrorFriendAdd.Ok)
            {
                Debugging.Write("Failed to add friend: " + error);
            }
            else
            {
                var model = new FriendControlViewModel(this);
                model.ChatNumber = friendNumber;
                model.Name       = ProfileManager.Instance.Tox.GetFriendPublicKey(friendNumber).ToString();

                //add the friend to the list, sorted
                AddObject(model);
                SortObject(model);

                //auto switch to converation view of this friend (?)
                SelectObject(model);
            }

            RemoveCurrentFriendRequest();
        }
コード例 #2
0
        private void Init()
        {
            foreach (int friend in ProfileManager.Instance.Tox.Friends)
            {
                string name          = ProfileManager.Instance.Tox.GetFriendName(friend);
                string statusMessage = ProfileManager.Instance.Tox.GetFriendStatusMessage(friend);

                var model = new FriendControlViewModel(this);
                model.ChatNumber    = friend;
                model.Name          = string.IsNullOrEmpty(name) ? ProfileManager.Instance.Tox.GetFriendPublicKey(friend).ToString() : name;
                model.StatusMessage = statusMessage;

                AddObject(model);
            }

            RearrangeChatCollection();
        }
コード例 #3
0
 public ConversationViewModel(FriendControlViewModel model)
 {
     Friend = model;
 }