private void addButton_Click(object sender, EventArgs e) { var point = new DetectorPoint { xP = 0.5f, yP = 0.5f }; AddPoint(point); }
public void AddPoint(DetectorPoint p) { var pt = points.Count; p.OnValueChange += (v) => { if (v) { PointTrigger(pt); } }; points.Add(new PointControllerDrums(p)); pointControllerPanel.Controls.Add(points[points.Count - 1]); }
//public GuitarPlayer() //{ // InitializeComponent(); //} private void Port_SelectedIndexChanged(object sender, EventArgs e) { this.controller?.Dispose(); flowLayoutPanel1.Controls.Clear(); var controller = new MotorController((string)portSelector.SelectedItem); flowLayoutPanel1.SuspendLayout(); var tab = 0; foreach (var x in controller.Offsets) { var p = new DetectorPoint(); p.midiNote = tab; var pc = new PointControllerGuitar(p); pc.offsetUpDown.Tag = tab; pc.offsetUpDown.TabIndex = tab; pc.offsetUpDown.Maximum = 32767; pc.offsetUpDown.Minimum = -32768; pc.offsetUpDown.Value = x; pc.offsetUpDown.ValueChanged += UpDown_ValueChanged; var t = tab; pc.toggleButton.Click += (o, ea) => { if (controller.State[t]) { pc.toggleButton.Checked = false; pc.toggleButton.CheckState = CheckState.Unchecked; } else { pc.toggleButton.Checked = true; pc.toggleButton.CheckState = CheckState.Checked; } controller.State[t] = pc.toggleButton.Checked; controller.SendState(); }; flowLayoutPanel1.Controls.Add(pc); tab++; } flowLayoutPanel1.ResumeLayout(false); flowLayoutPanel1.PerformLayout(); try { downPosInput.Value = controller.DownPos; upPosInput.Value = controller.UpPos; } catch (Exception) { } this.controller = controller; }
private void Deserialize(string filename) { string data; using (var reader = new System.IO.StreamReader(filename)) data = reader.ReadToEnd(); var dta = DtxCS.DTX.FromDtaString(data); var array = dta.Array("points"); for (int i = 1; i < array.Count; i++) { var p = new DetectorPoint(); p.Deserialize(array.Array(i)); AddPoint(p); } }
public PointControllerGuitar(DetectorPoint p) { this.p = p; InitializeComponent(); UpdateValues(); }