コード例 #1
0
 private void HandleSimpleEdgeTypeChange(EdgeType edgeType, int lenght, string errorMessage)
 {
     if (inputHandler.SelectedElement is Edge selectedEdge)
     {
         if (inputHandler.SelectedPolygon.ChangeEdgeType(selectedEdge, edgeType, lenght))
         {
             UpdateButtons();
             drawingArea.Refresh();
         }
         else
         {
             InformationDialog.Show(errorMessage);
         }
     }
 }
コード例 #2
0
 private void DeleteSelectedVertice(object sender, EventArgs e)
 {
     if (inputHandler.SelectedElement is Vertice v)
     {
         if (inputHandler.SelectedPolygon.DeleteVertice(v))
         {
             inputHandler.ClearSelected();
             drawingArea.Refresh();
         }
         else
         {
             InformationDialog.Show(ErrorMessages.CanNotDeleteVertice);
         }
     }
     FakeButton.Focus();
 }
コード例 #3
0
        private void StopDrawingPolygon()
        {
            FakeButton.Focus();
            IPolygon polygonUnderCreation = polygons.Last();

            if (polygonUnderCreation.Vertices.Count <= 3)
            {
                InformationDialog.Show(ErrorMessages.PolygonMustHaveAtLeastThreeVertices);
                return;
            }

            DetachInputHandlerEventsFromDrawingArea();

            polygonUnderCreation.DeleteVertice(polygonUnderCreation.Vertices.Last());
            polygonUnderCreation.CreateEdgeBetweenVertices(polygonUnderCreation.Vertices.First(), polygonUnderCreation.Vertices.Last());

            inputHandler = GetStandardInputHandler();
            AttachInputHandlerEventsToDrawingArea();

            UpdateButtons();
            drawingArea.Refresh();
        }