private void GenerationChangedHandler(object sender, GenerationChangedEventArgs e)
        {
            if (e.duplicatedName != string.Empty)
            {
                foreach (Generation generation in generationList)
                {
                    foreach (Grid grid in generation.GenerationGridList)
                    {
                        IEnumerable <TextBox> textBoxList = grid.Children.OfType <TextBox>().Where(t => t.Text == e.duplicatedName);
                        foreach (TextBox textBox in textBoxList)
                        {
                            textBox.Foreground = Brushes.Red;
                            foreach (Label label in grid.Children.OfType <Label>().Where(l => Grid.GetColumn(l) == Grid.GetColumn(textBox)))
                            {
                                label.Foreground = Brushes.Red;
                            }
                            foreach (TextBox textbox in grid.Children.OfType <TextBox>().Where(t => Grid.GetColumn(t) == Grid.GetColumn(textBox)))
                            {
                                textbox.Foreground = Brushes.Red;
                            }
                        }
                    }
                }
            }

            GenerationChanged?.Invoke(sender, e);
        }
Exemple #2
0
        private void ChangeGeneration()
        {
            _prevField = _field;
            var generation = _generationLogic.Generation(_field);

            _field = generation.NewField;
            GenerationChanged?.Invoke(this, new NewGenerationEventArgs(generation.ChangedCells));
        }
Exemple #3
0
 /// <summary>
 /// Triggering the generation changed event
 /// </summary>
 private void OnGenerationChanged()
 {
     GenerationChanged?.Invoke(this, EventArgs.Empty);
 }