예제 #1
0
        public static SolidColorBrush GetColor(this VisualSquareType type)
        {
            switch (type)
            {
            case VisualSquareType.Empty:
                return(new SolidColorBrush(Colors.LightGray));

            case VisualSquareType.Wall:
                return(new SolidColorBrush(Colors.Black));

            case VisualSquareType.StrongEmpty:
                return(new SolidColorBrush(Colors.DarkMagenta));

            case VisualSquareType.Visited:
                return(new SolidColorBrush(Colors.Red));

            case VisualSquareType.Sorrounding:
                return(new SolidColorBrush(Colors.Green));

            case VisualSquareType.StartPoint:
                return(new SolidColorBrush(Colors.Coral));

            case VisualSquareType.EndPoint:
                return(new SolidColorBrush(Colors.Cyan));

            case VisualSquareType.FinishPath:
                return(new SolidColorBrush(Colors.Yellow));

            default:
                return(new SolidColorBrush(Colors.Turquoise));
            }
        }
예제 #2
0
        public static SquareType GetTypeFromVisual(this VisualSquareType type)
        {
            switch (type)
            {
            case VisualSquareType.StartPoint:
                return(SquareType.StartPoint);

            case VisualSquareType.EndPoint:
                return(SquareType.EndPoint);

            case VisualSquareType.Empty:
            case VisualSquareType.Visited:
            case VisualSquareType.Sorrounding:
                return(SquareType.Empty);

            case VisualSquareType.Bomb:
                return(SquareType.Bomb);

            case VisualSquareType.Wall:
                return(SquareType.Wall);

            case VisualSquareType.StrongEmpty:
                return(SquareType.StrongEmpty);

            default:
                return(SquareType.Empty);
            }
        }