Пример #1
0
 private void onLoad(object sender, RoutedEventArgs e)
 {
     pedalController            = new PedalController();
     cbSaveOnFreeze.IsChecked   = pedalController.SaveOnFreeze;
     cbSaveOnSave.IsChecked     = pedalController.SaveOnSave;
     cbSetRightOnSave.IsChecked = pedalController.SetImageRightOnSave;
 }
Пример #2
0
        public void InitialVariables()
        {
            otherController = new OtherController();

            ovalPictureBox.BackgroundImageLayout = ImageLayout.Zoom;

            serialPortController           = new SerialPortController(true);
            serialPortController.PortOpen += () =>
            {
                // System.Windows.MessageBox.Show("port open");
                this.Dispatcher.Invoke(() =>
                {
                    imageSerialportStatus.Source = new BitmapImage(new Uri("/Resource/SerialPortSuccess.png", UriKind.Relative));
                });
            };
            serialPortController.PortClose += () =>
            {
                // System.Windows.MessageBox.Show("port closed");
                this.Dispatcher.Invoke(() =>
                {
                    imageSerialportStatus.Source = new BitmapImage(new Uri("/Resource/SerialPortFail.png", UriKind.Relative));
                });
            };
            serialPortController.NewDataReceived += (string data) =>
            {
                if (data.Substring(data.Length - 1, 1) == "\r")
                {
                    data = data.Substring(0, data.Length - 1);
                }
                //System.Windows.MessageBox.Show(data);
                switch (data)
                {
                case "LIVE":
                    new Task(() => LivePreView()).Start();
                    break;

                case "SAVE":
                    if (pedalController.SaveOnSave)
                    {
                        SaveToGallery();
                    }
                    if (pedalController.SetImageRightOnSave)
                    {
                        SetImageRight();
                    }
                    break;

                case "FREEZE":
                    CaptureJpeg();
                    StopLivePreView();
                    if (pedalController.SaveOnFreeze)
                    {
                        SaveToGallery();
                    }
                    break;
                }
            };

            dvrControl        = new DvrController();
            galleryController = new GalleryController();
            pedalController   = new PedalController();
            captureController = new CaptureController();

            patientDbContext = new PatientDbContext();

            dgTodayWorkBench.DataContext = patientDbContext.Patients.ToList();

            pateintTodayForm.nowRefresh      += LoadTodayPatientTable;
            pateintTodayForm.onSelectPatient += (int Id, string fullName) =>
            {
                mainTabControl.SelectedIndex = 1;
                PatientId = Id;
                galleryController.CreateAndOpenGalley(Id);
                galleryControl.setGalleryId(Id);
                patientWorkBenchName.Text = fullName;
                //picCapture.Source = null;


                partBottom.Visibility = Visibility.Collapsed;
            };


            galleryControl.onChangeSelectedItem += (BitmapImage bitmapImage) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    //ellipseGeometry.Center = new Point(bitmapImage.Width / 2, bitmapImage.Height / 2);

                    //int startX = (int)(bitmapImage.Width - bitmapImage.Height) / 2;

                    //int endX = (int)(bitmapImage.Width + startX);

                    ////CroppedBitmap croppedBitmap = new CroppedBitmap(bitmapImage, new Int32Rect(startX, 0, endX, (int)bitmapImage.Height));

                    //croppedBitmap.SourceRect = new Int32Rect(startX, 0, endX, (int)bitmapImage.Height);

                    picCapture.Source = bitmapImage;
                });
            };
        }