private void btnInstanceDelete_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Manually export collection 00000001 first through the controller, before proceeding");

            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Deletes the collection
            // even if it is locked
            b.Delete(collData);

            MessageBox.Show("collection 00000001 is gone");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
        private void btnInstanceFree_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Put the collection (writes it back)
            // to the CSM and keeps it in the same
            // queue
            b.Free(collData);

            MessageBox.Show("Collection: " + collData.Name + " is still in the same queue");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
        private void btnInstanceReject_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Reject the collection
            b.Reject(collData);

            MessageBox.Show("collection 00000001 is in Reject, please refresh the controller and drag it back");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
        private void btnInstancePut_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Put the collection (writes it back)
            // to the CSM and moves it to the next
            // queue
            b.Put(collData);

            MessageBox.Show("Collection: " + collData.Name + " is now in the next queue (ManualId), please refresh the controller and drag it back");

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }
        private void btnInstanceHistory_Click(object sender, EventArgs e)
        {
            // Create a new Batch instance
            // Logs onto the CSM with "AdvancedDemo" application
            // and "FormId" station

            Batch b = new Batch("AdvancedDemo", "FormId");

            // Gets the collection "00000001"

            ITisCollectionData collData = b.Get("00000001");

            // Gets the history for collData

            string[] h = b.History(collData);

            MessageBox.Show("History for " + collData.Name + " is: " + String.Join("->", h));

            // Dispose the batch instance
            // and disconnect from the CSM

            b.Dispose();
        }