private void ElementRemoved(object sender, Circuit.ElementEventArgs e) { ElementControl control = (ElementControl)e.Element.Tag; control.Element.LayoutChanged -= ElementLayoutChanged; wires.Children.Remove(control); symbols.Children.Remove(control); if (control.Selected) { RaiseSelectionChanged(); } }
private void OnElementRemoved(object sender, Circuit.ElementEventArgs e) { if (e.Element is Circuit.Symbol && ((Circuit.Symbol)e.Element).Component is Probe) { Probe probe = (Probe)((Circuit.Symbol)e.Element).Component; Scope.Signals.Remove(probe.Signal); lock (sync) { probes.Remove(probe); if (simulation != null) { simulation.Output = probes.Select(i => i.V).Concat(OutputChannels.Select(i => i.Signal)); } } } }
private void ElementAdded(object sender, Circuit.ElementEventArgs e) { ElementControl control = ElementControl.New(e.Element); if (control is WireControl) { wires.Children.Add(control); } else if (control is SymbolControl) { symbols.Children.Add(control); } else { throw new InvalidOperationException("Unknown element type"); } control.Element.LayoutChanged += ElementLayoutChanged; ElementLayoutChanged(control.Element, null); }
private void OnElementAdded(object sender, Circuit.ElementEventArgs e) { if (e.Element is Circuit.Symbol && ((Circuit.Symbol)e.Element).Component is Probe) { Probe probe = (Probe)((Circuit.Symbol)e.Element).Component; probe.Signal = new Signal() { Name = probe.V.ToString(), Pen = MapToSignalPen(probe.Color) }; Scope.Signals.Add(probe.Signal); Scope.SelectedSignal = probe.Signal; lock (sync) { probes.Add(probe); if (simulation != null) { simulation.Output = probes.Select(i => i.V).Concat(OutputChannels.Select(i => i.Signal)); } } } }