/// <summary> /// Buttonfunction for adding a point to the diagram, reads a point and calls class+method that redraws the current diagram considering it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddPoint_Click(object sender, RoutedEventArgs e) { double xloc = input.ParseStringToDouble(txtXcoord.Text); double yloc = input.ParseStringToDouble(txtYcoord.Text); diagram.AddNewPoints(xloc, yloc, can_diagram, lstPoints); txtXcoord.Text = string.Empty; txtYcoord.Text = string.Empty; }
/// <summary> /// create a point in the diagram using the appropriate functions in the utility classes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCreatePoint_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtPointXCoord.Text) && !string.IsNullOrEmpty(txtPointYcoord.Text)) { int xValue = controller.ParseStringToInt(txtPointXCoord.Text); int yValue = controller.ParseStringToInt(txtPointYcoord.Text); bool withinBoundaries = controller.PointWithinDiagram(xValue, yValue, draws.MaxX, draws.MaxY, pan_Diagram); if (withinBoundaries) { // add new points and update the list dependent on the sorting direction draws.AddNewPoints(xValue, yValue, lstPoints, pan_Diagram, noDivX, noDivY, intervalX, intervalY, diagramtitle); txtPointXCoord.Text = string.Empty; txtPointYcoord.Text = string.Empty; } } }