public AboutViewModel(IApplicationDeployment deployment, IApplicationContainer appContainer) { _deployment = deployment; _appContainer = appContainer; Initialise(_deployment, _appContainer); }
/// <summary> /// Verifica la disponibilità di nuovi aggiornamenti per l'applicazione corrente /// </summary> private ApplicationDeployUpdateInfo OnCheckUpdates(IApplicationDeployment applicationDeployment) { ApplicationDeployUpdateInfo info; try { // _log.Info("Checking for updates"); info = applicationDeployment.CheckForDetailedUpdate(); LastChecked = DateTime.Now; } catch (DeploymentDownloadException dde) { // _log.Error("The new version of the application cannot be downloaded at this time.", dde); OnError(dde); return(null); } catch (InvalidDeploymentException ide) { // _log.Error("Cannot check for a new version of the application. The ClickOnce deployment is corrupt. ", ide); OnError(ide); return(null); } catch (InvalidOperationException ioe) { //_log.Error( // "The current application is either not configured to support updates, or there is another update check operation already in progress.", // ioe); OnError(ioe); return(null); } return(info); }
/// <summary> /// Attiva una nuova istanza di ApplicationUpdater /// </summary> public ApplicationUpdater(IApplicationDeployment deploymentWrapper, IApplicationHelper applicationHelper, IDialogHolder dialogHolder) { _deploymentWrapper = deploymentWrapper; _applicationHelper = applicationHelper; _dialog = dialogHolder; }
/// <summary> /// Default constructor /// </summary> public ApplicationContainer() { using (var container = new UnityContainer()) { container.Configure(x => { x.AddRegistry <IoCRegistry>(); }); _deployment = container.Resolve <IApplicationDeployment>(); } }
public AboutViewModel() { using (var container = new UnityContainer()) { container.Configure(x => { x.AddRegistry <IoCRegistry>(); }); _deployment = container.Resolve <IApplicationDeployment>(); _appContainer = container.Resolve <IApplicationContainer>(); } Initialise(_deployment, _appContainer); }
private bool DoUpdate(IApplicationDeployment ad) { try { // _log.Debug("Running preliminary operations"); OnUpdating(); // _log.Debug("Running update"); bool ret = ad.Update(); // _log.Debug("Running finalizing operations"); OnUpdated(); return(ret); } catch (DeploymentDownloadException dde) { // _log.Error("The new deployment could not be downloaded from its location on the network.", dde); OnError(dde); return(false); } catch (InvalidDeploymentException idex) { // _log.Error("Your ClickOnce deployment is corrupted.", idex); OnError(idex); return(false); } catch (InvalidOperationException ioex) { // _log.Error("The application is currently being updated.", ioex); OnError(ioex); return(false); } catch (TrustNotGrantedException tngex) { //_log.Error( // "The local computer did not grant the application the permission level it requested to execute.", // tngex); OnError(tngex); return(false); } }
public AppUpdater(IMessageBus bus, IApplicationDeployment deployment) { _bus = bus; _deployment = deployment; }
private void Initialise(IApplicationDeployment deployment, IApplicationContainer appContainer) { CheckForUpdate = new ReactiveCommand(this.ObservableForProperty(vm => vm.NetworkDeployed).Select(e => e.Value), false, null); CheckForUpdate.Subscribe(x => deployment.CheckForUpdateAsync()); CheckForUpdate.ThrownExceptions.Subscribe(); var checkForUpdateObservable = Observable.FromEventPattern <CheckForUpdateCompletedEventHandler, CheckForUpdateCompletedEventArgs> (h => deployment.CheckForUpdateCompleted += h, h => deployment.CheckForUpdateCompleted -= h); var checkForUpdateProgressObservable = Observable.FromEventPattern <DeploymentProgressChangedEventHandler, DeploymentProgressChangedEventArgs> (h => deployment.CheckForUpdateProgressChanged += h, h => deployment.CheckForUpdateProgressChanged -= h); _availableVersion = checkForUpdateObservable.Select(e => e.EventArgs.AvailableVersion).ToProperty(this, vm => vm.AvailableVersion); _updateSizeBytes = checkForUpdateObservable.Select(e => e.EventArgs.UpdateSizeBytes).ToProperty(this, vm => vm.UpdateSizeBytes); _minimumRequiredVersion = checkForUpdateObservable.Select(e => e.EventArgs.MinimumRequiredVersion).ToProperty(this, vm => vm.MinimumRequiredVersion); _isUpdateRequired = checkForUpdateObservable.Select(e => e.EventArgs.IsUpdateRequired).ToProperty(this, vm => vm.IsUpdateRequired); Update = new ReactiveCommand(checkForUpdateObservable.Select(e => e.EventArgs.UpdateAvailable), false, null); Update.Subscribe(x => deployment.UpdateAsync()); Update.ThrownExceptions.Subscribe(); var updateProgressObservable = Observable.Merge(Observable.FromEventPattern <DeploymentProgressChangedEventHandler, DeploymentProgressChangedEventArgs> (h => deployment.UpdateProgressChanged += h, h => deployment.UpdateProgressChanged -= h), Observable.FromEventPattern <DeploymentProgressChangedEventHandler, DeploymentProgressChangedEventArgs> (h => deployment.DownloadFileGroupProgressChanged += h, h => deployment.DownloadFileGroupProgressChanged -= h)); _deploymentProgressState = updateProgressObservable.Select(e => e.EventArgs.State).ToProperty(this, vm => vm.DeploymentProgressState); _progressPercentage = updateProgressObservable.Select(e => e.EventArgs.ProgressPercentage).ToProperty(this, vm => vm.ProgressPercentage); _bytesCompleted = updateProgressObservable.Select(e => e.EventArgs.BytesCompleted).ToProperty(this, vm => vm.BytesCompleted); _bytesTotal = updateProgressObservable.Select(e => e.EventArgs.BytesTotal).ToProperty(this, vm => vm.BytesTotal); _group = updateProgressObservable.Select(e => e.EventArgs.Group).ToProperty(this, vm => vm.Group); var updateCompleteObservable = Observable.FromEventPattern <AsyncCompletedEventHandler, AsyncCompletedEventArgs> (h => deployment.UpdateCompleted += h, h => deployment.UpdateCompleted -= h); _updateAvailable = Observable.Merge(checkForUpdateObservable.Select(e => e.EventArgs.UpdateAvailable), updateCompleteObservable.Select(e => false)) .ToProperty(this, vm => vm.UpdateAvailable); _updateCompleted = updateCompleteObservable.Select(e => true) .ToProperty(this, vm => vm.UpdateCompleted, false); //make sure the current version is kept up-to-date _currentVersion = updateCompleteObservable.Select(e => deployment.CurrentVersion) .ToProperty(this, vm => vm.CurrentVersion, deployment.CurrentVersion); //build the in progress flags from all of our observables _checkInProgress = Observable.Merge(checkForUpdateObservable.Select(e => false), checkForUpdateProgressObservable.Select(e => true), CheckForUpdate.Select(e => true), Update.Select(e => false)) .ToProperty(this, vm => vm.CheckInProgress, false); _updateInProgress = Observable.Merge(updateProgressObservable.Select(e => true), updateCompleteObservable.Select(e => false), Update.Select(e => true)) .ToProperty(this, vm => vm.UpdateInProgress, false); Restart = new ReactiveCommand(updateCompleteObservable.Select(e => true), false, null); Restart.Subscribe(x => appContainer.Restart()); Restart.ThrownExceptions.Subscribe(); }
public SendGridEmailService(IApplicationDeployment environment, HiLaarischSettings.EmailAddress emails, string apiKey) { this.environment = environment; this.emailAddresses = emails; this.apiKey = apiKey; }