private void ExecuteAddJAVA_HOMEInstallationCommand(object parameter) { bool add = true; try { if (!Properties.Settings.Default.JavaHomeWarningHasBeenDisplayed && (machine.DiscoverMachineWideInstallations || machine.DiscoverUserScopeInstallations) ) { var ans = MessageBox.Show( "Generally, you don't need adding JAVA_HOME, if you have auto-discovery turned on. Auto-discovery will monitor all your installations for updates." + Environment.NewLine + Environment.NewLine + "Add JAVA_HOME **only** if you need to override something, or to switch to Latest (LTS) feature branch, or if your know what are you doing." + Environment.NewLine + Environment.NewLine + "Proceed with adding JAVA_HOME? ", Branding.ProductName, MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No); if (ans == MessageBoxResult.No) { add = false; } Properties.Settings.Default.JavaHomeWarningHasBeenDisplayed = true; } } catch (Exception) { } if (add) { Installation new_installation = new Installation(true); ConfiguredInstallations.Add(new_installation); } }
private void ExecuteAddInstallationCommand(object parameter) { var path = BrowseAndCheckForPath(ConfiguredInstallations); if (path != null) { Installation new_installation = new Installation(path); ConfiguredInstallations.Add(new_installation); } }
private void ExecuteConvertToUserOverriddenInstallationCommand(object parameter) { if (null != SelectedItem) { if (SelectedItem.Path != null) { Installation new_installation = new Installation(SelectedItem.Path); bool disable_updates = ((string)parameter ?? "").ToLowerInvariant() == "disableupdatescheck"; if (disable_updates) { new_installation.CheckForUpdatesFlag = false; } ConfiguredInstallations.Add(new_installation); } } }
private void ExecuteRemoveSelectedInstallationCommand(object parameter) { if (null != SelectedItem) { bool is_java_home = SelectedItem.IsJavaHomeInstance; string itemToRemoveName = (is_java_home ? "JAVA_HOME instance" : "[" + SelectedItem.DisplayPath + "]"); string question = SelectedItem.OverridesAutodiscovered ? $"Remove user override for {itemToRemoveName}?{Environment.NewLine+Environment.NewLine}API params will be reset to defaults, and an auto-discovered instance should appear in the list." : $"Remove {itemToRemoveName} from the list of monitored installations?"; var result = String.IsNullOrEmpty(SelectedItem.Path) ? MessageBoxResult.Yes : MessageBox.Show(question, "Confirm removal", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { ConfiguredInstallations.Remove(SelectedItem); } } }