Beispiel #1
0
        public static void NotifyMainFrameAutoShutDownAfterFilming(string studyUID)
        {
            try
            {
                Logger.LogFuncUp();

                object[] param = new object[7];
                param[0] = (int)CommandID.NOTIFY_MAINFRAME_AUTO_SHUT_DOWN;
                param[1] = CommandType.AsyncCommand;
                param[2] = "FilmingFE";
                param[3] = CommunicationNodeName.CreateCommunicationProxyName("MainFrame_FE");

                param[4] = null;
                param[5] = null;
                param[6] = studyUID;


                FilmingViewerContainee.SendCommand(param);

                Logger.LogFuncDown();
            }
            catch (System.Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="status">"-1" Indicates that there are images Displayed, Null indicates the contrary</param>
        public static void NotifyMainFrameAboutFilmingStatus(string status)
        {
            try
            {
                Logger.LogFuncUp();

                object[] param = new object[7];
                param[0] = (int)CommandID.NOTIFY_FILMING_STATUS;
                param[1] = CommandType.AsyncCommand;
                //param[2] = "FilmingFE";
                param[4] = null;
                param[5] = null;
                param[6] = status;

                param[3] = CommunicationNodeName.CreateCommunicationProxyName("MainFrame_FE");

                FilmingViewerContainee.SendCommand(param);

                Logger.LogFuncDown();
            }
            catch (System.Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Beispiel #3
0
        //public static void SaveFilmBucketCommand(FilmsInfo.Builder filmsInfo, JobCreator jobCreator)
        //{
        //    try
        //    {
        //        Logger.LogFuncUp();

        //        object[] param = new object[6];
        //        param[0] = (int)CommandID.SAVE_FILMS_COMMAND;
        //        param[1] = CommandType.AsyncCommand;
        //        //param[2] = "FilmingFE";
        //        param[3] = CommunicationNodeName.GetPeerCommunicationProxyName(FilmingViewerContainee.Main.GetName(), "BE");
        //        param[4] = new SaveFilmBucketCallBackHandler(jobCreator);
        //        param[5] = filmsInfo.Build().ToByteArray();

        //        FilmingViewerContainee.SendCommand(param);

        //        Logger.LogFuncDown();
        //    }
        //    catch (System.Exception ex)
        //    {
        //        Logger.LogFuncException(ex.Message+ex.StackTrace);
        //    }
        //}

        //public static void SaveFilmsCommand(FilmsInfo.Builder filmsInfo, JobCreator jobCreator)
        //{
        //    try
        //    {
        //        Logger.LogFuncUp();

        //        object[] param = new object[6];
        //        param[0] = (int)CommandID.SAVE_FILMS_COMMAND;
        //        param[1] = CommandType.AsyncCommand;
        //        //param[2] = "FilmingFE";
        //        param[3] = CommunicationNodeName.GetPeerCommunicationProxyName(FilmingViewerContainee.Main.GetName(), "BE");
        //        param[4] = new SaveFilmsCallBackHandler(jobCreator);
        //        param[5] = filmsInfo.Build().ToByteArray();

        //        FilmingViewerContainee.SendCommand(param);

        //        Logger.LogFuncDown();
        //    }
        //    catch (System.Exception ex)
        //    {
        //        Logger.LogFuncException(ex.Message+ex.StackTrace);
        //    }
        //}

        //public static void LoadImageCommand(string loadImageParam)
        //{
        //    FilmingViewerContainee.SendCommand(
        //            (int)CommandID.LOAD_IMAGE_COMMAND,
        //            CommandType.AsyncCommand,
        //            "",
        //            CommunicationNodeName.GetPeerCommunicationProxyName(FilmingViewerContainee.Main.GetName(), "BE"),
        //            //new LoadImagesCallBackHandler(FilmingViewerContainee.FilmingViewerWindow),
        //            null,
        //            null,
        //            loadImageParam);
        //}

        //public static void DoClearSheetCommand(bool bUseCallback)
        //{
        //    object[] param = new object[7];
        //    param[0] = (int)CommandID.REMOVE_ALL_COMMAND;
        //    param[1] = CommandType.SyncCommand;
        //    //param[2] = "FilmingFE";
        //    param[3] = CommunicationNodeName.GetPeerCommunicationProxyName(FilmingViewerContainee.Main.GetName(), "BE");
        //    param[4] = bUseCallback ? new CleerSheetForAutoFilmingCallBackHandler(FilmingViewerContainee.FilmingViewerWindow) : null;
        //    param[5] = null;
        //    param[6] = "1";

        //    FilmingViewerContainee.SendCommand(param);
        //}

        public static void DoCreateNewViewerController(string index)
        {
            try
            {
                Logger.LogFuncUp();

                object[] param = new object[7];
                param[0] = (int)CommandID.CREATE_NEW_VIEWER_CONTROLLER;
                param[1] = CommandType.SyncCommand;
                //param[2] = "FilmingFE";

                param[4] = null;
                param[5] = null;
                param[6] = index;

                param[3] = CommunicationNodeName.GetPeerCommunicationProxyName(FilmingViewerContainee.Main.GetName(), "BE");

                FilmingViewerContainee.SendCommand(param);

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Beispiel #4
0
        //public static void SetFilmingWindowToTop()
        //{
        //    try
        //    {
        //        //string title = FilmingViewerContainee.FilmingViewerWindow.Title;

        //        //move the window to screen center
        //        FilmingViewerContainee.FilmingViewerWindow.WindowStartupLocation
        //            = WindowStartupLocation.Manual;
        //        FilmingViewerContainee.FilmingViewerWindow.Left =
        //            (SystemParameters.PrimaryScreenWidth
        //            - FilmingViewerContainee.FilmingViewerWindow.Width) / 2;
        //        FilmingViewerContainee.FilmingViewerWindow.Top =
        //            (SystemParameters.PrimaryScreenHeight
        //            - FilmingViewerContainee.FilmingViewerWindow.Height) / 2;


        //        FilmingViewerContainee.FilmingViewerWindow.Topmost = true;
        //        FilmingViewerContainee.FilmingViewerWindow.Show();
        //        FilmingViewerContainee.FilmingViewerWindow.Topmost = false;
        //    }
        //    catch (System.Exception ex)
        //    {
        //        Logger.LogFuncException(ex.Message+ex.StackTrace);
        //    }
        //}

        //public static void DoHideWindow()
        //{
        //    if (null == FilmingViewerContainee.FilmingViewerWindow)
        //    {
        //        return;
        //    }

        //    //move the window out of screen wide
        //    FilmingViewerContainee.FilmingViewerWindow.WindowStartupLocation = WindowStartupLocation.Manual;
        //    FilmingViewerContainee.FilmingViewerWindow.Left = -1500;
        //    FilmingViewerContainee.FilmingViewerWindow.Top = -1500;
        //}

        #endregion  //UI Operation

        #region Image Command

        public static void SaveEFilmsCommand(string sImagePathList)
        {
            try
            {
                Logger.LogFuncUp();

                object[] param = new object[7];
                param[0] = (int)CommandID.SAVE_EFILMS_COMMAND;
                param[1] = CommandType.AsyncCommand;
                //param[2] = "FilmingFE";
                param[4] = null;
                var encoding = Encoding.UTF8.GetBytes(sImagePathList);
                param[5] = encoding;
                //param[6] = sImagePathList;

                param[3] = CommunicationNodeName.CreateCommunicationProxyName("FilmingService");

                FilmingViewerContainee.SendCommand(param);

                Logger.LogFuncDown();
            }
            catch (System.Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Beispiel #5
0
        public static void SendFilmingCommandToServiceFE()
        {
            try
            {
                Logger.LogFuncUp();

                object[] param = new object[7];
                param[0] = (int)CommandID.CREATE_FILMING_JOB;
                param[1] = CommandType.AsyncCommand;
                //param[2] = "FilmingFE";
                param[4] = null;
                param[5] = "Hello";
                //param[6] = sImagePathList;

                param[3] = CommunicationNodeName.CreateCommunicationProxyName("FilmingServiceFE");

                FilmingViewerContainee.SendCommand(param);

                Logger.LogFuncDown();
            }
            catch (System.Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Beispiel #6
0
        public static void SendReplaceStudyToMainFrame(string studyInstanceUid)
        {
            try
            {
                Logger.LogFuncUp();

                //Create interData
                var interData = new InteractionInfoWrapper();
                interData.SetSrcAppName("PA");
                interData.SetDestAppName("FilmingCard");
                interData.SetOperationID(131);//(int)PAToFilmingOperationID.SendImage);

                PrepareStudyInfo(studyInstanceUid, ref interData);

                object[] param = new object[7];
                param[0] = (int)CommandID.REPLACE_STUDY;
                param[1] = CommandType.AsyncCommand;
                //param[2] = "FilmingFE";
                param[4] = null;
                param[5] = interData.Serialize();
                param[6] = null;

                param[3] = CommunicationNodeName.CreateCommunicationProxyName("MainFrame_FE");

                FilmingViewerContainee.SendCommand(param);

                Logger.LogFuncDown();
            }
            catch (System.Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
        /// \brief  Handle command
        ///
        /// \param[in] cc       command context
        /// \param[in] marObj   marshal object
        ///
        /// \return 0 for success and -1 for failure
        public override int HandleCommand(CommandContext pContext, ISyncResult pSyncResult)
        {
            try
            {
                CommandID id = (CommandID)pContext.iCommandId;
                Logger.LogFuncUp("Command: " + id.ToString());
                switch (id)
                {
                case CommandID.SWITCH_TO_APPLICATION:
                {
                    Logger.LogInfo("Get Mainframe's SWITCH_TO_APPLICATION information!");

                    if (!FilmingViewerContainee.IsInitialized)
                    {
                        FilmingViewerContainee.InitializeFilmingCard();
                    }

                    //var switchHandler=new SwitchToFilmingCommandHandler(pContext.sSerializeObject);
                    //switchHandler.LoadStudyByInterationInfo(pContext.sSerializeObject);
                    var infoWrapper = new InteractionInfoWrapper();
                    infoWrapper.Deserialize(pContext.sSerializeObject);

                    if (infoWrapper.GetSrcAppName().ToUpper() == "PA")         //只有从pa进入的切换才进入JobManager队列处理
                    {
                        var filmingCard = FilmingViewerContainee.FilmingViewerWindow as FilmingCard;
                        if (filmingCard != null && filmingCard.IsModalityDBT())
                        {
                            break;
                        }
                        List <string> studyInstanceUidList = (from study in infoWrapper.GetStudyList() select study.UID).ToList();
                        if (studyInstanceUidList.Count > 0)
                        {
                            FilmingViewerContainee.DataHeaderJobManagerInstance.PushProcessedJob(
                                new SwitchToFilmingCommandHandler(infoWrapper));
                        }
                    }
                }
                break;

                case CommandID.SynchronousStudyList:
                {
                    Logger.LogInfo("Get Mainframe's Update_StudyList information!");

                    if (!FilmingViewerContainee.IsInitialized)
                    {
                        FilmingViewerContainee.InitializeFilmingCard();
                    }
                    SynchronousLoadStudyByInterationInfo(pContext.sSerializeObject);
                    //  FilmingViewerContainee.DataHeaderJobManagerInstance.PushProcessedJob(new SynchronousToFilmingCommandHandler(pContext.sSerializeObject));
                }
                break;

                case CommandID.SAVE_EFILM_COMPLETE_COMMAND:
                    var      encoding          = new UTF8Encoding( );
                    string   constructedString = encoding.GetString(pContext.sSerializeObject);
                    string[] msg = constructedString.Split('#');       //msg = "patientName" + ["#ErrorInfo"]
                    if (msg.Length > 1)
                    {
                        //FilmingViewerContainee.ShowStatusWarning("UID_Filming_Fail_To_Save_EFilm", msg[0]);
                        FilmingViewerContainee.Main.ShowStatusWarning("UID_Filming_Fail_To_Save_EFilm", msg[0]);
                    }
                    else
                    {
                        //FilmingViewerContainee.Main.ShowStatusInfo("UID_Filming_Complete_To_Save_EFilm", msg[0]);
                        FilmingViewerContainee.Main.ShowStatusInfo("UID_Filming_Complete_To_Save_EFilm", msg[0]);
                    }


                    break;

                case CommandID.AutoLoadSeries:      //auto load series from review
                    //var seriesUids = pContext.sStringObject.Split(';');
                    //LoadSeries(seriesUids);

                    //FilmingViewerContainee.Main.ShowStatusInfo("UID_Filming_Request_Of_Loading_Series_From_Review");
                    FilmingViewerContainee.Main.ShowStatusInfo("UID_Filming_Request_Of_Loading_Series_From_Review");

                    FilmingViewerContainee.DataHeaderJobManagerInstance.PushProcessedJob(new ReviewSeriesCommandHandler(pContext.sStringObject));
                    break;

                case CommandID.SET_LAYOUT_COMMAND:

                    if (!FilmingViewerContainee.IsInitialized)
                    {
                        FilmingViewerContainee.InitializeFilmingCard();
                    }

                    FilmingViewerContainee.DataHeaderJobManagerInstance.PushProcessedJob(new SetLayoutCommandHandler(new LayoutCommandInfo(pContext.sStringObject)));
                    break;

                default:
                    break;
                }

                Logger.LogFuncDown();
            }
            catch (Exception exp)
            {
                //MedViewerLogger.Instance.LOG_DEV_ERROR(
                //    MedViewerLogger.Source,
                //    MedViewerLogger.LogUID,
                //    "Exception: " + exp.Message);
                Logger.LogFuncException(exp.Message);
                return(-1);
            }

            return(0);
        }