Example #1
0
        public Shape RecreateShape(SavedShape savedShape)
        {
            Color newShapeColor = ColorManager.RecreateAColor(savedShape.R, savedShape.G, savedShape.B);

            if (savedShape.Shape == "Ellipse" || savedShape.Shape == "Circle")
            {
                NewShape = new Ellipse
                {
                    Width  = savedShape.W,
                    Height = savedShape.H,
                    Fill   = new SolidColorBrush(newShapeColor)
                };
                return(NewShape);
            }
            else
            {
                NewShape = new Rectangle
                {
                    Width  = savedShape.W,
                    Height = savedShape.H,
                    Fill   = new SolidColorBrush(newShapeColor)
                };
                return(NewShape);
            }
        }
        private void lb_ShapeTemplates_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            StackPanel selectedShape = lb_ShapeTemplates.SelectedItem as StackPanel;

            cb_Shapes.SelectedIndex = -1;
            if (selectedShape != null)
            {
                SavedShape savedShape = (SavedShape)selectedShape.Tag;

                tb_RedValue.Text   = savedShape.R.ToString();
                tb_GreenValue.Text = savedShape.G.ToString();
                tb_BlueValue.Text  = savedShape.B.ToString();
                tb_Width.Text      = savedShape.W.ToString();
                tb_Height.Text     = savedShape.H.ToString();
                if (savedShape.Shape == "Circle" || savedShape.Shape == "Ellipse")
                {
                    cb_Shapes.SelectedIndex = 0;
                }
                else
                {
                    cb_Shapes.SelectedIndex = 1;
                }
            }
        }