public LoadFileWindow(LifeRuleset backup) { InitializeComponent(); Files.ItemsSource = FileManagementWindowsHelper.XMLFiles(); BackupRuleset = backup; IsSubmitted = false; }
// sets BackupRuleset to be the LifeRuleset currently selected in the Files ListBox void NewSelectedItem(object sender, RoutedEventArgs e) { ListBox list = (ListBox)sender; if (BackupRuleset != null) { LifeRulesetSerializer toSerialize = new LifeRulesetSerializer(BackupRuleset); SelectedRuleset = FileManagementWindowsHelper.SelectLifeRulesetFromFileItem((string)list.SelectedItem, toSerialize).ConvertToLifeRuleset(); } }
// For serializing public LifeRulesetSerializer(LifeRuleset rules) { NeighborsToGrow = rules.GetGrowthArray(); NeighborsToLive = rules.GetLivingArray(); NeighborsToDie = rules.GetDeathArray(); }
public SetupMenuHelper(LifeRuleset rulesetToModify) { SelectedLivingNumbers = new List <int>(rulesetToModify.GetLivingArray()); SelectedGrowthNumbers = new List <int>(rulesetToModify.GetGrowthArray()); SelectedDyingNumbers = new List <int>(rulesetToModify.GetDeathArray()); }