Class BaseUpdaterComponent
- Namespace
- CarinaStudio.AutoUpdate
- Assembly
- CarinaStudio.AppBase.AutoUpdate.dll
Base implementation of IUpdaterComponent.
public abstract class BaseUpdaterComponent : BaseDisposableApplicationObject, IApplicationObject, IUpdaterComponent, IDisposable, INotifyPropertyChanged, IThreadDependent, ISynchronizable
- Inheritance
-
BaseUpdaterComponent
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
BaseUpdaterComponent(IApplication)
Initialize new BaseUpdaterComponent instance.
protected BaseUpdaterComponent(IApplication app)
Parameters
appIApplicationApplication.
Properties
Exception
Get Exception occurred when performing operation.
public Exception? Exception { get; }
Property Value
Logger
Get logger.
protected ILogger Logger { get; }
Property Value
Progress
Get progress of operation performed by this component. The range is [0.0, 1.0] or NaN if progress is unknown.
public double Progress { get; }
Property Value
State
Get current state.
public UpdaterComponentState State { get; }
Property Value
Methods
Cancel()
Cancel the operation performed by this component.
public bool Cancel()
Returns
- bool
True if operation cancelled successfully.
Dispose(bool)
Dispose the instance.
protected override void Dispose(bool disposing)
Parameters
disposingboolTrue to dispose managed resources.
OnCompletedOrCancelled(Exception?)
Called when operation completed or cancelled.
protected virtual void OnCompletedOrCancelled(Exception? ex)
Parameters
exExceptionException occurred while performing operation.
OnPropertyChanged(string)
Raise PropertyChanged event.
protected virtual void OnPropertyChanged(string propertyName)
Parameters
propertyNamestringName of changed property.
PerformOperationAsync(CancellationToken)
Perform operation asynchronously.
protected abstract Task PerformOperationAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
- Task
Task of performing operation.
ReportProgress(double)
Report progress of operation.
protected void ReportProgress(double progress)
Parameters
progressdoubleProgress.
Remarks
You can call this method from any thread.
Start()
Start performing operation.
public bool Start()
Returns
- bool
True if operation started successfully.
ValidateParametersToStart()
Validate parameters to start performing operation.
protected virtual bool ValidateParametersToStart()
Returns
- bool
True if all parameters are valid.
VerifyInitializing()
Throw InvalidOperationException if current state is not Initializing.
protected void VerifyInitializing()
Events
PropertyChanged
Raise when property changed.
public event PropertyChangedEventHandler? PropertyChanged