예제 #1
0
        private void MemberTree_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            MemberNode node = MemberTree.GetNodeAt(e.Location) as MemberNode;

            if (node == null)
            {
                return;
            }

            OpMenuItem info = new OpMenuItem(node.UserID, 0);

            if (Locations.ActiveClientCount(node.UserID) > 0)
            {
                var im = ParentView.UI.GetService(ServiceIDs.IM) as IMUI;
                if (im != null)
                {
                    im.OpenIMWindow(info.UserID);
                }
            }
            else
            {
                var mail = ParentView.UI.GetService(ServiceIDs.Mail) as MailUI;
                if (mail != null)
                {
                    mail.OpenComposeWindow(info.UserID);
                }
            }
        }
예제 #2
0
파일: LinkTree.cs 프로젝트: nandub/DeOps
        public void UpdateColor()
        {
            Color newColor = Color.Black;

            if (Link.UserID == Trust.Core.UserID || Locations.ActiveClientCount(Link.UserID) > 0)
            {
                newColor = Color.Black;
            }
            else
            {
                newColor = Color.DarkGray;
            }

            if (newColor != ForeColor)
            {
                ForeColor = newColor;
            }
        }
예제 #3
0
        public void IM_MessageUpdate(ulong id, InstantMessage message)
        {
            if (id != UserID)
            {
                return;
            }

            int oldStart  = MessageTextBox.SelectionStart;
            int oldLength = MessageTextBox.SelectionLength;

            MessageTextBox.SelectionStart  = MessageTextBox.Text.Length;
            MessageTextBox.SelectionLength = 0;

            // name, in bold, blue for incoming, red for outgoing
            if (message.System)
            {
                MessageTextBox.SelectionColor = Color.Black;
            }
            else if (Core.Network.Local.Equals(message))
            {
                MessageTextBox.SelectionColor = message.Sent ? Color.Red : Color.LightCoral;
            }
            else
            {
                MessageTextBox.SelectionColor = Color.Blue;
            }

            MessageTextBox.SelectionFont = BoldFont;

            string prefix = " ";

            if (!message.System)
            {
                prefix += Core.GetName(message.UserID);
            }

            if (MessageTextBox.Text.Length != 0)
            {
                prefix = "\n" + prefix;
            }

            // add timestamp
            if (TimestampMenu.Checked)
            {
                MessageTextBox.AppendText(prefix);

                MessageTextBox.SelectionFont = TimeFont;
                MessageTextBox.AppendText(" (" + message.TimeStamp.ToString("T") + ")");

                MessageTextBox.SelectionFont = BoldFont;
                prefix = "";
            }

            string location = "";

            if (!message.System && Locations.ActiveClientCount(message.UserID) > 1)
            {
                location = " @" + Locations.GetLocationName(message.UserID, message.ClientID);
            }


            if (!message.System)
            {
                prefix += location + ": ";
            }

            MessageTextBox.AppendText(prefix);

            // message, grey for not acked
            MessageTextBox.SelectionColor = Color.Black;
            if (Core.Network.Local.Equals(message) && !message.Sent)
            {
                MessageTextBox.SelectionColor = Color.LightGray;
            }

            if (message.System)
            {
                MessageTextBox.SelectionFont = SystemFont;
                MessageTextBox.AppendText(" *" + message.Text);
            }
            else
            {
                MessageTextBox.SelectionFont = RegularFont;

                if (message.Format == TextFormat.RTF)
                {
                    MessageTextBox.SelectedRtf = GuiUtils.RtftoColor(message.Text, MessageTextBox.SelectionColor);
                }

                else if (message.Format == TextFormat.Plain)
                {
                    MessageTextBox.AppendText(message.Text);
                }
            }


            MessageTextBox.SelectionStart  = oldStart;
            MessageTextBox.SelectionLength = oldLength;

            MessageTextBox.DetectLinksDefault();

            if (!MessageTextBox.Focused)
            {
                MessageTextBox.SelectionStart = MessageTextBox.Text.Length;
                MessageTextBox.ScrollToCaret();
            }

            if (External != null && !WindowActivated)
            {
                FlashMe = true;
            }
        }