void Create(DbTypesEnum enumValue) { var type = ByteParserFactory.Create(enumValue); SingleFieldExplporer newItem = new SingleFieldExplporer(); newItem.EnumValue = enumValue; newItem.CustomDisplayText = type.TypeName; newItem.ButtonText = "Add"; newItem.CustomButtonPressedCommand = new RelayCommand <SingleFieldExplporer>(OnButtonPressed); Fields.Add(newItem); }
void UpdateViewModel(SingleFieldExplporer viewModelRef, byte[] data, int index) { var parser = ByteParserFactory.Create(viewModelRef.EnumValue); var result = parser.TryDecode(data, index, out string value, out var _, out string error); if (result == false) { viewModelRef.ValueText = "Error:" + error; viewModelRef.BackgroundColour = new SolidColorBrush(Colors.Pink); } else { viewModelRef.ValueText = value; viewModelRef.BackgroundColour = new SolidColorBrush(Colors.White); } }
void OnButtonPressed(SingleFieldExplporer explporer) { _tableDefEditor.AddNewDefinitionItem(explporer.EnumValue); }