Exemplo n.º 1
0
        //string study, string modality, out string seriesUID, bool bSaveEFilm
        private string CreateSeries(EFilmModel eFilmModel)
        {
            var studyInstanceUid = eFilmModel.StudyInstanceUid;

            Series series = DBWrapperHelper.DBWrapper.CreateSeries();

            var uidManager = McsfDatabaseDicomUIDManagerFactory.Instance().CreateUIDManager();

            series.SeriesInstanceUID  = uidManager.CreateSeriesUID("");//eFilmModel.EFilmSeriesUid;
            series.StudyInstanceUIDFk = studyInstanceUid;
            series.Modality           = eFilmModel.EFilmModality;
            // new seriesNumber equals the max seriesNumber of exist series add one
            series.SeriesNumber = Convert.ToInt32(GetSerieNumber(studyInstanceUid)) + 1;
            series.ReconResult  = 2; //代表重建已完成
            if (studyInstanceUid == "****")
            {
                return(string.Empty);                            //FilmingHelper.StarsString) return;
            }
            //check whether disk space is enough
            ICommunicationProxy pCommProxy = Containee.Main.GetCommunicationProxy();
            var target = new SystemResManagerProxy(pCommProxy);

            if (!target.HaveEnoughSpace())
            {
                Logger.LogError("No enough disk space, so Electronic Image Series will not be created");
                Containee.Main.ShowStatusError("UID_Filming_No_Enough_Disk_Space_To_Create_Electronic_Image_Series");
                return(string.Empty);
            }

            series.Save();
            return(series.SeriesInstanceUID);
        }
