예제 #1
0
        private void rightArrowClicked_old(object sender, RoutedEventArgs e)
        {
            BlockArrow ba  = sender as BlockArrow;
            Grid       p   = ba.Parent as Grid;
            feedItem   fi  = p.Parent as feedItem;
            Master     wnd = (Master)Window.GetWindow(this);

            wnd.mainFrame.NavigationService.Navigate(getWebPage(fi.label.Content.ToString()));
            //goBackbtm.Visibility = Visibility.Visible;
        }    //
예제 #2
0
        private void ArrowColorBinding(Vehicle V, BlockArrow arrow, int index)
        {
            Binding myBinding = new Binding();

            myBinding.Source = V;
            myBinding.Path   = new System.Windows.PropertyPath("Arrows");
            ArrowsColorConverter converter = new ArrowsColorConverter();

            converter.DefaultColor = arrow.Fill;
            converter.Index        = index;
            myBinding.Converter    = converter;
            arrow.SetBinding(Shape.FillProperty, myBinding);
        }
예제 #3
0
    private void ShowObject()
    {
        switch (idx)
        {
        case 1:
            BlockArrow.SetActive(true);
            break;

        case 2:
            BlockArrow.SetActive(false);
            break;

        case 6:
            AnswerBlockArrow.SetActive(true);
            break;
        }
    }
예제 #4
0
 private void Awake()
 {
     TutorialText = new string[]
     {
         "WASD를 눌러 움직일 수 있어요",
         "블럭을 밀어 옮길 수 있어요",
         "R키를 눌러 다시 시작 할 수 있어요",
         "느낌표 버튼을 눌러 힌트를 받으세요",
         "왼쪽 위 미션을 수행하세요",
         "ESC키를 눌러 일시정지 할 수 있어요",
         "정답블럭칸에 START를 맞춰보세요!"
     };
     content.text = TutorialText[idx];
     BlockArrow.SetActive(false);
     AnswerBlockArrow.SetActive(false);
     FindObjectOfType <BlockMove>().canInput = false;
 }
