Class Updater
- Namespace
- CarinaStudio.AutoUpdate
- Assembly
- CarinaStudio.AppBase.AutoUpdate.dll
Core object to perform auto/self update.
public class Updater : BaseDisposableApplicationObject, IApplicationObject, IThreadDependent, ISynchronizable, IDisposable, INotifyPropertyChanged
- Inheritance
-
Updater
- Implements
- Inherited Members
- Extension Methods
Constructors
Updater(IApplication)
Initialize new Updater instance.
public Updater(IApplication app)
Parameters
appIApplicationApplication.
Properties
ApplicationDirectoryPath
Get or set path of application directory to update.
public string? ApplicationDirectoryPath { get; set; }
Property Value
BackUpApplicationCompletely
Get or set whether application should be backed-up completely before installation or not.
public bool BackUpApplicationCompletely { get; set; }
Property Value
DownloadedPackageSize
Get size of downloaded package in bytes.
public long DownloadedPackageSize { get; }
Property Value
Exception
Get latest exception occurred while updating.
public Exception? Exception { get; }
Property Value
IsCancellable
Check whether updating process is cancellable or not.
public bool IsCancellable { get; }
Property Value
IsCancelling
Check whether updating process is cancelling or not.
public bool IsCancelling { get; }
Property Value
IsUpdating
Check whether updating process is on-going or not.
public bool IsUpdating { get; }
Property Value
PackageInstaller
Get or set IPackageInstaller to install downloaded package.
public IPackageInstaller? PackageInstaller { get; set; }
Property Value
PackageRequestHeaders
Get collection of custom headers for requesting package download.
public IDictionary<string, string> PackageRequestHeaders { get; }
Property Value
PackageResolver
Get or set IPackageResolver to resolve package to download.
public IPackageResolver? PackageResolver { get; set; }
Property Value
Remarks
PackageSize
Get size of package in bytes.
public long? PackageSize { get; }
Property Value
- long?
Progress
Get current progress of updating. Range is [0.0, 1.0] or NaN if progress is unavailable.
public double Progress { get; }
Property Value
State
Get current state.
public UpdaterState State { get; }
Property Value
Methods
Cancel()
Cancel updating process.
public bool Cancel()
Returns
- bool
True if cancellation has been accepted.
Dispose(bool)
Dispose instance.
protected override void Dispose(bool disposing)
Parameters
disposingboolTrue to dispose managed resources.
OnPropertyChanged(string)
Raise PropertyChanged event.
protected virtual void OnPropertyChanged(string propertyName)
Parameters
propertyNamestringName of changed property.
Start()
Start updating application.
public bool Start()
Returns
- bool
True if updating process has been started successfully.
StartAndWaitAsync(CancellationToken)
Start updating application and wait for completion asynchronously.
public Task<bool> StartAndWaitAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
Events
PropertyChanged
Raise when property changed.
public event PropertyChangedEventHandler? PropertyChanged