private void SelectHexMessageFunction(SelectHexMessage msg) { HexModel nextSelectedHexModel = GetHexModel(msg.Column, msg.Row); HexModel previousSelectedHexModel = ListHexModel.FirstOrDefault(x => x.Selected); if (previousSelectedHexModel != null) { previousSelectedHexModel.UnselectHex(); if (previousSelectedHexModel != nextSelectedHexModel) { nextSelectedHexModel.SelectHex(); } } else { nextSelectedHexModel.SelectHex(); } }
public HexModel GetHexModel(int column, int row) { return(ListHexModel.FirstOrDefault(x => x.Column == column && x.Row == row)); }