Skip to main content
View as Markdown

IServerModule interface

A server deals with its own server documents. There can be different design document types, for example the Schematic Editor has two Schematic and Schematic Library document types.

public interface IServerModule

Namespace: DXP · Assembly: Altium.SDK.Interfaces

Derived: IMBA_ServerModule

Remarks​

Each design document, in turn stores views which can be a document window or a panel window. A server has the ability to host multiple panel views for a single document view, see the diagram below.

A server also has the ability to host multiple global panel views that represent some system state and are not necessarily tied to a particular design document (for example the Work-Space Manager server has Message, Differences and Errors panels). This document view / multiple panel views structure is the foundation of Altium Designer client / server architecture.

This application manages single instances of different server modules. Each server can have multiple server document kinds, for example the PCB server supports two server document kinds - PCB and PCBLIB design documents. A loaded server in Altium Designer typically hosts documents and each document in turn hosts a document view and panel views.

The diagram below represents a server module with server documents. Each document has views - the document view and the associated panel view.

An IServerModule interface has the following interfaces:

• ICommandLauncher deals with a server's processes table

• IServerDocument represents a loaded design document in Altium Designer

• IServerView represents a panel that can have a view of the Altium Designer system

• IServerDocumentView (deals with a document view (either the document window or panel window)

These forms are wrapped by the IServerDocumentView or IServerView interface object. This IExternalForm interface object has low level methods such as resizing and displaying the form and is the ancestor interface for IServerDocumentView and IServerView interfaces.

• IProcessControl represents the level of stacked processes for this focussed server document

• INotification receives system notifications from the Client system and all server modules receive these notifications. There is an ability to handle a notification and take it from there. Documents and associated panels can be synchronized through the use of notifications as well.

The PCB server module also has its IPCB_ServerInterface interface.

The Schematic Server module also has its ISCH_ServerInterface interface.

However both servers also have this IServerModule interface.

Methods​

MethodReturnsDescription
AddServerViewvoidThis method adds a panel in the Server Module where this new panel can be used by the module.
ApplicationIdlevoidThe ApplicationIdle method is an internal method that gets invoked when Altium Designer is idling.
CreateDocumentIServerDocumentCreates a document supported by the server, of the given kind and with the given file name.
CreateDocumentShowOrHideIServerDocumentThe CreateDocumentShowOrHide method controls how a document when created is displayed in Altium Designer.
CreateOptionsViewIDocumentOptionsViewThe CreateOptionsView creates a IDocumentOptions view to be used in the system wide Preferences dialog in Altium Designer.
CreateServerDocViewIServerDocumentViewThe CreateServerDocView method creates an IServerDocumentView (which could be the document or its associated panel view) object based on the Name of the document view and the IServerDocument containe…
CreateServerViewIServerViewThe CreateServerView method creates a IServerView object representing a system panel.
DestroyDocumentvoidCloses and removes a design document.
GetClientIClientThe GetClient method returns the IClient interface of the client subsystem of Altium Designer.
GetCommandLauncherICommandLauncherThe CommandLauncher method returns the ICommandLauncher interface.
GetDocumentCountintThe DocumentCount method returns you the number of Document Kinds.
GetDocumentsIServerDocumentAn editor type of server can have different document types, such as Schematic Editor and PCB Editor - these editor servers have two document types - SCH/SCHLIB and PCB/PCBLIB respectively.
GetHandleUIntPtrThe method returns the handle of the server.
GetModuleNamestringThe method returns the module name of this server.
GetProcessControlIProcessControlThe method returns the IProcessControl interface.
GetViewCountintThe ViewCount method returns you the number of views for the specified server.
GetViewsIServerViewThe GetViews method in conjunction with the GetViewCount method returns you the indexed View object.
ReceiveNotificationvoidThe ReceiveNotification method of the server module intercepts notifications broadcasted by Altium Designer.
RemoveServerViewvoidThe RemoveServerView method removes a IServerView object in Altium Designer which represents a system panel.

AddServerView​

This method adds a panel in the Server Module where this new panel can be used by the module.

void AddServerView(IServerView argView);
void AddServerView(object argView);
ParameterTypePassing
argViewIServerViewvalue

Returns: nothing (void)

The first overload is an extension method of IServerModuleHelper (using DXP;) with typed parameters; the second is declared by the interface.

Invoke this method after you have created a IServerView object with the CreateServerView method or pass in the IServerView interface parameter.

See also: IServerView

ApplicationIdle​

The ApplicationIdle method is an internal method that gets invoked when Altium Designer is idling. The ApplicationIdle method in all active running servers gets invoked. The messages sent by Altium Designer get the chance to be followed up.

void ApplicationIdle();

Returns: nothing (void)

CreateDocument​

Creates a document supported by the server, of the given kind and with the given file name.

IServerDocument CreateDocument(string argKind, string argFileName);
ParameterTypePassingDescription
argKindstringvalueThe document kind that the server supports.
argFileNamestringvalueThe file name assigned to the new document.

Returns: IServerDocument

Extension method of IServerModuleHelper (using DXP;).

CreateDocumentShowOrHide​

The CreateDocumentShowOrHide method controls how a document when created is displayed in Altium Designer.

IServerDocument CreateDocumentShowOrHide(string argKind, string argFileName, bool argShowInTree);
ParameterTypePassing
argKindstringvalue
argFileNamestringvalue
argShowInTreeboolvalue

Returns: IServerDocument

Extension method of IServerModuleHelper (using DXP;).

CreateOptionsView​

The CreateOptionsView creates a IDocumentOptions view to be used in the system wide Preferences dialog in Altium Designer.

IDocumentOptionsView CreateOptionsView(string argName);
ParameterTypePassing
argNamestringvalue

Returns: IDocumentOptionsView

Extension method of IServerModuleHelper (using DXP;).

CreateServerDocView​

The CreateServerDocView method creates an IServerDocumentView (which could be the document or its associated panel view) object based on the Name of the document view and the IServerDocument container.

IServerDocumentView CreateServerDocView(string argName, IServerDocument argDocument);
ParameterTypePassing
argNamestringvalue
argDocumentIServerDocumentvalue

Returns: IServerDocumentView

Extension method of IServerModuleHelper (using DXP;).

CreateServerView​

The CreateServerView method creates a IServerView object representing a system panel. You need to invoke the AddServerView method to add the object within Altium Designer.

IServerView CreateServerView(string argName);
ParameterTypePassing
argNamestringvalue

Returns: IServerView

Extension method of IServerModuleHelper (using DXP;).

DestroyDocument​

Closes and removes a design document.

void DestroyDocument(IServerDocument argDocument);
void DestroyDocument(object argDocument);
ParameterTypePassingDescription
argDocumentIServerDocumentvalueThe design document to close and remove.

Returns: nothing (void)

The first overload is an extension method of IServerModuleHelper (using DXP;) with typed parameters; the second is declared by the interface.

GetClient​

The GetClient method returns the IClient interface of the client subsystem of Altium Designer. This IClient interface can be used to invoke its methods.

IClient GetClient();

Returns: IClient

Extension method of IServerModuleHelper (using DXP;).

The GetClient method is used for the Client property.

The Client property returns the IClient interface of the client subsystem of Altium Designer. This IClient interface can be used to invoke its methods.

This readonly property is supported by the GetClient method.

GetCommandLauncher​

The CommandLauncher method returns the ICommandLauncher interface. It is used to launch a process from its server module. The CommandLauncher object contains a command table which binds a process name to the actual method that implements the process at run-time.

ICommandLauncher GetCommandLauncher();

Returns: ICommandLauncher

Extension method of IServerModuleHelper (using DXP;).

Whenever a process is called within the server this table is looked up in order to find the actual method pointer. If a process name is not found within this table then nothing will happen.

See the ICommandLauncher interface for more details.

This method is used for the CommandLauncher property.

The CommandLauncher property returns the pointer to the ICommandLauncher interface. It is used to launch a process from its server module. The CommandLauncher object contains a command table which binds a process name to the actual method that implements the process at run-time.

Whenever a process is called within the server this table is looked up in order to find the actual method pointer. If a process name is not found within this table nothing will happen.

This read-only property is supported by the GetCommandLauncher method.

GetDocumentCount​

The DocumentCount method returns you the number of Document Kinds. An important note is that a View is the actual design document. A Document type is a container that stores specific Views.

int GetDocumentCount();

Returns: int

This method is used for the DocumentCount property.

The DocumentCount property returns you the number of Document Kinds. An important note is that a View is the actual design document. A Document type is a container that stores specific Views.

This property is supported by the GetDocumentCount method.

GetDocuments​

An editor type of server can have different document types, such as Schematic Editor and PCB Editor - these editor servers have two document types - SCH/SCHLIB and PCB/PCBLIB respectively.

IServerDocument GetDocuments(int argIndex);
ParameterTypePassing
argIndexintvalue

Returns: IServerDocument

Extension method of IServerModuleHelper (using DXP;).

An add-on type of server will normally have no document containers, because they work with an editor server acting like a piggy back and utilising the editor server's API services.

This method returns you the indexed document container which is represented by the IServerDocument interface.

This method is used for the Documents property.

This property returns you the indexed document container which is represented by the IServerDocument interface.

This read only property is supported by the GetDocuments method.

See also: IServerDocument, IClient

GetHandle​

The method returns the handle of the server.

UIntPtr GetHandle();

Returns: UIntPtr

Extension method of IServerModuleHelper (using DXP;).

This method is used for the Handle property.

The Handle property returns the handle of the server. This read only property is supported by the GetHandle method.

GetModuleName​

The method returns the module name of this server.

string GetModuleName();

Returns: string

For example the texteditor server's module name is TextEdit. This server name property is defined in the associated server installation file (with an INS file extension).

This method is used for the ModuleName property.

The ModuleName property returns the module name of this server.

This read only property is supported by the GetModuleName method.

GetProcessControl​

The method returns the IProcessControl interface. This interface controls the process depth for each design document in Altium Designer.

IProcessControl GetProcessControl();

Returns: IProcessControl

Extension method of IServerModuleHelper (using DXP;).

Every time a process is launched on a document, the process depth is increased by one and once this same process has finished executing, the process depth is decreased by one. When the process depth is zero, it denotes that nothing is taking place on the current design document.

This read only property is supported by the GetProcessControl method.

The ProcessControl property returns the pointer to the IProcessControl interface. This interface controls the process depth for each design document in Altium Designer.

GetViewCount​

The ViewCount method returns you the number of views for the specified server.

int GetViewCount();

Returns: int

A View object encapsulates a form/window object in Altium Designer normally as a global panel supported by its associated server.

This method is used for the ViewCount property.

The ViewCount property returns you the number of views for the specified server.

This read only property is supported by the GetViewCount method.

GetViews​

The GetViews method in conjunction with the GetViewCount method returns you the indexed View object. A view is a form supported by its associated server.

IServerView GetViews(int argIndex);
ParameterTypePassing
argIndexintvalue

Returns: IServerView

Extension method of IServerModuleHelper (using DXP;).

This method is used for the Views property.

The Views property in conjunction with the ViewCount property returns you the indexed View object. A view is a form supported by its associated server.

This read only property is supported by the GetViews method.

See also: IClient

ReceiveNotification​

The ReceiveNotification method of the server module intercepts notifications broadcasted by Altium Designer.

void ReceiveNotification(INotification argNotification);
void ReceiveNotification(object argNotification);
ParameterTypePassing
argNotificationINotificationvalue

Returns: nothing (void)

The first overload is an extension method of IServerModuleHelper (using DXP;) with typed parameters; the second is declared by the interface.

The system has an IClient.BroadcastNotification or an IClient.DispatchNotification method which all running servers in Altium Designer can receive and process accordingly.

This method needs to be overridden and implemented.

RemoveServerView​

The RemoveServerView method removes a IServerView object in Altium Designer which represents a system panel.

void RemoveServerView(IServerView argView);
void RemoveServerView(object argView);
ParameterTypePassing
argViewIServerViewvalue

Returns: nothing (void)

The first overload is an extension method of IServerModuleHelper (using DXP;) with typed parameters; the second is declared by the interface.

Returned by​

IClient.GetServerModule, IClient.GetServerModuleByName, IServerDocument.GetServerModule, GlobalVars.Server

Accepted by​

IClient.DisableServerNotificationHandler, IClient.DispatchNotification, IClient.RegisterServerNotificationHandler, IClient.UnregisterServerNotificationHandler

Examples​

Used in the SDK examples: Ciiva, Extension_BOMManager, Extension_BOMManager.