void pbData_OnInvalidVersion(DBFileType dbt) { if (dbt == DBFileType.Store) { MessageBox.Show(Application.Current.Resources["InstallationIsOutdated"].ToString() + "\n" + Application.Current.Resources["InstallationIsOutdated_UpdateNow"].ToString()); MainFrame.Navigate(Login); } }
void pbData_OnInvalidVersion(DBFileType dbt) { if (!pbData.UpdateTonightScheduled()) { AppVersion version = null; bool hasUpdate = updater.ServerHasUpdates(out version); UpdateAvailable win = new UpdateAvailable(); UpdateAvailableViewModel dc = new UpdateAvailableViewModel(pbData); lock (UpdateAvailableViewModel.UpdateLocker) { if (!UpdateAvailable.IsShown) { var currentVersion = AppVersion.GetInstalledVersion(); if (currentVersion.Rank > version.Rank) { logger.Debug("app already updated"); return; } switch (dbt) { case DBFileType.Controller: lock (syncLock) { if (hasUpdate) { dc.LaterButtonVisibility = false; dc.ShowIcon = true; dc.HeaderText = Application.Current.Resources["InstallationIsOutdatedRequiredUpdate"].ToString(); dc.BoldBodyText = Application.Current.Resources["InstallationIsOutdated_UpdateNowRequired"].ToString(); win.DataContext = dc; dc.UpdateNowTriggered += (o, e) => { if (!updater.RunUpdate()) { MessageBox.Show("Failed to update", "Password Boss updater", MessageBoxButton.OK); } }; win.ShowDialog(); } Quit(); } break; case DBFileType.Store: lock (syncLock) { if (!invalidVersionMsgSeen) { if (hasUpdate) { dc.LaterButtonVisibility = false; dc.ShowIcon = true; dc.HeaderText = Application.Current.Resources["InstallationIsOutdatedRequiredUpdate"].ToString(); dc.BoldBodyText = Application.Current.Resources["InstallationIsOutdated_UpdateNowRequired"].ToString(); win.DataContext = dc; dc.UpdateNowTriggered += (o, e) => { if (!updater.RunUpdate()) { MessageBox.Show("Failed to update", "Password Boss updater", MessageBoxButton.OK); } }; win.ShowDialog(); } } invalidVersionMsgSeen = true; } break; case DBFileType.SyncStore: lock (syncLock) { if (!invalidVersionOnSyncMsgSeen && hasUpdate) { dc.ShowIcon = true; dc.HeaderText = Application.Current.Resources["InstallationIsOutdated"].ToString(); dc.BoldBodyText = Application.Current.Resources["InstallationIsOutdated_CloudSyncDisabledBold"].ToString(); dc.RegularBodyText = Application.Current.Resources["InstallationIsOutdated_CloudSyncDisabled"].ToString(); win.DataContext = dc; dc.UpdateNowTriggered += (o, e) => { if (!updater.RunUpdate()) { MessageBox.Show("Failed to update", "Password Boss updater", MessageBoxButton.OK); } }; win.ShowDialog(); } invalidVersionOnSyncMsgSeen = true; } break; } } } } }