private void okButton_Click(object sender, RoutedEventArgs e)
        {
            ViewModelImagingSessionBase dc = this.DataContext as ViewModelImagingSessionBase;

            ModalChildWindow.ShowDialog("File Name", new ViewMspExportName(), dc);
            CloseControl = true;
        }
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            FrameworkElement menuItem = sender as FrameworkElement;

            if (menuItem.DataContext == null)
            {
                return;
            }

            IVisualization session = menuItem.DataContext as IVisualization;

            if (session == null)
            {
                return;
            }

            bool continueF = session.PrepareCreateComparisonFromSnapshot();

            if (continueF)
            {
                DateTime currentDateTime = DateTime.Now;
                string   suggestedName   = "Comparison_" + currentDateTime.ToShortDateString() + "_" + currentDateTime.ToShortTimeString();
                ModalChildWindow.ShowDialog(
                    "Save comparison as",
                    new ViewSaveAs("Comparison name", session.CommandNewComparisonSuperSession, suggestedName),
                    session);
            }
        }
Example #3
0
        internal static void ShowDialog(string caption, UserControl content, object dataContext, Size dialogSize)
        {
            ModalChildWindow newChildWindow = CreateModal(caption, content, dataContext);

            newChildWindow.Width  = dialogSize.Width;
            newChildWindow.Height = dialogSize.Height;
            newChildWindow.ShowDialog();
        }
Example #4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     ModalChildWindow.ShowDialog("Select preset", new ViewOAMPresetsPopup(), this.DataContext);
     if (ParentPopup != null)
     {
         ParentPopup.SetCurrentValue(ClosingPopup.IsOpenProperty, false);
     }
 }
Example #5
0
        static ModalChildWindow CreateModal(string caption, UserControl content, object dataContext)
        {
            ModalChildWindow newChildWindow        = new ModalChildWindow(caption, content, dataContext);
            var presetPopupChildWindowControlStyle = Application.Current.FindResource("ChildWindowWiderCaptionStyle");

            newChildWindow.CloseButtonVisibility = System.Windows.Visibility.Collapsed;
            newChildWindow.Style = (Style)presetPopupChildWindowControlStyle;
            return(newChildWindow);
        }
Example #6
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));
            }
        }
Example #7
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);
        }
Example #8
0
        private void acquisitionToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            bool continueF = false;

            try
            {
                continueF = verifySaveAnalysisSession(false);   // Don't close the session yet.
                if (continueF)
                {
                    bool?userReply = ModalChildWindow.ShowDialog("Select preset", new ViewOAMPresetsPopup(), DataContext, ViewOAMPresetsPopup.UserReplyProperty);
                    continueF = userReply == true ? true : false;
                }
                if (continueF)
                {
                    bool?userReply = ModalChildWindow.ShowDialog("LASER SAFETY WARNING", new ViewOAMSafetyGlassesDialog(), _system, ViewOAMSafetyGlassesDialog.SafetyOKProperty);
                    continueF = userReply == true ? true : false;
                }
                if (continueF)
                {
                    if (_system.MSOTHardware.HardwareSelfTest.TestRequired)
                    {
                        if (_system.MSOTHardware.HardwareSelfTest.AcceptInitialize())
                        {
                            ModalChildWindow.ShowDialog("Self-test", new ViewSelfTest(), _system.MSOTHardware.HardwareSelfTest);
                            continueF = !_system.MSOTHardware.HardwareSelfTest.UserAborted;
                        }
                        else
                        {
                            continueF = false;
                        }
                        if (!continueF)
                        {
                            _system.MSOTHardware.Laser.AcceptStopCharger();
                        }
                    }
                }
                if (continueF)
                {
                    _system.ProjectManager.CloseOpenedSelectedSuperSession();    // Close session here as it cannot be determined before, i.e. in the call to verifySaveAnalysisSession above.
                    initiateNewAcquisition();
                    UpdateTabButtons(acquisitionToggleButton);
                }
                else
                {
                    acquisitionToggleButton.IsChecked = false;
                }
            }
            catch
            {
                acquisitionToggleButton.IsChecked = false;
            }
        }
Example #9
0
        internal static bool?ShowDialog(string caption, UserControl content, object dataContext, DependencyProperty controlProperty)
        {
            ModalChildWindow newChildWindow = CreateModal(caption, content, dataContext);

            if (controlProperty != null)
            {
                Binding replyBinding = new Binding("UserReply");
                replyBinding.Source = newChildWindow;
                replyBinding.Mode   = BindingMode.TwoWay;
                content.SetBinding(controlProperty, replyBinding);
                return(newChildWindow.ShowDialog());
            }
            else
            {
                newChildWindow.ShowDialog();
                return(null);
            }
        }
Example #10
0
        static async void exportImagesAsync(ViewModelImagingSessionBase dc)
        {
            dc.MSOTService.SystemBusy(true);
            Task t = Task.Run(() =>
            {
                dc.MSOTService.UIStaticDispatcher.Invoke(new Action(() =>
                {
                    dc.PrepareExportedSelectedImage();
                    dc.PrepareSavingFormat();
                }));
            });
            await t;

            dc.MSOTService.SystemBusy(false);
            ModalChildWindow.ShowDialog(
                dc.IsExportTestImages ?
                (dc.Is3DImagingSession ?
                 "Export Test 3D Image(s)"
                                                : "Export Test Image(s)")
                                        : "Export images",
                new ViewMspExportAllImages(),
                dc);
        }
        private void menuItem_Click(object sender, RoutedEventArgs e)
        {
            ViewModelMspSelectionImagingSession dc = DataContext as ViewModelMspSelectionImagingSession;

            if (dc == null)
            {
                return;
            }

            try
            {
                dc.InitSelectionLoad();
                ModalChildWindow.ShowDialog(
                    "Select images",
                    new ViewMspVisualizationSelection(),
                    DataContext,
                    ViewMspVisualizationSelection.SelectionResultOKProperty);
            }
            catch (Exception ex)
            {
                Window parentWindow = Window.GetWindow(this);
                dc.MSOTService.NotifyUserOnAction("Error trying to open MSP visualization selector: " + ex.Message, parentWindow.Title, UserNotificationType.Error, false);
            }
        }
Example #12
0
        internal static void ShowDialog(string caption, UserControl content, object dataContext)
        {
            ModalChildWindow newChildWindow = CreateModal(caption, content, dataContext);

            newChildWindow.ShowDialog();
        }