Exemplo n.º 1
0
 void TasClient_ChannelTopicChanged(object sender, ChangeTopic changeTopic)
 {
     if (ChannelName == changeTopic.ChannelName)
     {
         var      channel = Program.TasClient.JoinedChannels[ChannelName];
         DateTime?lastChange;
         Program.Conf.Topics.TryGetValue(channel.Name, out lastChange);
         var topicLine = new TopicLine(channel.Topic.Text, channel.Topic.SetBy, channel.Topic.SetDate);
         topicBox.Reset();
         topicBox.AddLine(topicLine);
         if (channel.Topic != null && lastChange != channel.Topic.SetDate)
         {
             IsTopicVisible = true;
         }
         else
         {
             IsTopicVisible = false;
         }
     }
 }
Exemplo n.º 2
0
 void TasClient_ChannelTopicChanged(object sender, TasEventArgs e)
 {
     if (ChannelName == e.ServerParams[0])
     {
         var      channel = Program.TasClient.JoinedChannels[ChannelName];
         DateTime lastChange;
         Program.Conf.Topics.TryGetValue(channel.Name, out lastChange);
         var topicLine = new TopicLine(channel.Topic, channel.TopicSetBy, channel.TopicSetDate);
         topicBox.Reset();
         topicBox.AddLine(topicLine);
         if (channel.Topic != null && lastChange != channel.TopicSetDate)
         {
             IsTopicVisible = true;
         }
         else
         {
             IsTopicVisible = false;
         }
     }
 }
Exemplo n.º 3
0
        protected override XList <TopicLine> CreateTopicLines(MindMapLayoutArgs e, Topic beginTopic, Topic endTopic, Vector4 beginSide, Vector4 endSide)
        {
            XList <TopicLine> lines = new XList <TopicLine>();
            var beginRect           = beginTopic.Bounds;
            var endRect             = endTopic.Bounds;

            if (e.ShowLineArrowCap)
            {
                endRect.Inflate(LineAnchorSize, LineAnchorSize);
            }

            if (beginTopic != null && !beginTopic.IsRoot)
            {
                int foldBtnSize = endTopic.FoldingButton.Width;
                switch (beginSide)
                {
                case Vector4.Left:
                    break;

                case Vector4.Right:
                    break;

                case Vector4.Top:
                    beginRect.Y      -= foldBtnSize;
                    beginRect.Height += foldBtnSize;
                    break;

                case Vector4.Bottom:
                    beginRect.Height += foldBtnSize;
                    break;
                }
            }

            if (beginTopic != null && endTopic != null &&
                beginTopic.Type == TopicType.Barrier &&
                beginTopic.IsParentOf(endTopic))
            {
                beginRect.Y      = beginTopic.ContentBounds.Bottom;
                beginRect.Height = 0;
            }

            if (endTopic != null)
            {
                if (endTopic.Type == TopicType.Threat ||
                    endTopic.Type == TopicType.Consequence ||
                    endTopic.Type == TopicType.Escalation)
                {
                    endRect.Height = 60; // 60 is barrier height
                }
                else if (endTopic.Style.Shape == TopicShape.BaseLine)
                {
                    endRect.Y      = endRect.Bottom;
                    endRect.Height = 0;
                }
            }

            TopicLine line;

            if (endTopic != null && beginTopic != null && endTopic.Type == TopicType.Barrier && (beginTopic.IsRoot || beginTopic.Type == TopicType.Barrier))
            {
                endRect        = endTopic.ContentBounds;
                endRect.Height = endTopic.Bounds.Height;
                line           = new TopicLine(endTopic, beginSide, endSide, beginRect, endRect);
                lines.Add(line);

                beginRect = endRect;
                int left = beginRect.Left;
                if (beginSide == Vector4.Left)
                {
                    left += beginRect.Width;
                }
                else if (beginSide == Vector4.Right)
                {
                    left -= beginRect.Width;
                }

                beginRect.Location = new Point(left, beginRect.Y);
                endRect            = endTopic.Bounds;
            }
            line = new TopicLine(endTopic, beginSide, endSide, beginRect, endRect);
            lines.Add(line);
            return(lines);
        }