예제 #5
0
        private static string AddFigure(eFigure figure, double width, double height, Primitive[] properties)
        {
            Type   GraphicsWindowType = typeof(GraphicsWindow);
            Type   ShapesType         = typeof(Shapes);
            Canvas _mainCanvas;
            Dictionary <string, UIElement> _objectsMap;
            string shapeName;

            try
            {
                ExtractDll();

                MethodInfo method = GraphicsWindowType.GetMethod("VerifyAccess", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);
                method.Invoke(null, new object[] { });

                method    = ShapesType.GetMethod("GenerateNewName", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);
                shapeName = method.Invoke(null, new object[] { "Figure" }).ToString();

                _objectsMap = (Dictionary <string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                _mainCanvas = (Canvas)GraphicsWindowType.GetField("_mainCanvas", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);

                InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate
                {
                    try
                    {
                        switch (figure)
                        {
                        case eFigure.ARC:
                            {
                                Arc shape              = new Arc();
                                shape.Name             = shapeName;
                                shape.Width            = width;
                                shape.Height           = height;
                                _objectsMap[shapeName] = shape;
                                _mainCanvas.Children.Add(shape);

                                shape.Fill            = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                shape.Stroke          = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                shape.StrokeThickness = GraphicsWindow.PenWidth;

                                shape.StartAngle       = properties[0];
                                shape.EndAngle         = properties[1];
                                shape.ArcThickness     = properties[2];
                                shape.ArcThicknessUnit = Microsoft.Expression.Media.UnitType.Pixel;
                            }
                            break;

                        case eFigure.BLOCKARROW:
                            {
                                BlockArrow shape       = new BlockArrow();
                                shape.Name             = shapeName;
                                shape.Width            = width;
                                shape.Height           = height;
                                _objectsMap[shapeName] = shape;
                                _mainCanvas.Children.Add(shape);

                                shape.Fill            = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                shape.Stroke          = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                shape.StrokeThickness = GraphicsWindow.PenWidth;

                                shape.ArrowBodySize  = properties[0];
                                shape.ArrowheadAngle = properties[1];
                                switch (((string)properties[2]).ToLower())
                                {
                                case "up":
                                    shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Up;
                                    break;

                                case "down":
                                    shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Down;
                                    break;

                                case "left":
                                    shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Left;
                                    break;

                                case "right":
                                    shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Right;
                                    break;
                                }
                            }
                            break;

                        case eFigure.REGULARPOLYGON:
                            {
                                RegularPolygon shape   = new RegularPolygon();
                                shape.Name             = shapeName;
                                shape.Width            = width;
                                shape.Height           = height;
                                _objectsMap[shapeName] = shape;
                                _mainCanvas.Children.Add(shape);

                                shape.Fill            = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                shape.Stroke          = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                shape.StrokeThickness = GraphicsWindow.PenWidth;

                                shape.PointCount  = properties[0];
                                shape.InnerRadius = properties[1];
                            }
                            break;

                        case eFigure.CALLOUT:
                            {
                                Callout shape          = new Callout();
                                shape.Name             = shapeName;
                                shape.Width            = width;
                                shape.Height           = height;
                                _objectsMap[shapeName] = shape;
                                _mainCanvas.Children.Add(shape);

                                shape.Fill            = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                shape.Stroke          = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                shape.StrokeThickness = GraphicsWindow.PenWidth;
                                shape.FontFamily      = new FontFamily(GraphicsWindow.FontName);
                                shape.FontSize        = GraphicsWindow.FontSize;
                                shape.FontStyle       = GraphicsWindow.FontItalic ? FontStyles.Italic : FontStyles.Normal;
                                shape.FontWeight      = GraphicsWindow.FontBold ? FontWeights.Bold : FontWeights.Normal;
                                shape.Foreground      = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                shape.Background      = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));

                                shape.Content = properties[0];
                                switch (((string)properties[1]).ToLower())
                                {
                                case "cloud":
                                    shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Cloud;
                                    break;

                                case "oval":
                                    shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Oval;
                                    break;

                                case "rectangle":
                                    shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Rectangle;
                                    break;

                                case "roundedrectangle":
                                    shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.RoundedRectangle;
                                    break;
                                }
                                Primitive anchor = properties[2];
                                Point point      = new Point(0, 1.25);
                                if (SBArray.GetItemCount(anchor) == 2)
                                {
                                    Primitive indices = SBArray.GetAllIndices(anchor);
                                    point.X           = anchor[indices[1]];
                                    point.Y           = anchor[indices[2]];
                                }
                                shape.AnchorPoint = point;
                            }
                            break;

                        case eFigure.LINEARROW:
                            {
                                LineArrow shape        = new LineArrow();
                                shape.Name             = shapeName;
                                shape.Width            = width;
                                shape.Height           = height;
                                _objectsMap[shapeName] = shape;
                                _mainCanvas.Children.Add(shape);

                                shape.Fill            = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                shape.Stroke          = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                shape.StrokeThickness = GraphicsWindow.PenWidth;

                                shape.ArrowSize  = properties[0];
                                shape.BendAmount = properties[1];
                                switch (((string)properties[2]).ToLower())
                                {
                                case "none":
                                    shape.StartArrow = Microsoft.Expression.Media.ArrowType.NoArrow;
                                    break;

                                case "arrow":
                                    shape.StartArrow = Microsoft.Expression.Media.ArrowType.Arrow;
                                    break;

                                case "open":
                                    shape.StartArrow = Microsoft.Expression.Media.ArrowType.OpenArrow;
                                    break;

                                case "oval":
                                    shape.StartArrow = Microsoft.Expression.Media.ArrowType.OvalArrow;
                                    break;

                                case "stealth":
                                    shape.StartArrow = Microsoft.Expression.Media.ArrowType.StealthArrow;
                                    break;
                                }
                                switch (((string)properties[3]).ToLower())
                                {
                                case "none":
                                    shape.EndArrow = Microsoft.Expression.Media.ArrowType.NoArrow;
                                    break;

                                case "arrow":
                                    shape.EndArrow = Microsoft.Expression.Media.ArrowType.Arrow;
                                    break;

                                case "open":
                                    shape.EndArrow = Microsoft.Expression.Media.ArrowType.OpenArrow;
                                    break;

                                case "oval":
                                    shape.EndArrow = Microsoft.Expression.Media.ArrowType.OvalArrow;
                                    break;

                                case "stealth":
                                    shape.EndArrow = Microsoft.Expression.Media.ArrowType.StealthArrow;
                                    break;
                                }
                                switch (((string)properties[4]).ToLower())
                                {
                                case "bottomleft":
                                    shape.StartCorner = Microsoft.Expression.Media.CornerType.BottomLeft;
                                    break;

                                case "bottomright":
                                    shape.StartCorner = Microsoft.Expression.Media.CornerType.BottomRight;
                                    break;

                                case "topleft":
                                    shape.StartCorner = Microsoft.Expression.Media.CornerType.TopLeft;
                                    break;

                                case "topright":
                                    shape.StartCorner = Microsoft.Expression.Media.CornerType.TopRight;
                                    break;
                                }
                            }
                            break;
                        }
                        return(shapeName);
                    }
                    catch (Exception ex)
                    {
                        Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        return("");
                    }
                });
                return(FastThread.InvokeWithReturn(ret).ToString());
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                return("");
            }
        }
