private void Button_SetUpHeight_Click(object sender, EventArgs e) { var frm = new Form_SetUpPoint("Box Height", false, true, false, 0, specialData.Y, 0); if (frm.ShowDialog() == DialogResult.OK) { specialData.Y = Conversions.ToShort(frm.IntegerInput_Y.Value); LabelX_Height.Text = string.Format("Height: {0}", specialData.Y); } }
private void Button_SetUpPos1_Click(object sender, EventArgs e) { int xpos = 0; int zpos = 0; int pointnumber = 1; var switchExpr = sender.GetHashCode(); switch (switchExpr) { case var @case when @case == Button_SetUpPos1.GetHashCode(): { xpos = specialData.X1; zpos = specialData.Z1; pointnumber = 1; break; } case var case1 when case1 == Button_SetUpPos2.GetHashCode(): { xpos = specialData.X2; zpos = specialData.Z2; pointnumber = 2; break; } } var frm = new Form_SetUpPoint("Box Edge " + Conversions.ToString(pointnumber), true, false, true, xpos, 0, zpos); if (frm.ShowDialog() != DialogResult.OK) { return; } var switchExpr1 = sender.GetHashCode(); switch (switchExpr1) { case var case2 when case2 == Button_SetUpPos1.GetHashCode(): { specialData.X1 = Conversions.ToShort(frm.IntegerInput_X.Value); specialData.Z1 = Conversions.ToShort(frm.IntegerInput_Z.Value); LabelX_Pos1.Text = string.Format("Edge 1: {0}, {1}", specialData.X1, specialData.Z1); break; } case var case3 when case3 == Button_SetUpPos2.GetHashCode(): { specialData.X2 = Conversions.ToShort(frm.IntegerInput_X.Value); specialData.Z2 = Conversions.ToShort(frm.IntegerInput_Z.Value); LabelX_Pos2.Text = string.Format("Edge 2: {0}, {1}", specialData.X2, specialData.Z2); break; } } }