public UpdateAvailableWindow(UpdateAvailableViewModel viewModel) { DataContext = viewModel; InitializeComponent(); viewModel.Translator.Translate(this); }
private UpdateAvailableViewModel BuildViewModel(UpdateAvailableInteraction interaction) { var viewModel = new UpdateAvailableViewModel(_updateManagerTranslation, _processStarter, new ApplicationNameProvider("PDFCreator")); new InteractionHelper <UpdateAvailableInteraction>(viewModel, interaction); return(viewModel); }
public async Task CheckForUdpateTest() { // given UpdateAvailableViewModel viewModel = new UpdateAvailableViewModel(); // when await viewModel.CheckForNewReleases(); }
public ActionStatusInfo ExecuteAction(string uid, ActionStatusInfo statusInfo) { var ret = new ActionStatusInfo { Status = ActionStatus.Incomplete, WriteBackStartDate = true, StartDate = DateTime.Now.Add(chkFreq) }; if (!pbData.UpdateTonightScheduled()) { var jsonFile = FindUpdateJsonFile(); var arg = GetArgumentsFromJsonFile(jsonFile); var updaterParams = UpdaterData.ReadFromFile(jsonFile); var version = AppVersion.GetInstalledVersion(); var binary = UpdatePathHelper.PBUpdaterPath; Application.Current.Dispatcher.Invoke((Action)(() => { 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; } UpdateAvailable win = new UpdateAvailable(); win.Owner = Application.Current.MainWindow; dc.LaterButtonVisibility = true; dc.ShowIcon = true; dc.HeaderText = Application.Current.Resources["InstallationIsOutdated"].ToString(); dc.BoldBodyText = Application.Current.Resources["InstallationIsOutdated_UpdateNow"].ToString(); win.DataContext = dc; dc.UpdateNowTriggered += (o, e) => System.Diagnostics.Process.Start(binary); win.ShowDialog(); } } })); ret.Status = ActionStatus.Completed; } return(ret); }
private void ShowUpdateAvailableDialog() { var version = AppVersion.GetInstalledVersion(); UpdateAvailableViewModel dc = new UpdateAvailableViewModel(pbData); UpdateAvailable win = new UpdateAvailable(); win.Owner = Current.MainWindow; dc.HeaderText = Current.Resources["InstallationIsOutdated"].ToString(); dc.BoldBodyText = Current.Resources["InstallationIsOutdated_UpdateNowBold"].ToString(); dc.RegularBodyText = Current.Resources["InstallationIsOutdated_UpdateNow"].ToString(); win.DataContext = dc; dc.UpdateNowTriggered += (o, e) => { if (!updater.RunUpdate()) { MessageBox.Show("Failed to update", "Password Boss updater", MessageBoxButton.OK); } }; win.ShowDialog(); }
public App() : base() { if (UpdateAvailableViewModel.ExistNewUpdate()) { UpdateAvailableViewModel.RunUpdate(); } this.DispatcherUnhandledException += App_DispatcherUnhandledException; if (string.IsNullOrEmpty(ArmaBrowser.Properties.Settings.Default.Id) || ArmaBrowser.Properties.Settings.Default.Id.Length != 32) { ArmaBrowser.Properties.Settings.Default.Id = Guid.NewGuid().ToByteArray().ToHexString(); ArmaBrowser.Properties.Settings.Default.Save(); } if (!ArmaBrowser.Properties.Settings.Default.Upgraded) { ArmaBrowser.Properties.Settings.Default.Upgrade(); ArmaBrowser.Properties.Settings.Default.Upgraded = true; ArmaBrowser.Properties.Settings.Default.Save(); } }
public UpdateAvailableWindow(UpdateAvailableViewModel viewModel) { DataContext = viewModel; InitializeComponent(); }
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; } } } } }