public static object GetSelection <T>(Window owner, string title, IEnumerable <T> dropdownObjects, string directionsText, string directionsText2) { DropdownSelectorDialog dss = new DropdownSelectorDialog() { DialogTitle = title, DirectionsText = directionsText, DirectionsText2 = directionsText2, Owner = owner }; dss.DropdownItems.ReplaceAll(dropdownObjects.Select(x => (object)x)); dss.ShowDialog(); return(dss.SelectedItem); }
private void AddOfficialDLCJob() { var currentOfficialDLCJobs = EditingMod.InstallationJobs.Where(x => x.IsOfficialDLCJob(EditingMod.Game)).Select(x => x.Header).ToList(); var acceptableHeaders = ModJob.GetSupportedOfficialDLCHeaders(EditingMod.Game); var selectableOptions = acceptableHeaders.Except(currentOfficialDLCJobs).ToList(); var selection = DropdownSelectorDialog.GetSelection(Window.GetWindow(this), M3L.GetString(M3L.string_selectTask), selectableOptions, M3L.GetString(M3L.string_selectATaskHeader), M3L.GetString(M3L.string_chooser_selectOfficialDLCHeader)); if (selection is ModJob.JobHeader header) { ModJob job = new ModJob(header); EditingMod.InstallationJobs.Add(job); job.BuildParameterMap(EditingMod); OfficialDLCJobs.Add(job); } }