public void setGalleryId(int Id) { patientId = Id; if (galleryController == null) { galleryController = new GalleryController(); } galleryController.CreateAndOpenGalley(Id); LoadGalleryImageList(); }
public void LoadGalleryImageList() { if (galleryController == null) { galleryController = new GalleryController(); galleryController.CreateAndOpenGalley(patientId); } this.Dispatcher.Invoke(() => { listBox.Items.Clear(); galleryController.GetGalleryFilesList(patientId).ForEach((string path) => { byte[] array = File.ReadAllBytes(path); Image image = new Image(); image.Source = galleryController.ConvertToImage(array); ListBoxItem lbi = new ListBoxItem(); lbi.Width = 80; lbi.Height = 80; lbi.Content = image; listBox.Items.Add(lbi); }); }); }
private void SaveToGallery() { galleryController.CreateAndOpenGalley(PatientId); galleryController.AppendImageToGallery(byJpegPicBuffer, dwSizeReturned); galleryControl.LoadGalleryImageList(); }
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; }); }; }