private void OnSiSVectorsChanged(object sender, EventArgs e) { var tfV = Uc["sis_v"] as SvTField; var tfW = Uc["sis_w"] as SvTField; var vToW = ((SvButton)Uc["sis_btn_wv"]).IsEnabled; bool og, on; SimpleVector <double> pV; double p, ev, ew; var rd = SignalTheoryBasicsMath.SisFrom(tfV.Text, tfW.Text, vToW, out og, out on, out p, out pV, out ev, out ew); if (!rd) { return; } var tfog = Uc["sis_ortog"] as SvSwitch; var tfon = Uc["sis_orton"] as SvSwitch; var tfp = Uc["sis_p"] as SvTField; var tfP = Uc["sis_P"] as SvTField; var tfev = Uc["sis_ev"] as SvTField; var tfew = Uc["sis_ew"] as SvTField; tfog.Selected = og; tfon.Selected = on; tfp.Text = p.ToString(); tfP.Text = pV.ToString(); tfev.Text = ev.ToString(); tfew.Text = ew.ToString(); }
private void OnConvertRight(object source, EventArgs args) { try { Debug.WriteLine("To Right Conv"); var r = SignalTheoryBasicsMath.CalcDb(Uc, false).ToString(); Uc["db_p"].GetSourceAs <Entry>().Text = r; } catch (Exception e) { Debug.WriteLine(e.Message); } }
private void OnHistCalc(object o, EventArgs eventArgs) { try { var gl = Uc["h_l"] as SvGrid; var gr = Uc["h_r"] as SvGrid; if (gl == null || gr == null) { throw new NullReferenceException("h_l or h_r not found!"); } var r = SignalTheoryBasicsMath.GetHistResults(gl.Components, gr.Components); var modal = new HistResultModal(r.ToList()); modal.Show(); } catch (Exception e) { Debug.WriteLine(e.Message); } }
private void OnSaProbesValueChanged(object sender, TextChangedEventArgs e) { try { var grid = Uc["sa_probes"] as SvGrid; var probes = grid.Components; var list = new List <double>(probes.Length); foreach (var t in from Entry p in probes select p.Text) { int v; if (string.IsNullOrWhiteSpace(t)) { throw new ArgumentException("Empty input"); } if (!int.TryParse(t, out v)) { throw new ArgumentException($"Wrong input: {v}"); } list.Add(v); } var d = new Dictionary <SignalTheoryBasicsMath.SignalDataType, Entry>(); var rg = Uc["sa_results"] as SvGrid; foreach (var v in rg.Components) { var entry = v as Entry; SignalTheoryBasicsMath.SignalDataType type; if (Enum.TryParse(entry?.Placeholder, true, out type)) { d.Add(type, entry); } } SignalTheoryBasicsMath.AnalyzeSignal(list, ref d); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }