private void UpdateProfiles() { if (!_build.Profiles.Any()) { _profile = CreateProfile("Default"); } var profs = _build.Profiles; var idx = profs.IndexOf(_profile); if (idx < 0) idx = ProfileSelect.SelectedIndex; ProfileSelect.Items.Clear(); PresetTable.Controls.Clear(); PresetTable.RowStyles.Clear(); if (_specification.Presets.Any()) { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Choose a preset to use for the compile:", Dock = DockStyle.Top }); foreach (var preset in _specification.Presets) { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); var btn = new HeadingButton { HeadingText = preset.Name, Text = preset.Description, Dock = DockStyle.Top }; var pre = preset; btn.Click += (s, e) => UsePreset(pre); PresetTable.Controls.Add(btn); } PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label {Text = "Or select from a custom profile:", Dock = DockStyle.Top}); } else { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Select a profile to use for the compile:", Dock = DockStyle.Top }); } foreach (var profile in profs) { ProfileSelect.Items.Add(profile); PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); var btn = new Button { Text = profile.Name, Height = 30, Dock = DockStyle.Top }; var pro = profile; btn.Click += (s, e) => UseProfile(pro); PresetTable.Controls.Add(btn); } if (idx < 0 || idx >= profs.Count) idx = 0; if (ProfileSelect.SelectedIndex != idx) ProfileSelect.SelectedIndex = idx; }
private void UpdateProfiles() { if (!_build.Profiles.Any()) { _profile = CreateProfile("Default"); } var profs = _build.Profiles; var idx = profs.IndexOf(_profile); if (idx < 0) { idx = ProfileSelect.SelectedIndex; } ProfileSelect.Items.Clear(); PresetTable.Controls.Clear(); PresetTable.RowStyles.Clear(); if (_specification.Presets.Any()) { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Choose a preset to use for the compile:", Dock = DockStyle.Top }); foreach (var preset in _specification.Presets) { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); var btn = new HeadingButton { HeadingText = preset.Name, Text = preset.Description, Dock = DockStyle.Top }; var pre = preset; btn.Click += (s, e) => UsePreset(pre); PresetTable.Controls.Add(btn); } PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Or select from a custom profile:", Dock = DockStyle.Top }); } else { PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); PresetTable.Controls.Add(new Label { Text = "Select a profile to use for the compile:", Dock = DockStyle.Top }); } foreach (var profile in profs) { ProfileSelect.Items.Add(profile); PresetTable.RowStyles.Add(new RowStyle(SizeType.AutoSize)); var btn = new Button { Text = profile.Name, Height = 30, Dock = DockStyle.Top }; var pro = profile; btn.Click += (s, e) => UseProfile(pro); PresetTable.Controls.Add(btn); } if (idx < 0 || idx >= profs.Count) { idx = 0; } if (ProfileSelect.SelectedIndex != idx) { ProfileSelect.SelectedIndex = idx; } }