Exemplo n.º 1
0
        private void HandleStateStatusChange(object sender, StateStatusChangeEventArgs e)
        {
            Node N;

            MethodInvoker action = delegate
            {
                DrawProtocolStates();
                switch (e.StateStatus)
                {
                case State.Statuses.Started:
                    N = graph.FindNode(ProtocolProvider.GetStateDesplayName(e.CurrentState));
                    N.Attr.FillColor = Microsoft.Msagl.Drawing.Color.MediumSeaGreen;
                    break;

                case State.Statuses.FatalError:
                    N = graph.FindNode(ProtocolProvider.GetStateDesplayName(e.CurrentState));
                    N.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Red;
                    break;

                case State.Statuses.RuntimeError:
                    N = graph.FindNode(ProtocolProvider.GetStateDesplayName(e.CurrentState));
                    N.Attr.FillColor = Microsoft.Msagl.Drawing.Color.Yellow;
                    break;
                    //TODO:Add all Statuses
                }

                ProtocolStatesViewer.Refresh();
            };

            ProtocolStatesViewer.BeginInvoke(action);

            string Title = string.Format("{0}:{1}\n{2}", ProtocolProvider.GetStateDesplayName(e.CurrentState), e.StateStatus, e.Message);

            Log.LogEntery(new LoggingEntery("OctoTipPlus Appilcation", "ProtocolUserControl", Title, LoggingEntery.EnteryTypes.Debug));
        }
Exemplo n.º 2
0
        void ProtocolStatesViewerSelectionChanged(object sender, EventArgs e)
        {
            object selectedObject = ProtocolStatesViewer.SelectedObject;

            if (selectedObject != null)
            {
                if (selectedObject is Edge)
                {
                    Edge SelectedEdge = selectedObject as Edge;
                }
                else if (selectedObject is Node)
                {
                    Node   SelectedNode         = selectedObject as Node;
                    string DescriptionAttribute = ProtocolProvider.GetStateDescription(ProtocolProvider.GetStatePlugInByDesplayName(SelectedNode.Id, UserControlProtocolType));
                    ProtocolStatesViewer.SetToolTip(new ToolTip(), DescriptionAttribute);
                }
            }

            //here you can use e.Attr.Id to get back to your data
            //this.gViewer.SetToolTip(toolTip1, String.Format("node {0}", (selectedObject as Node).Attr.Id));
            ProtocolStatesViewer.Invalidate();
        }