private void ListBoxItem_TouchDown(object sender, TouchEventArgs e)
        {
            ListBoxItem item = sender as ListBoxItem;

            if (item.IsSelected)
            {
                if (OAMScanInformationClosingPopup.IsOpen)
                {
                    closeScanInformation();
                }
                else
                {
                    ViewModelImagingSuperSession ss = item.DataContext as ViewModelImagingSuperSession;

                    if (ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Visualization)
                    {
                        return;
                    }

                    ViewModelImagingSessionBase dc = ss.ImagingSessions[0];

                    openScanInformation(sender, dc);

                    oamScanInformation.CaptureMouse();
                    oamScanInformation.ReleaseMouseCapture();
                }
                e.Handled = true;
            }
        }
示例#2
0
        private void ExportTestImages_Click(object sender, RoutedEventArgs e)
        {
            ViewModelImagingSuperSession ss = this.DataContext as ViewModelImagingSuperSession;

            if (ss == null)
            {
                return;
            }

            try
            {
                foreach (ViewModelImagingSessionBase dc in ss.ImagingSessions)
                {
                    if ((ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Snapshot) || ((ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Visualization) && dc.IsVisible))
                    {
                        dc.IsExportTestImages = true;
                        exportImagesAsync(dc);
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Window parentWindow = Window.GetWindow(this);
                ss.MSOTService.NotifyUserOnAction("Error trying to open MSP visualization selector: " + ex.Message, parentWindow.Title, UserNotificationType.Error, false);
            }
        }
        private void previewImage_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                if (_blockDoDragDrop)
                {
                    return;
                }

                ListBoxItem item = sender as ListBoxItem;

                if (e.LeftButton == MouseButtonState.Pressed && item.IsSelected && IsDragDropEnabled)
                {
                    if (OAMScanInformationClosingPopup.IsOpen == true)
                    {
                        closeScanInformation();
                        e.Handled = true;
                        return;
                    }

                    ViewModelImagingSuperSession ss = item.DataContext as ViewModelImagingSuperSession;

                    if (ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Visualization)
                    {
                        return;
                    }

                    DataObject data = new DataObject();
                    data.SetData("snapshotDragItem", ss);
                    DragDrop.DoDragDrop(item, data, DragDropEffects.Move);
                }
            }
            catch { }
        }
        private void previewImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (!_openPopupOnMouseUp)
            {
                return;
            }

            ListBoxItem item = sender as ListBoxItem;
            ViewModelImagingSuperSession ss = item.DataContext as ViewModelImagingSuperSession;

            if (ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Visualization)
            {
                return;
            }

            ViewModelImagingSessionBase dc = ss.ImagingSessions[0];

            openScanInformation(sender, dc);

            Task.Run(() =>
            {
                Task.Delay(System.Windows.Forms.SystemInformation.DoubleClickTime).Wait();
                Dispatcher.Invoke(new Action(() =>
                {
                    if (OAMScanInformationClosingPopup.IsOpen)
                    {
                        oamScanInformation.CaptureMouse();
                        oamScanInformation.ReleaseMouseCapture();
                    }
                }));
            });

            _openPopupOnMouseUp = false;
        }
 private void EmptySuperSessionOrReplaceSession_Drop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent("snapshotDragItem"))
     {
         Border item = sender as Border;
         ViewModelImagingSessionBase  substituteImagingSession = item.DataContext as ViewModelImagingSessionBase;
         ViewModelImagingSuperSession ss        = substituteImagingSession.Parent as ViewModelImagingSuperSession;
         ViewModelImagingSuperSession genericVM = (ViewModelImagingSuperSession)e.Data.GetData("snapshotDragItem");
         if (ss.VisualizationAndAnalysisType == Xvue.MSOT.DataModels.Plugins.ProjectManager.VisualizationAndAnalysis.Visualization)
         {
             ss.MSOTService.UIStaticDispatcher.BeginInvoke(new Action(() =>
             {
                 ss.ReplaceNewImagingSessionCopyThread(substituteImagingSession, genericVM.ImagingSessions[0], true);
             }));
         }
         else
         {
             if (ss.VerifySavingOfDataModelChanges(true))
             {
                 ss.MSOTService.UIStaticDispatcher.BeginInvoke(new Action(() =>
                 {
                     ViewModelStudyNode study = ss.Parent as ViewModelStudyNode;
                     if (study != null)
                     {
                         study.SelectedSuperSession = genericVM;
                         study.LoadSelectedSuperSession();
                     }
                 }));
             }
         }
         item.SetCurrentValue(BorderBrushProperty, new SolidColorBrush(Colors.White));
         e.Handled = true;
     }
 }
