// Note: you may change the name of the 'Apply' method as desired, but be sure to change the // corresponding parameter in the MenuAction and ButtonAction attributes /// <summary> /// Called by the framework when the user clicks the "apply" menu item or toolbar button. /// </summary> public void Apply() { // TODO: add code here to implement the functionality of the tool //|| this.Context.SelectedServerGroup.IsLocalDatastore if (!Enabled || this.Context.SelectedSingleSeries == null) { return; } //Dictionary<ApplicationEntity, List<StudyInformation>> retrieveInformation = new Dictionary<ApplicationEntity, List<StudyInformation>>(); List <string> seriesUIDs = new List <string>(); List <string> studyUIDs = new List <string>(); foreach (SeriesItem item in this.Context.SelectedMultipleSeries) { string foo = item.SeriesInstanceUID; Platform.Log(LogLevel.Info, foo); seriesUIDs.Add(item.SeriesInstanceUID); studyUIDs.Add(item.StudyInstanceUID); } string callingAE = ServerTree.GetClientAETitle(); BackgroundTask task = new BackgroundTask( delegate(IBackgroundTaskContext context) { // Send series level c-move //MyMoveScu moveScu = new MyMoveScu( //DicomMoveManager.MyMoveScu moveScu = new DicomMoveManager.MyMoveScu( MoveScuBase moveScu = new StudyRootMoveScu( callingAE, this.Context.SelectedServer.AETitle, this.Context.SelectedServer.Host, this.Context.SelectedServer.Port, callingAE); // Need to disable this line for the 1.5 version, because the movescu // code only allows one level per movescu request. This may not work with some // PACS moveScu.AddStudyInstanceUid(studyUIDs[0]); foreach (string seriesUID in seriesUIDs) { moveScu.AddSeriesInstanceUid(seriesUID); } moveScu.Move(); //moveScu.updated += delegate(object sender, EventArgs args) //{ // OnMoveUpdate(context, moveScu.completed, moveScu.total, moveScu.movestatus); // //context.ReportProgress(new BackgroundTaskProgress(moveScu.completed / moveScu.total, "Moving Study")); // //OnMoveUpdate(context, moveScu.completed, moveScu.total); //}; // += new EventHandler(OnMoveCompleted); moveScu.Dispose(); //OnMoveCompleted(); }, true); task.Run(); LocalDataStoreActivityMonitorComponentManager.ShowSendReceiveActivityComponent(this.Context.DesktopWindow); // //if (!retrieveInformation.ContainsKey(item.Server)) // // retrieveInformation[item.Server] = new List<StudyInformation>(); // //StudyInformation studyInformation = new StudyInformation(); // //studyInformation.PatientId = item.PatientId; // //studyInformation.PatientsName = item.PatientsName; // //DateTime studyDate; // //DateParser.Parse(item.StudyDate, out studyDate); // //studyInformation.StudyDate = studyDate; // //studyInformation.StudyDescription = item.StudyDescription; // //studyInformation.StudyInstanceUid = item.StudyInstanceUID; // //retrieveInformation[item.Server].Add(studyInformation); }