public InstructionByteProvider(InstructionDataSource dataSource) { var data = dataSource.Data; this.DataSource = dataSource; if (data == null) { this.Bytes = new List <byte>(); } else { this.Bytes = new List <byte>(data); } dataSource.DataChanged += val => { if (_ignoreNextChange) { _ignoreNextChange = false; } else { this.Bytes = new List <byte>(val); } }; this.Changed += (a, b) => ApplyChanges(); }
public InstructionTextBox(InstructionDataSource dataSource) { Multiline = true; Text = dataSource.Text ?? string.Empty; this.DataSource = dataSource; dataSource.TextChanged += text => { if (_ignoreNextChange) { _ignoreNextChange = false; } else { this.Text = text; } }; this.TextChanged += (a, b) => { _ignoreNextChange = true; DataSource.Text = Text; }; }