private void Polygon_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            var polygonClicked = sender as Polygon;

            var window = new PolygonWindow(polygonClicked)
            {
                Owner = this
            };

            window.ShowDialog();

            UpdateObjectValues(Cnv.Children.IndexOf(polygonClicked), window.ResultPolygon);
            e.Handled = true;
        }
        private void PolygonSettings(Point mousePosition)
        {
            var window = new PolygonWindow(new PointCollection(points))
            {
                Owner = this
            };

            window.ShowDialog();

            var polygon = window.ResultPolygon;

            if (polygon != null)
            {
                polygon.MouseLeftButtonUp += Polygon_MouseLeftButtonUp;
                Cnv.Children.Add(polygon);
                undoStack.Push(new Tuple <string, int, object>("add", Cnv.Children.IndexOf(polygon), polygon));
            }
        }