Table of Contents

Class CadRemoteServer

Namespace
OpenCAD2D
Assembly
OpenCAD2D.Core.dll

The multileader styles and table styles of a drawing, read from outside.

public sealed class CadRemoteServer : IDisposable
Inheritance
CadRemoteServer
Implements
Inherited Members

Remarks

The answer holds the styles' settings as plain members, not the style objects, so that a program that only wants to list them or to read the scale of one does not take a copy of the drawing. The styles come in the order of their names, without regard to case, then in ordinal order.

Constructors

CadRemoteServer(ICadRemoteHost, ICadRemoteDispatcher)

Makes a server for an app; nothing listens until Start().

Properties

IsRunning

Gets whether the server is listening.

PipeName

Gets the name of the pipe the server listens on.

Methods

CreateRunCommand(string, bool, string, Action<CadRemoteToolRun>)

Makes the command of a tool, to put in the app's registry under the name the user types. The command is the run: it begins an undo step named after it, calls started so that the app can tell the tool, and then waits at NAME is working... (Esc to stop) while the tool asks its questions, commits and ends it (ask, commit, end, fail of the channel). The step is kept when the tool ends it well and taken back when it fails or Esc ends it, and the drawing is busy for every other command until then.

Dispose()

Stops the server.

ForTools(ICadRemoteHost, ICadRemoteDispatcher)

Makes the server of the tools of an app: the pipe OpenCAD2D.<process id>.tools, never announced in the instance folder, open whether or not the app allows other programs to connect, and taking a client only with a token IssueToken() gave. Call Start() on the thread of the drawings, as for the app's own server.

IssueToken()

Gives a tool the token it connects with: 32 random bytes as 64 hexadecimal letters. A token is good until RevokeToken(string); the app gives each tool process its own and takes it back when the process ends.

NoteActivated()

Writes the instance file again with the window's title and the time now as the time the app was last activated. The host calls it when the user activates the window, on the thread of the drawings.

NoteTitleChanged()

Writes the instance file again with the window's title as it is now, and the time the app was last activated as it was: the title of a window that opens its drawing after the server starts, or a drawing saved under another name, is not the one announced at the start, and a program that lists the apps reads it. The host calls it when its title changes, on the thread of the drawings.

RevokeToken(string)

Takes a token back: the connections that carry it are refused at their next request and closed, and no new hello takes it. Does nothing for a token the server does not know.

Start()

Opens the pipe, writes the instance file and starts listening. Call it on the thread of the drawings: it reads the window's title.

Stop()

Stops listening, closes the connections and deletes the instance file. Calling it again does nothing.