This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private TextBlock CreateCellTextBlock(Cell cell) | |
| { | |
| TextBlock cellTextBlock = new TextBlock(); | |
| cellTextBlock.DataContext = cell; | |
| cellTextBlock.InputBindings.Add(CreateMouseClickInputBinding(cell)); | |
| cellTextBlock.SetBinding( | |
| TextBlock.BackgroundProperty, | |
| CreateCellAliveBinding() | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private Binding CreateCellAliveBinding() | |
| { | |
| return new Binding | |
| { | |
| Path = new PropertyPath("Alive"), | |
| Mode = BindingMode.TwoWay, | |
| Converter = new LifeToColourConverter( | |
| aliveColour: Brushes.Black, | |
| deadColour: Brushes.White | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ObservableBase : INotifyPropertyChanged | |
| { | |
| public event PropertyChangedEventHandler PropertyChanged; | |
| protected void OnPropertyChanged([CallerMemberName] string memberName = "") | |
| { | |
| if (PropertyChanged != null) | |
| { | |
| PropertyChanged( | |
| this, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Cell : ObservableBase | |
| { | |
| public int Row { get; private set; } | |
| public int Column { get; private set; } | |
| private bool alive; | |
| public bool Alive | |
| { | |
| get { return alive; } | |
| set |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LifeToColourConverter : IValueConverter | |
| { | |
| public SolidColorBrush AliveColour { get; private set; } | |
| public SolidColorBrush DeadColour { get; private set; } | |
| public LifeToColourConverter(SolidColorBrush aliveColour, | |
| SolidColorBrush deadColour) | |
| { | |
| AliveColour = aliveColour; | |
| DeadColour = deadColour; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public RelayCommand<object> EvolveCommand { get; private set; } | |
| public RelayCommand<object> ResetCommand { get; private set; } | |
| public RelayCommand<string> ToggleCellLifeCommand { get; private set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private InputBinding CreateMouseClickInputBinding(Cell cell) | |
| { | |
| InputBinding cellTextBlockInputBinding = new InputBinding( | |
| generationViewModel.ToggleCellLifeCommand, | |
| new MouseGesture(MouseAction.LeftClick) | |
| ); | |
| cellTextBlockInputBinding.CommandParameter = | |
| string.Format("{0},{1}", cell.Row, cell.Column); | |
| return cellTextBlockInputBinding; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.Authentication; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.Extensions.Logging; | |
| using Microsoft.Extensions.Options; | |
| using Moq; | |
| using System.Security.Claims; | |
| using System.Text.Encodings.Web; | |
| using System.Threading.Tasks; | |
| using Xunit; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyApplicationExceptionTests | |
| { | |
| [Fact] | |
| public void Constructor_SerializationInfoAndStreamingContext_SetProperties() | |
| { | |
| // Arrange | |
| var message = "Test exception message"; | |
| var innerException = new Exception("Inner exception message"); | |
| // Create SerializationInfo and StreamingContext objects |