public DialogPin(Pin pin) { this.DataContext = this; this.pin = pin; this.InitializeComponent(); switch (this.pin.PinType) { case PinType.None: this.type.Text = Properties.Resources.PinTypeNameNone; break; case PinType.Input: this.type.Text = Properties.Resources.PinTypeNameInput; break; case PinType.Output: this.type.Text = Properties.Resources.PinTypeNameOutput; break; default: Tracer.Fail("Unknown pin type"); break; } this.name.Text = this.pin.Name; this.notation.Text = this.pin.JamNotation; this.note.Text = this.pin.Note; this.side.ItemsSource = PinDescriptor.PinSideRange; this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.pin.PinSide); this.inverted.IsChecked = this.pin.Inverted; this.bitWidth.ItemsSource = PinDescriptor.BitWidthRange; this.bitWidth.SelectedItem = this.pin.BitWidth; }
public PinDescriptor(CircuitProject circuitProject, PinType pinType) : base( circuitProject.PinSet.Create(circuitProject.ProjectSet.Project.LogicalCircuit, pinType, 1) ) { this.BitWidth = 1; this.PinSide = PinDescriptor.PinSideDescriptor((pinType == PinType.Input) ? LogicCircuit.PinSide.Left : LogicCircuit.PinSide.Right); this.Circuit.Note = Properties.Resources.ToolTipDescriptorPin; }
public SensorDescriptor(CircuitProject circuitProject) : base(circuitProject.SensorSet.Create(LogicCircuit.SensorType.Random, 1, LogicCircuit.PinSide.Right, string.Empty)) { this.sensorType = SensorDescriptor.sensorTypes.First(t => t.Value == this.Circuit.SensorType); this.BitWidth = this.Circuit.BitWidth; this.pinSide = PinDescriptor.PinSideDescriptor(this.Circuit.PinSide); this.Notation = string.Empty; this.Circuit.Note = Properties.Resources.ToolTipDescriptorSensor; }
public DialogSensor(Sensor sensor) { this.sensor = sensor; this.SensorTypes = SensorDescriptor.SensorTypes; SensorType type = this.sensor.SensorType; this.IsLoop = (type != SensorType.Series); if (type == SensorType.Loop) { type = SensorType.Series; } this.SelectedSensorType = this.SensorTypes.First(t => t.Value == type); this.SeriesData = (type == SensorType.Series) ? this.sensor.Data : Sensor.DefaultSeriesData; int min = Sensor.DefaultRandomMinInterval; int max = Sensor.DefaultRandomMaxInterval; if (type == SensorType.Random) { SensorPoint point; if (Sensor.TryParsePoint(this.sensor.Data, 32, out point)) { min = point.Tick; max = point.Value; } } this.RandomMin = min.ToString(Properties.Resources.Culture); this.RandomMax = max.ToString(Properties.Resources.Culture); if (type == SensorType.Manual) { string text = this.sensor.Data; int value; if (string.IsNullOrEmpty(text) || !int.TryParse(text, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out value)) { value = 0; } this.ManualInitialValue = Constant.Normalize(value, this.sensor.BitWidth).ToString("X", CultureInfo.InvariantCulture); } else { this.ManualInitialValue = "0"; } this.DataContext = this; this.InitializeComponent(); this.bitWidth.ItemsSource = PinDescriptor.BitWidthRange; this.bitWidth.SelectedItem = this.sensor.BitWidth; this.side.ItemsSource = PinDescriptor.PinSideRange; this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.sensor.PinSide); this.notation.Text = this.sensor.Notation; this.note.Text = this.sensor.Note; }
public DialogButton(CircuitButton button) { this.button = button; this.DataContext = this; this.InitializeComponent(); this.name.Text = this.button.Notation; this.isToggle.IsChecked = this.button.IsToggle; this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.button.PinSide); this.note.Text = this.button.Note; }
public DialogSound(Sound sound) { this.sound = sound; this.DataContext = this; this.InitializeComponent(); this.side.ItemsSource = PinDescriptor.PinSideRange; this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.sound.PinSide); this.notation.Text = this.sound.Notation; this.note.Text = this.sound.Note; }
public DialogConstant(Constant constant) { this.DataContext = this; this.constant = constant; this.InitializeComponent(); this.value.Text = constant.ConstantValue.ToString("X", CultureInfo.InvariantCulture); this.bitWidth.ItemsSource = PinDescriptor.BitWidthRange; this.bitWidth.SelectedItem = this.constant.BitWidth; this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.constant.PinSide); this.note.Text = constant.Note; }
public DialogButton(CircuitButton button) { this.button = button; this.DataContext = this; this.InitializeComponent(); this.name.Text = this.button.Notation; this.isToggle.IsChecked = this.button.IsToggle; this.side.SelectedItem = PinDescriptor.PinSideDescriptor(this.button.PinSide); this.inverted.IsChecked = this.button.Inverted; this.keyGesture.Key = button.Key; this.keyGesture.ModifierKeys = button.ModifierKeys; this.keyGesture.Refresh(); this.note.Text = this.button.Note; }
public SoundDescriptor(CircuitProject circuitProject) : base(circuitProject.SoundSet.Create(LogicCircuit.PinSide.Left, string.Empty)) { this.pinSide = PinDescriptor.PinSideDescriptor(this.Circuit.PinSide); this.Notation = string.Empty; }
public ConstantDescriptor(CircuitProject circuitProject) : base(circuitProject.ConstantSet.Create(1, 0, LogicCircuit.PinSide.Right)) { this.BitWidth = 1; this.Value = "0"; this.pinSide = PinDescriptor.PinSideDescriptor(LogicCircuit.PinSide.Right); }
public ButtonDescriptor(CircuitProject circuitProject) : base(circuitProject.CircuitButtonSet.Create(string.Empty, false, LogicCircuit.PinSide.Right)) { this.Notation = string.Empty; this.pinSide = PinDescriptor.PinSideDescriptor(LogicCircuit.PinSide.Right); }