public Spectrum() { this.InitializeComponent(); this.Timer = new Timer(); this.Timer.Interval = UPDATE_INTERVAL; this.Timer.AutoReset = false; this.Timer.Elapsed += this.OnElapsed; if (Enabled != null) { Enabled.ConnectValue(value => { if (value) { this.Visibility = Visibility.Visible; this.Timer.Start(); } else { this.Visibility = Visibility.Collapsed; this.Timer.Stop(); } }); } if (Bars != null) { Bars.ConnectValue(value => this.Configure( SpectrumBehaviourConfiguration.GetBars(value), SpectrumBehaviourConfiguration.GetWidth(value) ) ); } }
private void OnValueChanged(object sender, EventArgs e) { var task = Windows.Invoke(() => { //Fix the width so all 2d math is integer. this.MinWidth = SpectrumBehaviourConfiguration.GetWidth(BarCount.Value); }); }
public Spectrum() { this.InitializeComponent(); if (BarCount != null) { //Fix the width so all 2d math is integer. this.MinWidth = SpectrumBehaviourConfiguration.GetWidth(BarCount.Value); BarCount.ValueChanged += this.OnValueChanged; } }