// Test C-MOVE where both incoming and
// outgoing associations are handled in
// the same event loop without the need
// to have a separate thread for the
// incomming C-STORE’s association
[Test]
[Description(“Move and Store”)]
public void MoveAndStore()
{
    // Create an object with the query matching criteria (Identifier)
    // We look for a specific patient name and patient ID
    // The equivalent ‘SQL’ style query is:
    //  SELECT ALL DICOM OBJECTS
    //    WHERE [PATIENT NAME] == ‘John^Doe’
    //    AND [PATIENT ID] == ’123765′
    DCXOBJ query = new DCXOBJ();
    DCXELM e = new DCXELM();
    e.Init((int)DICOM_TAGS_ENUM.patientName);
    e.Value = “John^Doe”; // where [PATIENT NAME] == ‘John^Doe’
    query.insertElement(e);
    e.Init((int)DICOM_TAGS_ENUM.patientID);
    e.Value = “123456”// and [PATIENT ID] == ’123765′
    query.insertElement(e);
    // We need an accepter to handle the incomming association
    DCXACC accepter = new DCXACC();
    accepter.StoreDirectory = @”.\MoveAndStore\”// Where the DICOM files will be stored
    Directory.CreateDirectory(accepter.StoreDirectory);
    // We need a requester to issue the C-MOVE command
    DCXREQ requester = new DCXREQ();
    requester.MoveAndStore(
        MyAETitle, // The AE title that issue the C-MOVE
        IS_AE,     // The PACS AE title
        IS_Host,   // The PACS IP address
        IS_port,   // The PACS listener port
        MyAETitle, // The AE title to send the results to (PACS must have it configured)
        query,     // The matching criteria
        104,       // The port to start listening on for incomming C-STORE’s
        accepter); // The accepter to handle the incomming association
}