/// <summary> /// Indicates if the running OS version matches, or is greater than, /// the provided OS. /// </summary> /// <param name="windows">OS to compare running OS to.</param> /// <returns>True if the the running OS matches, or is greater /// than, the specified OS; otherwise, false.</returns> public static bool IsWindowsVersionOrGreater(KnownWindows windows) { try { var entry = WindowsEntries[windows]; if (!entry.MatchesOrGreater.HasValue) { entry.MatchesOrGreater = IsWindowsVersionOrGreater( entry.MajorVersion, entry.MinorVersion, entry.ServicePackMajor); } return(entry.MatchesOrGreater.Value); } catch (KeyNotFoundException e) { throw new ArgumentException(UiStrings.UnknownOS, e); } catch (MissingMethodException) { if (MessageBox.Show("Looks like you don’t have .NET 4.5.2 installed. Would you like to install it?", "Error", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) == MessageBoxResult.Yes) { Process.Start("http://www.microsoft.com/en-us/download/details.aspx?id=42642"); } var app = Application.Current; if (app == null) { Environment.Exit(10); } else { app.Shutdown(10); } return(false); } }
/// <summary> /// Indicates if the running OS version matches, or is greater than, /// the provided OS. /// </summary> /// <param name="windows">OS to compare running OS to.</param> /// <returns>True if the the running OS matches, or is greater /// than, the specified OS; otherwise, false.</returns> public static bool IsWindowsVersionOrGreater(KnownWindows windows) { try { var entry = WindowsEntries[windows]; if (!entry.MatchesOrGreater.HasValue) { entry.MatchesOrGreater = IsWindowsVersionOrGreater( entry.MajorVersion, entry.MinorVersion, entry.ServicePackMajor); } return entry.MatchesOrGreater.Value; } catch (KeyNotFoundException e) { throw new ArgumentException(UiStrings.UnknownOS, e); } catch (MissingMethodException) { if (MessageBox.Show("Looks like you don’t have .NET 4.5.2 installed. Would you like to install it?", "Error", MessageBoxButton.YesNo, MessageBoxImage.Asterisk) == MessageBoxResult.Yes) { Process.Start("http://www.microsoft.com/en-us/download/details.aspx?id=42642"); } if (Application.Current != null) { Application.Current.Shutdown(10); } else { Environment.Exit(10); } return false; } }