private void loadGroup() { gridSimfiles.Children.Clear(); //Clear out previous simfiles in the grid gridSimfiles.RowDefinitions.Clear(); rbsToOld = new List <RadioButton>(); rbsKeep = new List <RadioButton>(); rbsToX = new List <RadioButton>(); simfiles = SimfileReader.OpenSimfileDir(); /*List<StepChart> stepCharts = new List<StepChart>(); * stepCharts.Add(new StepChart(StepDifficulty.Beginner, 2)); * stepCharts.Add(new StepChart(StepDifficulty.Easy, 4)); * Simfile test = new Simfile * { * Name = "Derp derp test thing", * StepCharts = stepCharts, * }; * addSimfileToGrid(test); */ bool useDarkLine = false; foreach (Simfile simfile in simfiles) //Add a row to the grid for each simfile { useDarkLine = !useDarkLine; //Alternate between light and dark backgrounds for rows addSimfileToGrid(simfile, useDarkLine); } gridSimfiles.RowDefinitions.Add(new RowDefinition //Add another dummy row to the grid to prevent an issue with the last two simfiles overlapping in the grid { Height = GridLength.Auto }); saveLocked = false; }
private void buttonSave_Click(object sender, RoutedEventArgs e) { if (saveLocked) { promptForGroupReload(); return; } int toOldCount = 0; int keepCount = 0; int toXCount = 0; foreach (Simfile simfile in simfiles) { switch (simfile.ScaleChange) { case RatingScaleChange.ToOld: toOldCount++; break; case RatingScaleChange.ToX: toXCount++; break; default: keepCount++; break; } } MessageBoxResult result = MessageBox.Show("Processing " + (toOldCount + keepCount + toXCount) + " total simfiles:\n\n - " + toOldCount + " to Old Scale\n - " + keepCount + " keeping scale (no change)\n - " + toXCount + " to X Scale\n\nProceed?", "Saving - SM Rating Scale Converter", MessageBoxButton.OKCancel, MessageBoxImage.Question); if (result == MessageBoxResult.OK) { SimfileReader.ApplyRatingChangesAndSaveSimfiles(simfiles); saveLocked = true; } }