示例#1
0
 private void DataGridPlantOrder_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (sender is DataGrid dataGrid)
     {
         if (dataGrid.SelectedItem is PlantOrderModel plantOrder)
         {
             SelectedPlantOrder         = plantOrder;
             _currentProjectPreviewType = ProjectPreviewType.PlantOrder;
             UpdateAppBarButtons();
             ButtonOpenProject.Label = BUTTON_LABEL_PLANT_ORDER;
         }
         else
         {
             SelectedPlantOrder = null;
         }
     }
 }
示例#2
0
        private void ProjectPreviewPivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (sender is Pivot pivot)
            {
                if (pivot.SelectedItem is PivotItem pivotItem)
                {
                    if (pivotItem.Tag is string tag)
                    {
                        if (tag == "po")
                        {
                            _currentProjectPreviewType = ProjectPreviewType.PlantOrder;
                            ButtonOpenProject.Label    = BUTTON_LABEL_PLANT_ORDER;
                        }
                        else if (tag == "pdf")
                        {
                            _currentProjectPreviewType = ProjectPreviewType.PdfFile;
                            ButtonOpenProject.Label    = BUTTON_LABEL_FILE_ENTRY;
                        }
                    }
                }

                UpdateAppBarButtons();
            }
        }
示例#3
0
        private async void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (sender is ListBox listBox)
            {
                if (listBox.SelectedItem is FileEntryModel fileEntry)
                {
                    var filePath = Path.Combine(fileEntry.RelativePath, fileEntry.Name + ".pdf");
                    var pdfFile  = await Proxy.GetPdfFile(filePath);

                    if (pdfFile?.Buffer?.Length > 0)
                    {
                        SelectedFileEntry          = fileEntry;
                        _currentProjectPreviewType = ProjectPreviewType.PdfFile;
                        ButtonOpenProject.Label    = BUTTON_LABEL_FILE_ENTRY;
                        UpdateAppBarButtons();
                        LoadPreviewPage(pdfFile.Buffer);
                    }
                }
                else
                {
                    SelectedFileEntry = null;
                }
            }
        }
示例#4
0
        private async void PdfViewerPreviewPage_ButtonOpenProjectClicked(ProjectPreviewPage projectPreviewPage, ProjectPreviewType projectPreviewType, FolderModel project)
        {
            var tabItem = FindTab(projectPreviewPage.Index);

            if (tabItem != null)
            {
                var name = GetProjectIdentifier(projectPreviewPage.SelectedPlantOrder, projectPreviewPage.SelectedFileEntry);
                if (name != null)
                {
                    UpdateTabViewItemHeader(tabItem, project, name);

                    var plantOrder = projectPreviewPage.SelectedPlantOrder;
                    var fileEntry  = projectPreviewPage.SelectedFileEntry;

                    if (fileEntry == null && plantOrder != null)
                    {
                        fileEntry = projectPreviewPage.FindFilename(plantOrder);
                    }

                    if (tabItem.Content is Frame frame && fileEntry != null)
                    {
                        ProjectViewSession session;
                        session = await ProjectViewSession.LoadAsync();

                        var summary = new ProjectSummary()
                        {
                            FileEntry          = fileEntry,
                            Folder             = project,
                            PlantOrder         = plantOrder,
                            ProjectPreviewType = projectPreviewType
                        };
                        if (session == null)
                        {
                            session = new ProjectViewSession();
                        }
                        await session.Add(summary);

                        frame.Navigate(typeof(ProjectContentPage), new object[] { projectPreviewType, project, fileEntry, plantOrder, false });
                    }
                    else
                    {
                        var dialog = new InfoDialog("Es wurde leider keine Datei gefunden", "Information", InfoDialogType.Error);
                        await dialog.ShowAsync();
                    }
                }
            }