예제 #1
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return("NULL");
            }

            GraphVertexType vertexType = GraphVertexType.Node;

            if (Enum.IsDefined(typeof(GraphVertexType), value))
            {
                vertexType = (GraphVertexType)Enum.Parse(typeof(GraphVertexType), value.ToString());
            }
            switch (vertexType)
            {
            case GraphVertexType.Supply:
                return("центр питания");

            case GraphVertexType.Node:
                return("узел");

            case GraphVertexType.Transformer:
                return("трансформаторная подстанция");

            case GraphVertexType.unknown:
                return("<неизвестно>");

            default:
                return("<не определён>");
            }
        }
예제 #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return(FrameworkElement.TryFindResource("graphVertexDefaultTemplate") as ControlTemplate);
            }

            GraphVertexType vertexType = GraphVertexType.Node;

            if (Enum.IsDefined(typeof(GraphVertexType), value))
            {
                vertexType = (GraphVertexType)Enum.Parse(typeof(GraphVertexType), value.ToString());
            }

            switch (vertexType)
            {
            case GraphVertexType.Supply:
                return(FrameworkElement.TryFindResource("graphSupplyVertexTemplate") as ControlTemplate);

            case GraphVertexType.Node:
                return(FrameworkElement.TryFindResource("graphNodeVertexTemplate") as ControlTemplate);

            case GraphVertexType.Transformer:
                return(FrameworkElement.TryFindResource("graphTransformerVertexTemplate") as ControlTemplate);

            case GraphVertexType.unknown:
                return(FrameworkElement.TryFindResource("graphVertexDefaultTemplate") as ControlTemplate);

            default:
                return(FrameworkElement.TryFindResource("graphVertexDefaultTemplate") as ControlTemplate);
            }
        }
예제 #3
0
 public GraphVertex(GraphVertex vertex)
 {
     this.ID      = vertex.ID;
     this.Name    = vertex.Name;
     this.KAState = vertex.KAState;
     this.AB      = vertex.AB;
     this.Type    = vertex.Type;
 }
예제 #4
0
 public GraphVertex(int id, string name, bool kastate, GraphVertexType type, bool abonent = false)
 {
     ID      = id;
     Name    = name;
     KAState = kastate;
     AB      = abonent;
     Type    = type;
 }