示例#1
0
        public void ShowAboutDialog()
        {
            UIServices.SetBusyState();

            var aboutView      = new AboutView();
            var aboutViewModel = new AboutViewModel();

            dialogService.ShowDialogWindow("About SigmaNEST ROI Calculator", null, null, aboutView, aboutViewModel, false);
        }
示例#2
0
        public void ShowReportsDialog(string defaultDataDirectory, ObservableCollection <ROIDocumentViewModel> selectedViewModelsList)
        {
            UIServices.SetBusyState();

            var printReportWindow     = new PrintReportView();
            var printReportsViewModel = new PrintReportsViewModel {
                DataDirectory = defaultDataDirectory, SelectedROIViewModelList = selectedViewModelsList
            };
            var closeCommand = new ButtonServiceCommand("Close", printReportsViewModel.SaveSelectedReportTemplatesCommand, false, true, true);

            dialogService.ShowDialogWindow("Reporting", new[] { closeCommand }, null, printReportWindow, printReportsViewModel, false);
        }
示例#3
0
        public void ShowImageBrowserWindow(string imageDirectory)
        {
            UIServices.SetBusyState();

            var imageBrowserWindow    = new ImageBrowserView();
            var imageBrowserViewModel = new ImageBrowserViewModel {
                ImageDirectory = imageDirectory
            };

            imageBrowserViewModel.LoadExistingImages();

            var okCommand     = new ButtonServiceCommand("OK", imageBrowserViewModel.OkCommand, false, true, true);
            var cancelCommand = new ButtonServiceCommand("Cancel", null, true, false, true);

            dialogService.ShowDialogWindow("Image Browser", new[] { okCommand, cancelCommand }, null, imageBrowserWindow, imageBrowserViewModel, false);
        }
示例#4
0
        public bool ShowMachineSetupWindow(Machine machine, ObservableCollection <Material> materialList)
        {
            UIServices.SetBusyState();

            var machineSetupWindow    = new MachineSetupView();
            var machineSetupViewModel = new MachineSetupViewModel(materialList)
            {
                Machine = machine
            };

            var okCommand     = new ButtonServiceCommand("OK", machineSetupViewModel.OKCommand, false, true, true);
            var cancelCommand = new ButtonServiceCommand("Cancel", null, true, false, true);
            var windowTitle   = $"Edit {machine.Name}";

            return(okCommand == dialogService.ShowDialogWindow($"{windowTitle}", new[] { okCommand, cancelCommand },
                                                               null, machineSetupWindow, machineSetupViewModel, false));
        }
示例#5
0
        private static XtraReport CreateXtraReportFromRepxWithDataSource(string reportRepxFilePath, object dataSource)
        {
            UIServices.SetBusyState();

            var report = XtraReport.FromFile(reportRepxFilePath, true);

            if (dataSource != null)
            {
                var objectDataSource = new ObjectDataSource
                {
                    Constructor = new ObjectConstructorInfo(),
                    DataSource  = (dataSource)
                };
                report.DataSource = objectDataSource;
            }

            report.CreateDocument();
            return(report);
        }
示例#6
0
        public bool ShowOpenROIDocumentDialog(string defaultDataDirectory, List <string> companiesList, string documentPath = "")
        {
            UIServices.SetBusyState();

            var editROIDocView       = new EditROIDocumentView();
            var roiDocumentViewModel = new ROIDocumentViewModel {
                DocumentPath = documentPath, DataDirectory = defaultDataDirectory
            };

            //Pre-populate new report's default name
            if (string.IsNullOrEmpty(documentPath))
            {
                roiDocumentViewModel.IsNewReport = true;
                roiDocumentViewModel.ROIDocument.DocumentName = Path.GetFileNameWithoutExtension(
                    FileSystemTools.GetNextAvailableFilename(Path.Combine(defaultDataDirectory, "ROIDocument.xml")));

                //Todo: Recall modal last new report defaults (culture, etc.)
            }

            roiDocumentViewModel.CompaniesList = companiesList;
            roiDocumentViewModel.LoadExistingImages();

            var editReportCommand = new ButtonServiceCommand("Reporting", roiDocumentViewModel.EditReportCommand, false, false, false);
            var okCommand         = new ButtonServiceCommand("OK", roiDocumentViewModel.SaveROIDocumentCommand, false, false, true);
            var cancelCommand     = new ButtonServiceCommand("Cancel", roiDocumentViewModel.CancelCommand, true, false, true);

            var result = dialogService.ShowDialogWindow($"Edit {roiDocumentViewModel.ROIDocument.DocumentName}", new[] { editReportCommand, okCommand, cancelCommand }, null, editROIDocView, roiDocumentViewModel, false);

            if (result == okCommand)
            {
                var gridSaveDirectory = Path.Combine(defaultDataDirectory, Constants.AppSettingsDirectoryName);
                if (!Directory.Exists(gridSaveDirectory))
                {
                    Directory.CreateDirectory(gridSaveDirectory);
                }
                editROIDocView.SaveDocumentGrids(gridSaveDirectory);
                return(true);
            }

            return(false);
        }