Exemplo n.º 2
0
        private static void CreateSeries(string studyInstanceUid, string modality)
        {
            var    db     = FilmingDbOperation.Instance.FilmingDbWrapper;
            Series series = db.CreateSeries();

            SeriesInstanceUid         = series.SeriesInstanceUID;
            series.StudyInstanceUIDFk = studyInstanceUid;
            // new seriesNumber equals the max seriesNumber of exist series add one
            _seriesNumber            = Convert.ToInt32(FilmingHelper.GetSerieNumber(studyInstanceUid)) + 1;
            series.SeriesNumber      = _seriesNumber;
            series.SeriesDescription = Printers.Instance.NewSeriesDescription;
            series.Modality          = modality;

            if (studyInstanceUid == FilmingHelper.StarsString)
            {
                return;
            }


            //check whether disk space is enough
            ICommunicationProxy pCommProxy = FilmingViewerContainee.Main.GetCommunicationProxy();
            var target = new SystemResManagerProxy(pCommProxy);

            if (!target.HaveEnoughSpace())
            {
                Logger.LogWarning("No enough disk space, so Electronic Image Series will not be created");
                //FilmingViewerContainee.ShowStatusWarning("UID_Filming_No_Enough_Disk_Space_To_Create_Electronic_Image_Series");
                FilmingViewerContainee.Main.ShowStatusWarning("UID_Filming_No_Enough_Disk_Space_To_Create_Electronic_Image_Series");
                return;
            }

            series.Save();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 工厂模式实现通信类对象
        /// </summary>
        /// <param name="devTag">标识设备标记:串口--配置文件定义的串口标识名
        ///                                    网口--网络所在设备的节点号
        ///                                    </param>
        /// <returns></returns>
        public ICommunicationProxy GetCommunicationProxy(string devTag)
        {
            ICommunicationProxy proxy = null;

            // 从配置文件中读取当前设备的通信模式
            string commMode = GetCommunicationMode();

            switch (commMode)
            {
            case "COM":           // 设备采用串口通信
                // 生成串口类对象
                proxy = CreateSerialPortObject(devTag);

                break;

            case "ETHERENT":      // 设备采用以太网通信
                // 生成以太网对象
                proxy = CreateEthernetObject(devTag);

                break;

            default:
                break;
            }

            return(proxy);
        }
Exemplo n.º 4
0
 public override void Startup()
 {
     base.Startup();
     _iCommunicationProxy        = GetCommunicationProxy();
     _handleProcessStatusCommand = new ProcessCacheCommandHandler();
     _handleSystemDataCommand    = new SystemCacheCommandHandler();
 }
Exemplo n.º 5
0
 public RemoteMethodInvoker(IAppContext appContext)
 {
     //_communicationProxy = appContext.DefaultCLRCommunicationProxy as CLRCommunicationProxy;
     _communicationProxy = appContext.GetObject <ICommunicationProxy>(AppContextObjectName.DefaultCommunicationProxy);
     if (_communicationProxy != null)
     {
         _communicationProxy.RegisterCommandHandlerEx(COMMUNICATION_ID, HandleRemoteInvoke);
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Init proxy
 /// </summary>
 /// <param name="processCommunicationProxy">proxy object</param>
 /// <returns></returns>
 public bool Initialize(ICommunicationProxy proxy)
 {
     if (null == proxy)
     {
         CLRLogger.GetInstance().LogDevError("proxy is null");
         return(false);
     }
     _systemCommunicationProxy = proxy;
     PreExecute();
     return(true);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Init proxy
 /// </summary>
 /// <param name="processCommunicationProxy">proxy object</param>
 /// <returns></returns>
 public bool Initialize(ICommunicationProxy processCommunicationProxy)
 {
     if (null == processCommunicationProxy)
     {
         CLRLogger.GetInstance().LogDevError("ProcessCacheProxy is null.");
         return(false);
     }
     _processCommunicationProxy = processCommunicationProxy;
     _proxyName = _processCommunicationProxy.GetName();
     PreExecute();
     return(true);
 }
Exemplo n.º 8
0
        public static void UpdatePrintStatus(List <string> uids, DBWrapper db, ICommunicationProxy proxy)
        {
            try
            {
                Logger.LogFuncUp();

                uids.RemoveAll(uid => string.IsNullOrWhiteSpace(uid));
                if (uids.Count == 0)
                {
                    return;
                }

                //var db = FilmingDbOperation.Instance.FilmingDbWrapper;

                //var proxy = FilmingViewerContainee.Main.GetCommunicationProxy();

                db.SetAutoNotifyOn(proxy);
                foreach (var uid in uids)
                {
                    db.Update("studytable", "StudyInstanceUID='" + uid + "'", "StudyPrintStatus='1'");
                }
                //send db update notification

                IMcsfDBInfoModal dbInfoModal = new IMcsfDBInfoModal();
                dbInfoModal.EventItems = new List <IMcsfDBInfoModalItem>();
                IMcsfDBInfoModalItem item;
                //add event for itself
                foreach (var uid in uids)
                {
                    item         = new IMcsfDBInfoModalItem();
                    item.Type    = DBEventType.EventStudyUpdate;
                    item.UID     = uid;
                    item.SubType = DBEventSubType.EventAll;
                    item.SubUID  = "";
                    dbInfoModal.EventItems.Add(item);
                }
                var DBCommProxy = McsfDatabaseProxyFactory.Instance().CreateDatabaseProxy(proxy);
                DBCommProxy.SendEventInfo(dbInfoModal);


                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 9
0
        private void SaveEFilm(ICommunicationProxy proxy = null, bool ifSaveEFilm = false)
        {
            try
            {
                Logger.LogFuncUp();

                if (_viewerWindow == null)
                {
                    _viewerWindow = new MedViewerWindow(proxy);
                    //MedViewerWindow.ImageBurntEvent += MedViewerWindowOnImageBurntEvent;
                }

                while (true)
                {
                    try
                    {
                        //window.Hide();
                        //Console.WriteLine("Thread: wait a job");
                        windowLockEvent.WaitOne();
                        var electronicFilmInfo = new ElectronicFilmInfo((int)_row, (int)_column, filmImageList);
                        _viewerWindow.FilmInfo = electronicFilmInfo;
                        _viewerWindow.SetRenderSize(_size);
                        _viewerWindow.ShowAllImages();
                        _viewerWindow.Show();
                        _viewerWindow.SaveEfilm(_efilmFullPath, ref _efilmOriginalSopInstanceUID, ref _efilmOriginalStudyInstanceUid, ifSaveEFilm);
                        _viewerWindow.Hide();
                        MedViewerWindowOnImageBurntEvent(); //MedViewerWindow.RaiseImageBurntEvent();
                        windowLockEvent.Reset();
                        //Console.WriteLine("Thread: window lock reset");
                    }
                    catch (Exception ex)
                    {
                        Logger.LogFuncException(ex.Message + ex.StackTrace);
                        _efilmOriginalSopInstanceUID = string.Empty;
                        MedViewerWindowOnImageBurntEvent(); //MedViewerWindow.RaiseImageBurntEvent();
                        windowLockEvent.Reset();
                        //Console.WriteLine("Thread: Exception & window lock reset");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 10
0
        //static private MedViewerWindow _medViewerWindow;
        //static public MedViewerWindow Instance(ICommunicationProxy proxy=null)
        //{
        //    _proxy = null == proxy ? _proxy : proxy;
        //    if(_medViewerWindow == null)
        //    {
        //        _medViewerWindow = new MedViewerWindow();
        //    }

        //    return _medViewerWindow;
        //}



        public MedViewerWindow(ICommunicationProxy proxy = null)
        {
            try
            {
                Logger.LogFuncUp();

                //_renderSize = renderSize;

                _proxy = null == proxy ? _proxy : proxy;

                InitializeComponent();

                // String sEntryPath = mcsf_clr_systemenvironment_config.GetApplicationPath("FilmingConfigPath");
                //String sReviewEntryPath = mcsf_clr_systemenvironment_config.GetApplicationPath("ReviewConfigPath");
                medViewerControl.InitializeWithoutCommProxy(@"config/review/");

                Closing += OnMedViewerWindowClosing;

                ImageLoadedFlag = false;

                ShowInTaskbar         = false;
                WindowStartupLocation = WindowStartupLocation.Manual;
                //SetRenderSize(renderSize);


                //this.Focusable = false;

                //DataManagement for separation UI with data
                //var studyTree = new StudyTree();
                //_dataLoader = DataLoaderFactory.Instance().CreateLoader(studyTree, DBWrapperHelper.DBWrapper);
                //_dataLoader.SopLoadedHandler += OnImageDataLoaded;

                //ResourceMgr nls = ResourceMgr.Instance();
                //var resDic = nls.Init("Filming");
                //Resources.MergedDictionaries.Add(resDic);

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Register containee events to communication with mainFrame by communication proxy.
        /// </summary>
        /// <param name="commProxy">Use a interface to communication with mainFrame.</param>
        public void Register(ICommunicationProxy commProxy, ICommunicationMap commMap)
        {
            GlobalDefinition.LoggerWrapper.LogTraceInfo(
                "enter function --- ContaineeUtility.Register(ICommunicationProxy commProxy, ICommunicationMap commMap)");

            if (null == commProxy)
            {
                GlobalDefinition.LoggerWrapper.LogDevError("PRFE Containee CommunicationProxy is null.");

                return;
            }

            _commHelper = commMap;

            if (null != _commHelper)
            {
                _commHelper.RegisterCommand();
            }
        }
Exemplo n.º 12
0
        private void Init(
            Thread mainThread,
            ICommunicationProxy commProxy, ICommunicationMap commMap)
        {
            string appCfgPath = @"D:\X-SW\XA\Trunk\UIH\appdata\patientadmin\config\PAShellWindowConfigure.xml";
            var    app        = new XApp(appCfgPath, commProxy);

            GlobalDefinition.Main    = this;
            GlobalDefinition.MainWnd = app.MainWindow;
            //GlobalDefinition.MainDataContext = app.MainWindow.DataContext;
            GlobalDefinition.MainThread = mainThread;
            try
            {
                _Containee.Register(commProxy, commMap);
            }
            catch (System.Exception ex)
            {
                GlobalDefinition.LoggerWrapper.LogDevError(ex.Message);
                GlobalDefinition.LoggerWrapper.LogDevError(ex.StackTrace);
            }
            app.Run();
        }
Exemplo n.º 13
0
        public void ResumeAllFilmingJob(ICommunicationProxy proxy)
        {
            try
            {
                Logger.LogFuncUp();

                _proxy = proxy;
                CommandContext cs = new CommandContext();
                cs.iCommandId = RESUME_ALL_PRINT_JOB_COMMAND;//7093
                cs.sReceiver  = CommunicationNodeName.CreateCommunicationProxyName(MCSF_FILMING_NAME);
                //cs.bServiceAsyncDispatch = true;
                if (-1 == _proxy.AsyncSendCommand(cs))
                {
                    throw new Exception("failed to send ResumeAllFilmingJob command to filming module!");
                }

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.StackTrace);
            }
        }
Exemplo n.º 14
0
        /// <summary>
        /// send filming command to filming module
        /// </summary>
        /// <param name="proxy">communication proxy of the filming command sender</param>
        public void SendFilmingJobCommand(ICommunicationProxy proxy, bool withAnnotations = true)
        {
            try
            {
                Logger.LogFuncUp();

                _proxy = proxy;
                CommandContext cs = new CommandContext();
                cs.iCommandId = MCSF_AUTO_FILMING_COMMAND_ID;//7088
                //cs.sSender = param.GetValue(2).ToString();// "FilmingFE";
                //cs.sReceiver = param.GetValue(3).ToString();// "FilmingBE";
                //cs.sReceiver = "FilmingBE";
                cs.sReceiver = CommunicationNodeName.CreateCommunicationProxyName(MCSF_FILMING_NAME);//CreateCommunicationProxyName(MCSF_FILMING_NAME, FRONT_END);
                //cs.pCommandCallback = (ICommandCallbackHandler)param.GetValue(4);
                //cs.bServiceAsyncDispatch = true;
                byte[] serializedJob = CreateFilmingJobInstance(withAnnotations);
                cs.sSerializeObject = serializedJob;

                // cs.bServiceAsyncDispatch = true;

                if (-1 == _proxy.AsyncSendCommand(cs))
                {
                    throw new Exception("failed to send auto filming command to filming module!");
                }

                FilmingUtility.UpdatePrintStatus(new List <string> {
                    _studyInstanceUid
                }, DBWrapperHelper.DBWrapper, _proxy);

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.StackTrace);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// send filming command to filming module
        /// </summary>
        /// <param name="proxy">communication proxy of the filming command sender</param>
        ///

        /// <key>\n
        /// PRA:Yes \n
        /// Traced from: SSFS_PRA_ImageError_SW_SW_DataTransfer \n
        /// Tests: N/A \n
        /// Description:  Send Filming Job Info to Backend Printer Serives\n
        /// Short Description:  FilmingCommand\n
        /// Component:Filming \n
        /// </key> \n

        public void SendFilmingJobCommand(ICommunicationProxy proxy)
        {
            try
            {
                Logger.LogFuncUp();

                CommandContext cs = new CommandContext();
                cs.iCommandId = MCSF_AUTO_FILMING_COMMAND_ID;//7088
                //cs.sSender = param.GetValue(2).ToString();// "FilmingFE";
                //cs.sReceiver = param.GetValue(3).ToString();// "FilmingBE";
                //cs.sReceiver = "FilmingBE";
                cs.sReceiver = CommunicationNodeName.CreateCommunicationProxyName(MCSF_FILMING_NAME);//CreateCommunicationProxyName(MCSF_FILMING_NAME, FRONT_END);
                //cs.pCommandCallback = (ICommandCallbackHandler)param.GetValue(4);
                //cs.bServiceAsyncDispatch = true;
                byte[] serializedJob = CreateFilmingJobInstance();
                if (serializedJob == null)
                {
                    throw new Exception("send filming job command failure, serializedJob is null ");
                }
                cs.sSerializeObject = serializedJob;

                // cs.bServiceAsyncDispatch = true;

                int errorCode = proxy.AsyncSendCommand(cs);
                if (0 != errorCode)
                {
                    throw new Exception("send filming job command failure, error code: " + errorCode);
                }

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 16
0
 public XBootstrapper(string configPath, ICommunicationProxy communicationProxy)
 {
     _configPath         = configPath;
     _communicationProxy = communicationProxy;
 }
Exemplo n.º 17
0
        public static bool CheckMemoryForLoadingSeries(List <Tuple <string, int> > seriesUidListAndCount, ICommunicationProxy proxy)
        {
            var    filmingDb       = FilmingDbOperation.Instance.FilmingDbWrapper;
            double estimatedMBytes = 0D;

            foreach (var series in seriesUidListAndCount)
            {
                var imageList = filmingDb.GetImageListBySeriesInstanceUID(series.Item1);
                estimatedMBytes += (double)imageList[0].Rows * imageList[0].Columns * imageList[0].SamplesPerPixel / 8.0 * imageList[0].BitsAllocated / 1024.0 / 1024.0 * FilmingUtility.MultipleOfCellPerImage * series.Item2;
                Logger.LogInfo("Cal:" + imageList[0].Rows + "*" + imageList[0].Columns + "*" + imageList[0].SamplesPerPixel + " / 8.0 *" + imageList[0].BitsAllocated + "/ 1024.0 / 1024.0 *" + FilmingUtility.MultipleOfCellPerImage + "*" + series.Item2);
            }
            MemoryManagement memoryManagement = new MemoryManagement();

            MemoryManagement._pCommProxy = proxy;
            //return memoryManagement.IsMemoryEnough((int)estimatedMBytes + 1);
            var canLoaded = memoryManagement.ReserveMemoryForCurrentApp((uint)estimatedMBytes);

            if (!canLoaded)
            {
                Logger.LogInfo("ReserveMemoryForCurrentApp:" + estimatedMBytes + "MBytes");
            }
            return(canLoaded);
        }
Exemplo n.º 18
0
 public Communicator(ICommunicationProxyFactory communicationProxyFactory)
 {
     _communicationProxy = communicationProxyFactory.Create();
 }
Exemplo n.º 19
0
 public GardenOrgWebsiteAgent(ILogger <GardenOrgWebsiteAgent> logger, ICommunicationProxy commsProxy)
 {
     _logger     = logger;
     _commsProxy = commsProxy;
 }
Exemplo n.º 20
0
        /// <summary>
        /// Call this method send command to other containees.
        /// </summary>
        /// <returns>null or -1: send command failed.Otherwise, it is a ISyncResult object that included detail info.</returns>
        public static object SendCommand(ICommunicationProxy commProxy, CommandContext cmdCtx, CommandType cmdType)
        {
            GlobalDefinition.LoggerWrapper.LogDevInfo("enter ContaineeUtility.SendCommand");
            if (null == commProxy)
            {
                GlobalDefinition.LoggerWrapper.LogDevError("Containee CommunicationProxy is null.");
                return(null);
            }

            try
            {
                if (null != cmdCtx)
                {
                    string content = String.Format("CommandID: {0} ||| Receiver: {1} ||| Sender: {2}",
                                                   cmdCtx.iCommandId.ToString(),
                                                   //cmdCtx.sStringObject,
                                                   cmdCtx.sReceiver,
                                                   cmdCtx.sSender);

                    GlobalDefinition.LoggerWrapper.LogDevInfo(content);


                    ISyncResult pResult = null;
                    int         result  = -1;
                    switch (cmdType)
                    {
                    case CommandType.AsyncCommand:
                        GlobalDefinition.LoggerWrapper.LogDevInfo("case CommandType.AsyncCommand");
                        result = commProxy.AsyncSendCommand(cmdCtx);
                        break;

                    case CommandType.SyncCommand:
                        GlobalDefinition.LoggerWrapper.LogDevInfo("case CommandType.SyncCommand");
                        pResult = commProxy.SyncSendCommand(cmdCtx);
                        result  = pResult.GetCallResult();
                        break;

                    default:
                        GlobalDefinition.LoggerWrapper.LogDevError("case default");
                        result = commProxy.AsyncSendCommand(cmdCtx);
                        break;
                    }

                    if (result == 0)
                    {
                        GlobalDefinition.LoggerWrapper.LogDevInfo("Send command " + cmdCtx.iCommandId.ToString() +
                                                                  " to " + cmdCtx.sReceiver + " successfully.");

                        if (cmdType == CommandType.SyncCommand)
                        {
                            return(pResult);
                        }
                        else
                        {
                            return(result);
                        }
                    }
                    else
                    {
                        ContaineeUtility._feCmdCallbackList.Remove(cmdCtx.pCommandCallback as FECommandCallbackHandler);
                        GlobalDefinition.LoggerWrapper.LogDevError(
                            string.Format("Send command {0} to {1} failed. Result = {2}", cmdCtx.iCommandId.ToString(),
                                          cmdCtx.sReceiver, result.ToString()));
                        return(null);
                    }
                }
                else
                {
                    GlobalDefinition.LoggerWrapper.LogDevError("Command param is error.");
                    return(null);
                }
            }
            catch (Exception ex)
            {
                GlobalDefinition.LoggerWrapper.LogDevError(ex.Message);
                GlobalDefinition.LoggerWrapper.LogDevError(ex.StackTrace);
            }

            return(null);
        }
Exemplo n.º 21
0
 public XApp(string configPath, ICommunicationProxy communicationProxy)
 {
     _configPath         = configPath;
     _communicationProxy = communicationProxy;
 }
 public InformationGatheringOrchestrator(ILogger <InformationGatheringOrchestrator> logger, LocalFallbackAddress fallbackConfig, ICommunicationProxy commsProxy)
 {
     _logger         = logger;
     _commsProxy     = commsProxy;
     _fallbackConfig = fallbackConfig;
 }
Exemplo n.º 23
0
 public XCommunicator(IAppContext appContext)
 {
     //_communicationProxy = appContext.DefaultCLRCommunicationProxy as ICommunicationProxy;
     _communicationProxy = appContext.GetObject <ICommunicationProxy>(AppContextObjectName.DefaultCommunicationProxy);
 }