Ejemplo n.º 1
0
        private void OnNewSay(ConversationModel model)
        {
            if (model.Partner == null)
            {
                initialSay = true;
                return;
            }
            while (!this.IsHandleCreated) ;
            if (this.InvokeRequired)
            {
                this.Invoke((ConversationController.ExternalEventHandler)
                    OnNewSay, model);
                return;
            }
            SayData sayData = model.Says[model.Says.Count - 1];
            richConversationTextbox.SelectionStart = richConversationTextbox.Text.Length;
            if (sayData.Id == LoggedInUserModel.Instance.User.Id)
            {
                richConversationTextbox.SelectionBackColor = Color.LightGray;
                richConversationTextbox.SelectedText = LoggedInUserModel.Instance.User.Username + ": ";
                normalConversationTextbox.SelectedText = LoggedInUserModel.Instance.User.Username + ": ";
            }
            else
            {
                richConversationTextbox.SelectionBackColor = Color.DarkGray;
                richConversationTextbox.SelectedText = _name + ": ";
                normalConversationTextbox.SelectedText = _name + ": ";
            }
            richConversationTextbox.SelectedRtf = sayData.RichSay;
            normalConversationTextbox.SelectedText = sayData.NormalSay+"\r\n";
            richConversationTextbox.Refresh();
            normalConversationTextbox.ScrollToCaret();
            normalConversationTextbox.Refresh();

            richConversationTextbox.Focus();
            saysTextbox.Focus();
        }
Ejemplo n.º 2
0
 private void OnReceivedParnterInfo(ConversationModel model)
 {
     while (!this.IsHandleCreated);
     if (this.InvokeRequired)
     {
         this.Invoke((ConversationController.ExternalEventHandler)
             OnReceivedParnterInfo, model);
         return;
     }
     _name = model.Partner.Username;
     this.Text = "Talk to " + _name;
     OnChangeUserState(model);
     if (initialSay)
         OnNewSay(model);
 }
Ejemplo n.º 3
0
        private void OnChangeUserState(ConversationModel model)
        {
            while (!this.IsHandleCreated) ;
            if (this.InvokeRequired)
            {
                this.Invoke((ConversationController.ExternalEventHandler)
                    OnChangeUserState, model);
                return;
            }

            if (model.Partner.Status)
            {
                sayButton.Enabled = true;
                stateLabel.Text = _name + " is online";
            }
            else
            {
                sayButton.Enabled = false;
                stateLabel.Text = _name + " is offline";
            }
        }