示例#6
0
        void loadSuperSession()
        {
            ViewModelProjectManager dc = DataContext as ViewModelProjectManager;

            if (dc == null || dc.ActiveStudy == null || superSessionStrip.SelectedSuperSession == null)
            {
                return;
            }

            if (!dc.ActiveStudy.IsSelectedSuperSessionOpened())
            {
                Dispatcher.BeginInvoke(new Action(() => {
                    try
                    {
                        ViewModelImagingSuperSession selected = superSessionStrip.SelectedSuperSession as ViewModelImagingSuperSession;
                        if ((dc.ActiveStudy.OpenedSelectedSuperSession as ViewModelImagingSuperSession)?.VerifySavingOfDataModelChanges(true) ?? true)
                        {
                            dc.ActiveStudy.SelectedSuperSession = selected;
                            dc.ActiveStudy.LoadSelectedSuperSession();
                        }
                    }
                    catch (Exception ex)
                    {
                        ViewMSOTcSystem.LogMessage(Xvue.MSOT.Services.Log.EnumLogType.Warning, "Selected SuperSession load", ex.Message);
                    }
                }));
            }
            else if (dc.ActiveStudy.SelectedSuperSession == null)
            {
                Window parentWindow = Window.GetWindow(this);
                dc.MSOTService.NotifyUserOnAction("Select a visualization to load", parentWindow.Title, UserNotificationType.Warning, false);
            }
        }
        private void refreshGrid()
        {
            if (DataContext == null)
            {
                return;
            }
            ViewModelImagingSuperSession model = DataContext as ViewModelImagingSuperSession;

            try
            {
                double containerHeight = imagingSessionsGrid.ActualHeight;
                double containerWidth  = imagingSessionsGrid.ActualWidth - 10;
                int    itemsCount      = imagingSessionsItemsControl.Items.Count;

                int    rows       = 1;
                int    columns    = 1;
                double cellHeight = containerHeight;
                double cellWidth  = containerWidth;

                if (model.ViewingLayout == Xvue.MSOT.DataModels.Plugins.ProjectManager.SuperSessionViewingLayout.Layout1)
                {
                    rows = itemsCount;
                }
                if (model.ViewingLayout == Xvue.MSOT.DataModels.Plugins.ProjectManager.SuperSessionViewingLayout.Layout2)
                {
                    columns   = 2;
                    rows      = (int)Math.Ceiling((double)itemsCount / 2);
                    cellWidth = (containerWidth - 20) / 2;
                }
                if (model.ViewingLayout == Xvue.MSOT.DataModels.Plugins.ProjectManager.SuperSessionViewingLayout.Layout4)
                {
                    columns   = 2;
                    rows      = (int)Math.Ceiling((double)itemsCount / 2);
                    cellWidth = (containerWidth - 20) / 2;
                    if (itemsCount > 2)
                    {
                        cellHeight = containerHeight / 2;
                    }
                }
                if (model.ViewingLayout == Xvue.MSOT.DataModels.Plugins.ProjectManager.SuperSessionViewingLayout.Layout6)
                {
                    columns   = 3;
                    rows      = (int)Math.Ceiling((double)itemsCount / 3);
                    cellWidth = (containerWidth - 20) / 3;
                    if (itemsCount > 3)
                    {
                        cellHeight = containerHeight / 2;
                    }
                }

                SetCurrentValue(WrapGridDimensionsProperty, new WrapGridDimensions(rows, columns, cellHeight, cellWidth));
            }
            catch { }
        }
示例#8
0
        private void createReportMenuItem_Click(object sender, RoutedEventArgs e)
        {
            ViewModelImagingSuperSession session = DataContext as ViewModelImagingSuperSession;

            session.CommandGenerateReport.Execute(null);
            ModalChildWindow.ShowDialog("Creating report ...", new ViewReportGenerationProgressDialog(), DataContext);
            if (session.ReportDocument != null)
            {
                double parentWindowHeight = Window.GetWindow(this).ActualHeight;
                ModalChildWindow.ShowDialog("Report preview", new ViewXpsReport(), DataContext, new Size(parentWindowHeight * 0.9 * 0.70, parentWindowHeight * 0.9));
            }
        }
示例#9
0
        private void saveAsMenuItem_Click(object sender, RoutedEventArgs e)
        {
            ViewModelImagingSuperSession session = DataContext as ViewModelImagingSuperSession;

            DateTime currentDateTime = DateTime.Now;
            string   suggestedName   = "Comparison_" + currentDateTime.ToShortDateString() + "_" + currentDateTime.ToShortTimeString();

            ModalChildWindow.ShowDialog(
                "Save comparison as",
                new ViewSaveAs("Comparison name", session.CommandSaveAsOpenedChanges, suggestedName),
                DataContext);
        }
