Ejemplo n.º 1
0
        private void btnInstanceLogin_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            // Use this line below if Login() is not used
            // Batch b = new Batch("AdvancedDemo", "FormId");

            // Otherwise use these next 4 lines:
            Batch b = new Batch();

            b.ApplicationName = "AdvancedDemo";
            b.StationName = "FormId";
            b.Login();

            // Do something here...
            MessageBox.Show("StationName is: " + b.StationName);

            // Logs out fromn the CSM
            b.Logout();

            // Dispose the batch instance
            // and disconnect from the CSM
            // The Dispose() will not
            // log out from the CSM if the
            // Logout() has been called

            // If Logout() has not been called
            // then Dispose() will perform
            // the log out.

            // In any case Dispose() should always
            // be called.

            b.Dispose();
        }