2 csiserver control application example – Campbell Scientific LoggerNet Server SDK User Manual

Page 20

Advertising
background image

Section 3. Developing an Application Using the CsiServer Control

CsiLogMonitor 1.0 Type Library
CsiServer 1.0 Type Library

Check the box next to the CsiServer 1.0 Type Library, click Apply, and then
close the window. Now an icon for the CsiServer control and other common
controls will appear in the toolbox.

3.2.2 CsiServer Control Application Example

Begin creating an application that will start and stop the LoggerNet server. An
example of a user interface that accomplishes this task is shown in Figure 3-1.
This interface includes the CsiServer control and other objects on the form to
create a functional application that will start and stop the LoggerNet server.

FIGURE 3-1. CsiServer Example

Now that the interface has been designed, the code can be organized to
accomplish the requirements of the application. Initially, the one required
parameter, serverWorkDir, must be set and then the startServer() method can
be called to start the LoggerNet server. A basic example of code used to start
the LoggerNet server is listed in the table below:

Private Sub cmdStart_Click()

'Set the required properties for the LoggerNet Server
CsiServer.serverWorkDir = "c:\campbellsci\loggernet\sys\bin"

'Start the LoggerNet Server
If CsiServer.serverStarted Then
txtServer.Text = "Server Already Started"
Else
CsiServer.startServer
txtServer.Text = "Server Started"
cmdStart.Enabled = False
cmdStop.Enabled

=

True

End

If


End Sub

3-2

Advertising