Exemple #1
0
        private void addLine(TSvrRef s, Color c)
        {
            if (!isLoad)
            {
                if (this.InvokeRequired)
                {
                    addLineDel a = addLine;
                    this.Invoke(a, new object[]
                    {
                        s, c
                    }
                                );
                }
                else
                {
                    lock (this)
                    {
                        if (!string.IsNullOrEmpty(s.Servername_From) && !string.IsNullOrEmpty(s.Servername_To) &&
                            isNodes(s.Servername_From) && isNodes(s.Servername_To))
                        {
                            AnimatedLink link = new AnimatedLink();
                            link.AdjustingStyle = GoLinkAdjustingStyle.Scale;
                            link.BrushColor     = c;
                            link.PenColor       = c;
                            link.PenWidth       = 2;
                            link.FromPort       = getNodes(s.Servername_From).Port;
                            link.ToPort         = getNodes(s.Servername_To).Port;
                            link.UserFlags      = 0;
                            link.UserObject     = c;

                            string key = string.Format("{0}->{1}", s.Servername_From, s.Servername_To);
                            link.Text = key;
                            if (!isLines(key))
                            {
                                List <string> lines = new List <string>();
                                if (!dicNodeLines.ContainsKey(s.Servername_To))
                                {
                                    dicNodeLines.Add(s.Servername_To, lines);
                                }
                                else
                                {
                                    lines = dicNodeLines[s.Servername_To];
                                }
                                lines.Add(key);


                                goView1.Document.Add(link);
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        private AnimatedLink getLines(string name)
        {
            AnimatedLink line = null;

            foreach (GoObject obj in goView1.Document)
            {
                line = obj as AnimatedLink;
                if (line != null)
                {
                    if (line.Text == name)
                    {
                        break;
                    }
                }
            }
            return(line);
        }
Exemple #3
0
        private bool isLines(string name)
        {
            bool flag = false;

            foreach (GoObject obj in goView1.Document)
            {
                AnimatedLink node = obj as AnimatedLink;
                if (node != null)
                {
                    if (node.Text == name)
                    {
                        flag = true;
                        break;
                    }
                }
            }
            return(flag);
        }
Exemple #4
0
        public List <string> getNodeLines(string serviceName)
        {
            List <string> lt = new List <string>();

            foreach (GoObject obj in goView1.Document)
            {
                AnimatedLink node = obj as AnimatedLink;
                if (node != null)
                {
                    string serverName_to = node.Text.Split(new string[] { "->" }, StringSplitOptions.RemoveEmptyEntries)[1];
                    if (serviceName == serverName_to)
                    {
                        lt.Add(node.Text);
                    }
                }
            }
            return(lt);
        }
Exemple #5
0
        private void lineWarn()
        {
            goView1.Document.SkipsUndoManager = true;
            foreach (GoObject obj in goView1.Document)
            {
                AnimatedLink link = obj as AnimatedLink;

                if (link != null)
                {
                    if (link.UserFlags == 1)
                    {
                        // link.PenColor = (Color) link.UserObject;
                        link.PenColor = Color.Green;
                        link.PenWidth = 2;
                        link.Step();

                        //device.stopSecondaryBufferByName(link.Text);
                    }
                    else if (link.UserFlags == 0)
                    {
                        link.PenColor = Color.Red;
                        if (link.PenWidth == 2)
                        {
                            link.PenWidth = 4;
                        }
                        else
                        {
                            link.PenWidth = 2;
                        }
                        isWarn = true;

                        //device.addSecondaryBufferAndPlay(Consts.SoundLocation, link.Text);
                    }
                }
            }
            goView1.Document.SkipsUndoManager = false;
        }
Exemple #6
0
        private string SvrRunInfo(CedaObject co)
        {
            string str = "";

            if (co.Topic.Contains("YM.M.SI"))
            {
                SvrRunInfo sri = MsgHelper.Deserialize <SvrRunInfo>(co.MessageBody);

                if (!dicSvrRunInfo.ContainsKey(co.Topic))
                {
                    dicSvrRunInfo.Add(co.Topic, sri);
                }
                else
                {
                    dicSvrRunInfo[co.Topic] = sri;
                }
                GoBasicNode node = getNodes(sri.ServiceName);
                if (node != null)
                {
                    if (sri.WorkDes == "working" || sri.Connectioned == "ok")
                    {
                        node.UserFlags = 1;
                    }
                    else
                    {
                        node.UserFlags = 0;
                    }

                    node.ToolTipText = sri.Info;
                }
                List <string> lines = getNodeLines(sri.ServiceName);

                List <Line> cLines = sri.getClientLine();
                foreach (var line in cLines)
                {
                    if (lines.Contains(line.Key))
                    {
                        AnimatedLink link = getLines(line.Key);
                        if (link != null)
                        {
                            link.ToolTipText = line.Info;
                            link.UserFlags   = 1;
                            lines.Remove(line.Key);
                        }
                    }
                    else
                    {
                        TSvrRef s = new TSvrRef()
                        {
                            Servername_From = line.Servername_From, Servername_To = line.Servername_To
                        };
                        addLine(s, Color.Yellow);
                    }
                }
                foreach (var line in lines)
                {
                    AnimatedLink link = getLines(line);
                    if (link != null)
                    {
                        link.UserFlags   = 0;
                        link.ToolTipText = "已断开";
                    }
                }

                str = string.Format("Topic={0},MessageBody={1}", co.Topic, co.MessageBody);
            }
            return(str);
        }