private void btnAdd_Click(object sender, EventArgs e) { var ucr = new UCRecord(new Recording()); ucr.OnLog += Ucr_OnLog; ucr.OnDelete += Ucr_OnDelete; flowLayoutPanel1.Controls.Add(ucr); }
private void Ucr_OnDelete(UCRecord o, Recording recording) { if (MessageBox.Show(string.Format("Delete {0}?", recording.Title), string.Empty, MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } flowLayoutPanel1.Controls.Remove(o); }
void updateRecordingControls() { flowLayoutPanel1.SuspendLayout(); flowLayoutPanel1.Controls.Clear(); var masterClass = (MasterClass)_cf.GetCustomObjectV2(typeof(MasterClass)); foreach (var recording in masterClass.Recordings) { var ucr = new UCRecord(recording); ucr.OnLog += Ucr_OnLog; ucr.OnDelete += Ucr_OnDelete; flowLayoutPanel1.Controls.Add(ucr); } flowLayoutPanel1.ResumeLayout(); }
public override void SendCommand(string windowCommand, params string[] values) { if (values.Length != 1) { throw new Exception("Requires 1 parameter"); } UCRecord ucr = null; foreach (UCRecord ucrTmp in flowLayoutPanel1.Controls) { if (ucrTmp.GetConfig().Title.Equals(values[0], StringComparison.InvariantCultureIgnoreCase)) { ucr = ucrTmp; break; } } if (ucr == null) { throw new Exception(string.Format("Unable to find a recording named '{0}'", values[0])); } if (windowCommand.Equals("Play", StringComparison.InvariantCultureIgnoreCase)) { ucr.Play(); } else if (windowCommand.Equals("Stop", StringComparison.InvariantCultureIgnoreCase)) { ucr.Stop(); } else { base.SendCommand(windowCommand, values); } }