示例#10
0
        private void ExportImages_Click(object sender, RoutedEventArgs e)
        {
            ViewModelImagingSuperSession ss = this.DataContext as ViewModelImagingSuperSession;

            if (ss == null)
            {
                return;
            }

            try
            {
                foreach (ViewModelImagingSessionBase dc in ss.ImagingSessions)
                {
                    if ((ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Snapshot) || ((ss.VisualizationAndAnalysisType == VisualizationAndAnalysis.Visualization) && dc.IsVisible))
                    {
                        //if (!dc.Is3DImagingSession)
                        //{
                        //    dc.PrepareExportedSelectedImage();

                        //    ModalChildWindow exportImagesPopupChildWindow;
                        //    ViewMspExportImages exportImagesPopup = new ViewMspExportImages();
                        //    exportImagesPopupChildWindow = new ModalChildWindow("Export Image(s)", exportImagesPopup, dc);
                        //    var exportImagesPopupChildWindowControlStyle = Application.Current.FindResource("ChildWindowWiderCaptionStyle");
                        //    exportImagesPopupChildWindow.CloseButtonVisibility = System.Windows.Visibility.Collapsed;
                        //    exportImagesPopupChildWindow.Style = (Style)exportImagesPopupChildWindowControlStyle;
                        //    Binding replyBinding = new Binding("UserReply");
                        //    replyBinding.Source = exportImagesPopupChildWindow;
                        //    replyBinding.Mode = BindingMode.TwoWay;
                        //    exportImagesPopup.SetBinding(ViewMspExportImages.UserReplyProperty, replyBinding);
                        //    bool retValue = exportImagesPopupChildWindow.GetReply();

                        //    if (retValue)
                        //    {
                        //        dc.ExportVisibleStacks();
                        //    }
                        //}

                        dc.IsExportTestImages = false;

                        exportImagesAsync(dc);

                        //}
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                Window parentWindow = Window.GetWindow(this);
                ss.MSOTService.NotifyUserOnAction("Error trying to open MSP visualization selector: " + ex.Message, parentWindow.Title, UserNotificationType.Error, false);
            }
        }
        private void AddNewSession_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("snapshotDragItem"))
            {
                ViewModelImagingSuperSession genericVM = (ViewModelImagingSuperSession)e.Data.GetData("snapshotDragItem");

                ScrollViewer item = sender as ScrollViewer;
                ViewModelImagingSuperSession ss = item.DataContext as ViewModelImagingSuperSession;
                ss.MSOTService.UIStaticDispatcher.BeginInvoke(new Action(() =>
                {
                    ss.AddNewImagingSessionCopy(genericVM.ImagingSessions[0], true);
                }));
                e.Handled = true;
            }
        }
        private void AddReplaceSession_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("snapshotDragItem"))
            {
                ViewImagingSessionGeneric    item = sender as ViewImagingSessionGeneric;
                ViewModelImagingSessionBase  substituteImagingSession = item.DataContext as ViewModelImagingSessionBase;
                ViewModelImagingSuperSession ss = substituteImagingSession.Parent as ViewModelImagingSuperSession;

                ViewModelImagingSuperSession genericVM = (ViewModelImagingSuperSession)e.Data.GetData("snapshotDragItem");

                ss.MSOTService.UIStaticDispatcher.BeginInvoke(new Action(() =>
                {
                    ss.ReplaceNewImagingSessionCopyThread(substituteImagingSession, genericVM.ImagingSessions[0], true);
                }));

                item.SessionBorder.SetCurrentValue(BorderBrushProperty, new SolidColorBrush(Colors.White));
                e.Handled = true;
            }
        }
示例#13
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            ViewModelImagingSuperSession session = this.DataContext as ViewModelImagingSuperSession;

            if (session == null)
            {
                return;
            }

            try
            {
                if (session.LinkedSuperSession != null)
                {
                    session.CommandSaveOpenedChanges.Execute(null);
                }
            }
            catch (Exception ex)
            {
                session.MSOTService.NotifyUserOnAction("Error saving visualization." + ex.Message, "Error", UserNotificationType.Error, false);
            }
        }
示例#14
0
        private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (this.DataContext == null)
            {
                return;
            }

            if ((bool)e.NewValue)
            {
                if (SelectedSuperSession == null)
                {
                    return;
                }

                ViewModelImagingSuperSession selectedSession = SelectedSuperSession as ViewModelImagingSuperSession;

                if (!IsAnalysis)
                {
                    if (selectedSession.VisualizationAndAnalysisType != VisualizationAndAnalysis.Snapshot ||
                        !selectedSession.WasCreatedAfterLastStudyLoad)
                    {
                        SelectedSuperSession = null;
                    }

                    if (SelectedSuperSession == null && snapshotsListBox.HasItems)
                    {
                        foreach (ViewModelImagingSuperSession session in snapshotsListBox.Items)
                        {
                            if (session.VisualizationAndAnalysisType == VisualizationAndAnalysis.Snapshot &&
                                session.WasCreatedAfterLastStudyLoad)
                            {
                                snapshotsListBox.SetCurrentValue(ListBox.SelectedItemProperty, session);
                                break;
                            }
                        }
                    }
                }
            }
        }
        private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            _model = e.NewValue as ViewModelImagingSuperSession;

            Visibility = _model == null ? Visibility.Collapsed : Visibility.Visible;
        }