예제 #6
0
파일: Figures.cs 프로젝트: litdev1/LitDev
        private static string AddFigure(eFigure figure, double width, double height, Primitive[] properties)
        {
            Type GraphicsWindowType = typeof(GraphicsWindow);
            Type ShapesType = typeof(Shapes);
            Canvas _mainCanvas;
            Dictionary<string, UIElement> _objectsMap;
            string shapeName;

            try
            {
                ExtractDll();

                MethodInfo method = GraphicsWindowType.GetMethod("VerifyAccess", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);
                method.Invoke(null, new object[] { });

                method = ShapesType.GetMethod("GenerateNewName", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase);
                shapeName = method.Invoke(null, new object[] { "Figure" }).ToString();

                _objectsMap = (Dictionary<string, UIElement>)GraphicsWindowType.GetField("_objectsMap", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);
                _mainCanvas = (Canvas)GraphicsWindowType.GetField("_mainCanvas", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreCase).GetValue(null);

                InvokeHelperWithReturn ret = new InvokeHelperWithReturn(delegate
                {
                    try
                    {
                        switch (figure)
                        {
                            case eFigure.ARC:
                                {
                                    Arc shape = new Arc();
                                    shape.Name = shapeName;
                                    shape.Width = width;
                                    shape.Height = height;
                                    _objectsMap[shapeName] = shape;
                                    _mainCanvas.Children.Add(shape);

                                    shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                    shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                    shape.StrokeThickness = GraphicsWindow.PenWidth;

                                    shape.StartAngle = properties[0];
                                    shape.EndAngle = properties[1];
                                    shape.ArcThickness = properties[2];
                                    shape.ArcThicknessUnit = Microsoft.Expression.Media.UnitType.Pixel;
                                }
                                break;
                            case eFigure.BLOCKARROW:
                                {
                                    BlockArrow shape = new BlockArrow();
                                    shape.Name = shapeName;
                                    shape.Width = width;
                                    shape.Height = height;
                                    _objectsMap[shapeName] = shape;
                                    _mainCanvas.Children.Add(shape);

                                    shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                    shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                    shape.StrokeThickness = GraphicsWindow.PenWidth;

                                    shape.ArrowBodySize = properties[0];
                                    shape.ArrowheadAngle = properties[1];
                                    switch (((string)properties[2]).ToLower())
                                    {
                                        case "up":
                                            shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Up;
                                            break;
                                        case "down":
                                            shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Down;
                                            break;
                                        case "left":
                                            shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Left;
                                            break;
                                        case "right":
                                            shape.Orientation = Microsoft.Expression.Media.ArrowOrientation.Right;
                                            break;
                                    }
                                }
                                break;
                            case eFigure.REGULARPOLYGON:
                                {
                                    RegularPolygon shape = new RegularPolygon();
                                    shape.Name = shapeName;
                                    shape.Width = width;
                                    shape.Height = height;
                                    _objectsMap[shapeName] = shape;
                                    _mainCanvas.Children.Add(shape);

                                    shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                    shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                    shape.StrokeThickness = GraphicsWindow.PenWidth;

                                    shape.PointCount = properties[0];
                                    shape.InnerRadius = properties[1];
                                }
                                break;
                            case eFigure.CALLOUT:
                                {
                                    Callout shape = new Callout();
                                    shape.Name = shapeName;
                                    shape.Width = width;
                                    shape.Height = height;
                                    _objectsMap[shapeName] = shape;
                                    _mainCanvas.Children.Add(shape);

                                    shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                    shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                    shape.StrokeThickness = GraphicsWindow.PenWidth;
                                    shape.FontFamily = new FontFamily(GraphicsWindow.FontName);
                                    shape.FontSize = GraphicsWindow.FontSize;
                                    shape.FontStyle = GraphicsWindow.FontItalic ? FontStyles.Italic : FontStyles.Normal;
                                    shape.FontWeight = GraphicsWindow.FontBold ? FontWeights.Bold : FontWeights.Normal;
                                    shape.Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                    shape.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));

                                    shape.Content = properties[0];
                                    switch (((string)properties[1]).ToLower())
                                    {
                                        case "cloud":
                                            shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Cloud;
                                            break;
                                        case "oval":
                                            shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Oval;
                                            break;
                                        case "rectangle":
                                            shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.Rectangle;
                                            break;
                                        case "roundedrectangle":
                                            shape.CalloutStyle = Microsoft.Expression.Media.CalloutStyle.RoundedRectangle;
                                            break;
                                    }
                                    Primitive anchor = properties[2];
                                    Point point = new Point(0,1.25);
                                    if (SBArray.GetItemCount(anchor) == 2)
                                    {
                                        Primitive indices = SBArray.GetAllIndices(anchor);
                                        point.X = anchor[indices[1]];
                                        point.Y = anchor[indices[2]];
                                    }
                                    shape.AnchorPoint = point;
                                }
                                break;
                            case eFigure.LINEARROW:
                                {
                                    LineArrow shape = new LineArrow();
                                    shape.Name = shapeName;
                                    shape.Width = width;
                                    shape.Height = height;
                                    _objectsMap[shapeName] = shape;
                                    _mainCanvas.Children.Add(shape);

                                    shape.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.BrushColor));
                                    shape.Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(GraphicsWindow.PenColor));
                                    shape.StrokeThickness = GraphicsWindow.PenWidth;

                                    shape.ArrowSize = properties[0];
                                    shape.BendAmount = properties[1];
                                    switch (((string)properties[2]).ToLower())
                                    {
                                        case "none":
                                            shape.StartArrow = Microsoft.Expression.Media.ArrowType.NoArrow;
                                            break;
                                        case "arrow":
                                            shape.StartArrow = Microsoft.Expression.Media.ArrowType.Arrow;
                                            break;
                                        case "open":
                                            shape.StartArrow = Microsoft.Expression.Media.ArrowType.OpenArrow;
                                            break;
                                        case "oval":
                                            shape.StartArrow = Microsoft.Expression.Media.ArrowType.OvalArrow;
                                            break;
                                        case "stealth":
                                            shape.StartArrow = Microsoft.Expression.Media.ArrowType.StealthArrow;
                                            break;
                                    }
                                    switch (((string)properties[3]).ToLower())
                                    {
                                        case "none":
                                            shape.EndArrow = Microsoft.Expression.Media.ArrowType.NoArrow;
                                            break;
                                        case "arrow":
                                            shape.EndArrow = Microsoft.Expression.Media.ArrowType.Arrow;
                                            break;
                                        case "open":
                                            shape.EndArrow = Microsoft.Expression.Media.ArrowType.OpenArrow;
                                            break;
                                        case "oval":
                                            shape.EndArrow = Microsoft.Expression.Media.ArrowType.OvalArrow;
                                            break;
                                        case "stealth":
                                            shape.EndArrow = Microsoft.Expression.Media.ArrowType.StealthArrow;
                                            break;
                                    }
                                    switch (((string)properties[4]).ToLower())
                                    {
                                        case "bottomleft":
                                            shape.StartCorner = Microsoft.Expression.Media.CornerType.BottomLeft;
                                            break;
                                        case "bottomright":
                                            shape.StartCorner = Microsoft.Expression.Media.CornerType.BottomRight;
                                            break;
                                        case "topleft":
                                            shape.StartCorner = Microsoft.Expression.Media.CornerType.TopLeft;
                                            break;
                                        case "topright":
                                            shape.StartCorner = Microsoft.Expression.Media.CornerType.TopRight;
                                            break;
                                    }
                                }
                                break;
                        }
                        return shapeName;
                    }
                    catch (Exception ex)
                    {
                        Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                        return "";
                    }
                });
                return FastThread.InvokeWithReturn(ret).ToString();
            }
            catch (Exception ex)
            {
                Utilities.OnError(Utilities.GetCurrentMethod(), ex);
                return "";
            }
        }