public MainWindow() { InitializeComponent(); field = null; previousFields = new FieldList(); nextFields = new FieldList(); rectangleArray = null; borderIsActive = false; continueOnMouseRelease = false; ruleStringSurvive = "23"; ruleStringCreate = "3"; errorMessage = ""; maxFieldSize = 99; gameBoardLength = 655; gameBoardWidth = 655; InitializeButtonImages(); InitializeTimers(3); adjustSizeOfInputBoxes(); InitializePatternClicks(); InitializePatternTags(); MaxHeight = Height; MinHeight = Height; MaxWidth = Width; MinWidth = Width; textblock_current_rule.ToolTip = "The first value is a list of all the numbers of neighbours\n" + "that cause a living cell to keep alive.\n\n" + "The second value is a list of all the numbers of neighbours\n" + "that cause a dead cell to become alive."; foreach (MenuItem item in menu_rules.Items) { item.Header += " (" + item.Tag.ToString() + ")"; item.Click += newRuleSelected; } textbox_field_width.Focus(); }
private void updateFieldLists(bool[,] fieldBefore) { if (!fieldsAreEqual(fieldBefore, field) && fieldBefore != null) { previousFields.add(fieldBefore, textblock_current_pattern.Text, borderIsActive); if (field != null) { button_fast_rewind.IsEnabled = true; button_step_rewind.IsEnabled = true; } nextFields = new FieldList(); button_fast_forward.IsEnabled = false; button_step_forward.IsEnabled = false; } else toggleTimer(); button_delete.IsEnabled = !fieldsAreEqual(field, getEmptyField(field.GetLength(0), field.GetLength(1))); }