private void TargetPanel_Drop(object sender, DragEventArgs e) { var dataObj = e.Data as DataObject; ImageEntity dragged = dataObj.GetData(typeof(ImageEntity)) as ImageEntity; CameraContainer selectedCam = cams.Where(c => c.Name == dragged.CameraName).SingleOrDefault(); selectedCam.bActive = true; LayoutPanel droppedOn = e.Source as LayoutPanel; panels.Clear(); FindPanels(((LayoutGroup)Groups) as DependencyObject); for (int y = 0; y < panels.Count; y++) { if (panels[y].Caption == droppedOn.Caption) { addViews(panels[y], selectedCam); //panels[y + 1].Visibility = Visibility.Visible; //panels[y + 1].Content = selectedCam.hist; //panels[y + 1].Name = "hist" + selectedCam.Name; } } // droppedOn.Content = selectedCam.preview; SetTrayImageToinUse(dragged); }
private void addViews(LayoutPanel pan1, CameraContainer activecam) { DockLayoutManager doc = new DockLayoutManager(); pan1.Content = doc; LayoutGroup gr2 = new LayoutGroup() { Orientation = Orientation.Horizontal }; doc.LayoutRoot = gr2; LayoutPanel settings = new LayoutPanel(); settings.Content = activecam.settings; gr2.Add(settings); LayoutPanel prev = new LayoutPanel(); prev.Content = activecam.preview; gr2.Add(prev); LayoutPanel hist = new LayoutPanel(); hist.Content = activecam.hist; gr2.Add(hist); pan1.Caption = activecam.Name; //panel contains preview }
void SetTrayImageToinUse(ImageEntity item) { CameraContainer selected = cams.Where(c => c.Name == item.CameraName).SingleOrDefault(); selected.bActive = true; //show the tray image as camera in preview mode selected.trayImage.ImagePath = File.ReadAllBytes("preview.png"); }
private bool SetupAttachedCams(ObservableCollection <ImageEntity> ListImageObj) { for (int i = 0; i < nAttachedCams; i++) { CameraContainer cam = new CameraContainer(i, ListImageObj[i], LsImageGallery); cams.Add(cam); } return(true); }
// find the first free panel and assign to the camera private void Addframe(CameraContainer cam, List <LayoutPanel> panels) { List <LayoutPanel> freepanels = panels.Where(p => p.Content == null).ToList(); if (freepanels.Count == 0) { return; } //Preview cam = new Preview(); //camlist.Add(cam); cam.bActive = true; freepanels[0].Content = cam.preview; freepanels[0].Caption = cam.Name; freepanels[1].Content = cam.hist; freepanels[1].Name = "hist" + cam.Name; }
//reset the previewed camera to not active and close the associated histogram window void SetTrayImageToNotinPreview(LayoutPanel item) { CameraContainer selected = cams.Where(c => c.Name == item.Caption).SingleOrDefault(); if (selected == null) { return; } selected.bActive = false; panels.Clear(); FindPanels(((LayoutGroup)Groups) as DependencyObject); //close the associated Histogram as we close the preview string associatedHist = "hist" + selected.Name; for (int y = 0; y < panels.Count; y++) { if (panels[y].Name == associatedHist) { docMan.DockController.RemovePanel(panels[y]); } } }