示例#1
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);
            }
        }
示例#2
0
        void viewerWindow_ContentRendered(object sender, EventArgs e)
        {
            try
            {
                Logger.LogFuncUp();

                MedViewerWindow viewerWindow = sender as MedViewerWindow;


                //Console.WriteLine("Render image----begin");
                viewerWindow.SaveEfilm(_efilmFullPath, ref _efilmOriginalSopInstanceUID,
                                       ref _efilmOriginalStudyInstanceUid, _ifSaveEFilm);
                ;//MedViewerWindow.Instance().SaveEfilm(_efilmFullPath);
                 //Console.WriteLine("Render image----end");

                viewerWindow.ContentRendered -= viewerWindow_ContentRendered;
                //Console.ReadKey();
                viewerWindow.Close();//MedViewerWindow.Instance().Close();

                Logger.LogFuncDown();


                //Logger.LogFuncUp();

                //var window = sender as Window;
                //_efilmOriginalSopInstanceUID = null;

                //window.Close();
                lockEvent.Set();

                Logger.LogFuncDown();
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
            finally
            {
                lockEvent.Set();
            }
        }