private void OnAddInstallation() { try { var folderBrowser = new FolderBrowserDialog { Description = "Please select the DCS folder you wish to add...", RootFolder = Environment.SpecialFolder.MyComputer, ShowNewFolderButton = false }; if (folderBrowser.ShowDialog() == DialogResult.OK) { var selectedFolder = folderBrowser.SelectedPath; var installation = new InstallLocation(selectedFolder); Installations.Add(new InstallLocationModel(installation)); SettingsController.AddInstalls(installation.Directory); } } catch (Exception e) { GeneralExceptionHandler.Instance.OnError(e); } }
private void OnDetectInstallations() { try { var installations = InstallationLocator.Locate(); var addedInstallations = new List <string>(); foreach (var installation in installations) { if (Installations.All(i => i.ConcreteInstall.ToString() != installation.ToString())) { Installations.Add(new InstallLocationModel(installation)); addedInstallations.Add(installation.Directory); } } foreach (var directory in addedInstallations) { SettingsController.AddInstalls(directory); } } catch (Exception e) { GeneralExceptionHandler.Instance.OnError(e); } }