Пример #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();
            }
        }
Пример #3
0
        private void SaveEFilm(Size renderSize, double dpi)
        {
            try
            {
                Logger.LogFuncUp();

                ElectronicFilmInfo electronicFilmInfo = new ElectronicFilmInfo((int)_row, (int)_column, filmImageList);

                MedViewerWindow viewerWindow = new MedViewerWindow(_proxy);
                viewerWindow.SetRenderSize(renderSize);

                viewerWindow.FilmInfo         = electronicFilmInfo;
                viewerWindow.ContentRendered += new EventHandler(viewerWindow_ContentRendered);
                //viewerWindow.ImageLoadedInViewerControl += viewerWindow_ImageLoaded;

                //Console.WriteLine("show image----begin");
                viewerWindow.ShowAllImages();

                viewerWindow.ShowDialog();
                //Console.WriteLine("show image----end");

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

            ////for test
            //Logger.LogFuncUp();

            //var window = new Window();
            ////window.ContentRendered += new EventHandler(viewerWindow_ContentRendered);
            //window.ShowDialog();

            //Logger.LogFuncDown();
        }