IntelliPromptSessionBase Class
Represents an abstract IntelliPrompt session.
public abstract class IntelliPromptSessionBase : IIntelliPromptSession, IServiceLocator
- Inheritance:
- object object
- Derived:
- CodeSnippetSelectionSession CodeSnippetTemplateSession CompletionSession ParameterInfoSession QuickInfoSession
- Implements:
- IIntelliPromptSession IServiceLocator
Constructors
IntelliPromptSessionBase()
Initializes a new instance of the IntelliPromptSessionBase
class.
protected IntelliPromptSessionBase()
Properties
Bounds
Gets the view-relative bounds of the session's open popup, if available.
public abstract Rectangle? Bounds { get; }
Property Value
- Rectangle?:
The view-relative bounds of the session's open popup, if available.
CanOpenForReadOnlyTextRanges
Gets whether the session is able to be opened for read-only text ranges.
protected virtual bool CanOpenForReadOnlyTextRanges { get; }
Property Value
- bool:
true
if the session is able to be opened for read-only text ranges; otherwise,false
. The default value istrue
.
ClosesOnLostFocus
Returns whether this session auto-closes when the editor or any IntelliPrompt popups lose focus.
public abstract bool ClosesOnLostFocus { get; }
Property Value
- bool:
true
if this session auto-closes when the editor or any IntelliPrompt popups lose focus; otherwise,false
.
IsOpen
Gets whether the session is currently open.
public bool IsOpen { get; }
Property Value
- bool:
true
if the session is currently open; otherwise,false
.
SessionType
Gets the IIntelliPromptSessionType that identifies the type of session.
public abstract IIntelliPromptSessionType SessionType { get; }
Property Value
- IIntelliPromptSessionType:
The IIntelliPromptSessionType that identifies the type of session.
SnapshotRange
Gets the TextSnapshotRange containing the original TextRange in the ITextSnapshot that triggered the session.
public TextSnapshotRange SnapshotRange { get; }
Property Value
- TextSnapshotRange:
The TextSnapshotRange containing the original TextRange in the ITextSnapshot that triggered the session.
Remarks
This member should only be used while the session is open.
SyncRoot
Gets an object that can be used to synchronize access to the services.
public object SyncRoot { get; }
Property Value
- object:
An object that can be used to synchronize access to the services.
View
Gets the IEditorView in which the session is opened.
public IEditorView View { get; }
Property Value
- IEditorView:
The IEditorView in which the session is opened.
Remarks
This member should only be used while the session is open.
Methods
Close(bool)
Closes the session.
public void Close(bool cancelled)
Parameter | Type | Description |
---|---|---|
cancelled | bool | Whether the session was closed due to a cancellation. |
GetAllServiceTypes()
Returns a collection of all the service types that have been registered.
public IEnumerable<object> GetAllServiceTypes()
Returns
- IEnumerable<object>:
A collection of all the service types that have been registered.
GetPopupBounds(PopupControl)
Returns the view-relative bounds of the specified PopupControl.
protected Rectangle? GetPopupBounds(PopupControl popup)
Parameter | Type | Description |
---|---|---|
popup | PopupControl | The popup to examine. |
Returns
- Rectangle?:
The view-relative bounds of the specified PopupControl.
GetService(object)
Returns the service that has been registered with the specified type.
public object GetService(object serviceType)
Parameter | Type | Description |
---|---|---|
serviceType | object | The type of service to return. |
Returns
- object:
The service that has been registered with the specified type.
GetService<T>()
Returns the service that has been registered with the specified type.
public T GetService<T>()
- Type Parameters:
-
T
-The type of service to return.
Returns
- T:
The service that has been registered with the specified type.
OnClosed(CancelEventArgs)
Raises the Closed
event.
protected virtual void OnClosed(CancelEventArgs e)
Parameter | Type | Description |
---|---|---|
e | CancelEventArgs | An |
OnOpened(EventArgs)
Raises the Opened
event.
protected virtual void OnOpened(EventArgs e)
Parameter | Type | Description |
---|---|---|
e | EventArgs | An |
OnServiceAdded(CollectionChangeEventArgs<object>)
Raises the ServiceAdded
event.
protected virtual void OnServiceAdded(CollectionChangeEventArgs<object> e)
Parameter | Type | Description |
---|---|---|
e | CollectionChangeEventArgs<object> | A |
OnServiceRemoved(CollectionChangeEventArgs<object>)
Raises the ServiceRemoved
event.
protected virtual void OnServiceRemoved(CollectionChangeEventArgs<object> e)
Parameter | Type | Description |
---|---|---|
e | CollectionChangeEventArgs<object> | A |
Open(IEditorView, TextRange)
Opens the session, attaching to the specified IEditorView.
public void Open(IEditorView view, TextRange textRange)
Parameter | Type | Description |
---|---|---|
view | IEditorView | The IEditorView in which the session is opened. |
textRange | TextRange | The source TextRange in the view's current ITextSnapshot. |
RegisterService(object, object)
Registers a service instance for the specified service type.
public void RegisterService(object serviceType, object service)
Parameter | Type | Description |
---|---|---|
serviceType | object | The type of service. |
service | object | The service object instance. |
RegisterService<T>(T)
Registers a service instance for the specified service type.
public void RegisterService<T>(T service)
- Type Parameters:
-
T
-The type of service.
Parameter | Type | Description |
---|---|---|
service | T | The service object instance. |
Reposition()
Notifies the session that it should reposition its user interface.
public abstract void Reposition()
UnregisterService(object)
Unregisters a service of the specified service type.
public void UnregisterService(object serviceType)
Parameter | Type | Description |
---|---|---|
serviceType | object | The type of service. |
UnregisterService<T>()
Unregisters a service of the specified service type.
public void UnregisterService<T>()
- Type Parameters:
-
T
-The type of service.
Events
Closed
Occurs when the session is closed, with the Cancel
flag on the event arguments indicating whether
the close was due to a cancellation.
Opened
Occurs when the session is opened.
ServiceAdded
Occurs after a service is added to the object.
public event EventHandler<CollectionChangeEventArgs<object>> ServiceAdded
Event Type
ServiceRemoved
Occurs after a service is removed from the object.
public event EventHandler<CollectionChangeEventArgs<object>> ServiceRemoved