void Init() { A.Value = osc.A; D.Value = osc.D; S.Value = osc.S; R.Value = osc.R; randomPhase.IsChecked = osc.randomPhase; Volume.Value = osc.Volume; switch (osc.Type) { case OscillatorType.sine: TypeOscSin.IsChecked = true; break; case OscillatorType.triangle: TypeOscTri.IsChecked = true; break; case OscillatorType.square: TypeOscSq.IsChecked = true; break; case OscillatorType.saw: TypeOscSaw.IsChecked = true; break; case OscillatorType.whiteNoise: TypeOscWhite.IsChecked = true; break; case OscillatorType.pinkNoise: TypeOscPink.IsChecked = true; break; } checkSquareRatio(); Pitchs.Children.Clear(); int i = 0; foreach (var x in osc.Pitchs) { var pitchui = new PitchUI { Value = x }; pitchui.Tag = i++; pitchui.ValueChanged += Pitchui_ValueChanged; Pitchs.Children.Add(pitchui); } var but = new ButtonPretty { Text = "Dodaj" }; but.Click += But_Click; Pitchs.Children.Add(but); }
private void Pitchui_ValueChanged(PitchUI obj) { osc.Pitchs[(int)obj.Tag] = obj.Value; }