Table of Contents

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

app IApplication

Application.

Properties

Exception

Get Exception occurred when performing operation.

public Exception? Exception { get; }

Property Value

Exception

Logger

Get logger.

protected ILogger Logger { get; }

Property Value

ILogger

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

double

State

Get current state.

public UpdaterComponentState State { get; }

Property Value

UpdaterComponentState

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

disposing bool

True to dispose managed resources.

OnCompletedOrCancelled(Exception?)

Called when operation completed or cancelled.

protected virtual void OnCompletedOrCancelled(Exception? ex)

Parameters

ex Exception

Exception occurred while performing operation.

OnPropertyChanged(string)

Raise PropertyChanged event.

protected virtual void OnPropertyChanged(string propertyName)

Parameters

propertyName string

Name of changed property.

PerformOperationAsync(CancellationToken)

Perform operation asynchronously.

protected abstract Task PerformOperationAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task

Task of performing operation.

ReportProgress(double)

Report progress of operation.

protected void ReportProgress(double progress)

Parameters

progress double

Progress.

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

Event Type

PropertyChangedEventHandler