Show / Hide Table of Contents

Class BaseOptionModel<T>

A base class for specifying options

Inheritance
System.Object
BaseOptionModel<T>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Community.VisualStudio.Toolkit
Assembly: Community.VisualStudio.Toolkit.dll
Syntax
public abstract class BaseOptionModel<T>
    where T : BaseOptionModel<T>, new()
Type Parameters
Name Description
T

Constructors

| Improve this Doc View Source

BaseOptionModel()

Creates a new instance of the option model.

Declaration
protected BaseOptionModel()

Properties

| Improve this Doc View Source

CollectionName

The name of the options collection as stored in the registry.

Declaration
protected virtual string CollectionName { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Instance

A singleton instance of the options. MUST be called from UI thread only.

Declaration
public static T Instance { get; }
Property Value
Type Description
T
Remarks

Call GetLiveInstanceAsync() instead if on a background thread or in an async context on the main thread.

Methods

| Improve this Doc View Source

CreateAsync()

Creates a new instance of the options class and loads the values from the store. For internal use only

Declaration
public static Task<T> CreateAsync()
Returns
Type Description
System.Threading.Tasks.Task<T>
| Improve this Doc View Source

DeserializeValue(String, Type)

Deserializes a string to an object using the binary serializer.

Declaration
protected virtual object DeserializeValue(string value, Type type)
Parameters
Type Name Description
System.String value
System.Type type
Returns
Type Description
System.Object
| Improve this Doc View Source

GetLiveInstanceAsync()

Get the singleton instance of the options. Thread safe.

Declaration
public static Task<T> GetLiveInstanceAsync()
Returns
Type Description
System.Threading.Tasks.Task<T>
| Improve this Doc View Source

Load()

Hydrates the properties from the registry.

Declaration
public virtual void Load()
| Improve this Doc View Source

LoadAsync()

Hydrates the properties from the registry asyncronously.

Declaration
public virtual Task LoadAsync()
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

Save()

Saves the properties to the registry.

Declaration
public virtual void Save()
| Improve this Doc View Source

SaveAsync()

Saves the properties to the registry asyncronously.

Declaration
public virtual Task SaveAsync()
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

SerializeValue(Object)

Serializes an object value to a string using the binary serializer.

Declaration
protected virtual string SerializeValue(object value)
Parameters
Type Name Description
System.Object value
Returns
Type Description
System.String

Events

| Improve this Doc View Source

Saved

The Saved event is fired after the options have been persisted.

Declaration
public static event EventHandler<T> Saved
Event Type
Type Description
System.EventHandler<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX