예제 #1
0
        private void OnGenerateShapeCommand()
        {
            Shape shape = null;

            if (SelectedShapeType == ShapeType.Circle)
            {
                shape = _generateShapeHelper.GenerateCircle();
            }

            if (SelectedShapeType == ShapeType.Rectangle)
            {
                shape = _generateShapeHelper.GenerateRectangle();
            }

            if (SelectedShapeType == ShapeType.Trapezium)
            {
                shape = _generateShapeHelper.GenerateTrapezium();
            }

            if (shape != null)
            {
                ShapesFullList.Add(shape);
                ShapesFullList = new CustomList <Shape>(ShapesFullList);
                ApplyFilter();
            }
        }
예제 #2
0
        private void OnCreateShape()
        {
            BaseWindow window = null;

            if (SelectedShapeType == ShapeType.Circle)
            {
                var viewModel = new CreateCircleViewModel();
                window = new CreateCircleWindow(viewModel);
            }

            if (SelectedShapeType == ShapeType.Rectangle)
            {
                var viewModel = new CreateRectangleViewModel();
                window = new CreateRectangleWindow(viewModel);
            }

            if (SelectedShapeType == ShapeType.Trapezium)
            {
                var viewModel = new CreateTrapeziumViewModel();
                window = new CreateTrapeziumWindow(viewModel);
            }

            window.ShowDialog();

            var shape = (window.DataContext as BaseViewModel).Shape;

            if (shape != null)
            {
                ShapesFullList.Add(shape);
                ShapesFullList = new CustomList <Shape>(ShapesFullList);
                ApplyFilter();
            }
        }