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("<не определён>"); } }
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); } }
public GraphVertex(GraphVertex vertex) { this.ID = vertex.ID; this.Name = vertex.Name; this.KAState = vertex.KAState; this.AB = vertex.AB; this.Type = vertex.Type; }
public GraphVertex(int id, string name, bool kastate, GraphVertexType type, bool abonent = false) { ID = id; Name = name; KAState = kastate; AB = abonent; Type = type; }