madagaga / WTalk

GTalk like client
MIT License
20 stars 10 forks source link

Have to double-click to set focus on the New Message Box. #2

Closed thecodrr closed 8 years ago

thecodrr commented 8 years ago

I think the problem is here, in this part of code: Client.cs

    public void SetFocus(string conversationId)
           {
              if (conversationId.Length == 0)
              return;

        SetFocusRequest request = new SetFocusRequest()
        {
            request_header = RequestHeaderBody,
            conversation_id = new ConversationId() { id = conversationId },
            type = FocusType.FOCUS_TYPE_FOCUSED,
            timeout_secs = 20
        };

        HttpResponseMessage message = _client.PostProtoJson("conversations/setfocus", request);
        message.Dispose();
    }

And in this application code: ConversationViewModel.cs

   private void SetFocus()
    {

        if(this.HasUnreadMessages)
            _client.UpdateWaterMark(Conversation.Id, DateTime.UtcNow);

        _client.SetFocus(Conversation.Id);
        OnPropertyChanged("HasUnreadMessages");
    }
madagaga commented 8 years ago

even if length is 0 we have to send a set focus command. It activate the contact icon on the receiver side. Hangout client does the same. I think the command should return something, maybe a bool, to continue

I will test your code.

Thanks

thecodrr commented 8 years ago

Why not use String.Empty in the if statement?

madagaga commented 8 years ago

☺ I don't remerber why

thecodrr commented 8 years ago

Well, doesn't make any difference, both are doing the same thing.

madagaga commented 8 years ago

MouseBinding in xaml removed. Switch back to standard event handling.

It should be corrected

thecodrr commented 8 years ago

I will try and test this. I hope it works :)

thecodrr commented 8 years ago

It is working quite excellently, though there is a small delay before it the caret appears.