/// <summary> /// Checks if a new update is available /// Returns true if this is the case, otherwise returns false /// </summary> public static bool UpdateAvaible() { try { // Fetch update JsonUpdate _Update = FetchUpdate(); // Check if versions are not equal if (Reference.AppVersion != _Update.Latest_version) { return(true); } } catch { MessageBox.Show(Langs.Get("update_check_error"), Reference.AppName, MessageBoxButton.OK, MessageBoxImage.Error); } // Return return(false); }
/// <summary> /// Installs the latest update, (make sure to check if an update is available!) /// If _AskUser is true, first ask the user if he wants to install it or not /// Returns true if the update will be installed, otherwise returns false /// </summary> public static bool InstallUpdate(bool _AskUser) { // User don't want to install if (_AskUser && MessageBox.Show(Langs.Get("update_request"), Reference.AppName, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No) { return(false); } // Fetch update JsonUpdate _Update = FetchUpdate(); // Else install the update // Hide splashscreen App.Current.MainWindow.Hide(); // Show update window Windows.Update _UpdateWindow = new Windows.Update(_Update.Latest_link); _UpdateWindow.ShowDialog(); // Return return(true); }