コード例 #1
0
        public string ComposeMissingImage(object DTO)
        {
            string missingImageHtml = "";

            if (DTO as PlantInventoryDTO != null)
            {
                PlantInventoryDTO piDTO = DTO as PlantInventoryDTO;

                missingImageHtml = "<h1> Plant  Missing Image </h1>" +
                                   "<div> This plant record is missing an image - use the EO Mobile App or EO Admin app to add an appropriate image </div>" +
                                   "<br/>" +
                                   "<div> Plant Information </div>" +
                                   "<div> Plant ID: " + piDTO.Plant.PlantId.ToString() + "</div>" +
                                   "<div> Plant Name: " + piDTO.Plant.PlantName + "</div>" +
                                   "<div> Type Name: " + piDTO.Plant.PlantTypeName + "</div>" +
                                   "<div> Size: " + piDTO.Plant.PlantSize + "</div>";
            }
            else if (DTO as ContainerInventoryDTO != null)
            {
                ContainerInventoryDTO ciDTO = DTO as ContainerInventoryDTO;

                missingImageHtml = "<h1> Container Missing Image </h1>" +
                                   "<div> This container record is missing an image - use the EO Mobile App or EO Admin app to add an appropriate image </div>" +
                                   "<br/>" +
                                   "<div> Container Information </div>" +
                                   "<div> Container ID: " + ciDTO.Container.ContainerId.ToString() + "</div>" +
                                   "<div> Plant Name: " + ciDTO.Container.ContainerName + "</div>" +
                                   "<div> Type Name: " + ciDTO.Container.ContainerTypeName + "</div>" +
                                   "<div> Size: " + ciDTO.Container.ContainerSize + "</div>";
            }
            else if (DTO as MaterialInventoryDTO != null)
            {
                MaterialInventoryDTO miDTO = DTO as MaterialInventoryDTO;

                missingImageHtml = "<h1> Material Missing Image </h1>" +
                                   "<div> This material record is missing an image - use the EO Mobile App or EO Admin app to add an appropriate image </div>" +
                                   "<br/>" +
                                   "<div> Material Information </div>" +
                                   "<div> Material ID: " + miDTO.Material.MaterialId.ToString() + "</div>" +
                                   "<div> Material Name: " + miDTO.Material.MaterialName + "</div>" +
                                   "<div> Type Name: " + miDTO.Material.MaterialTypeName + "</div>" +
                                   "<div> Size: " + miDTO.Material.MaterialSize + "</div>";
            }

            else if (DTO as FoliageInventoryDTO != null)
            {
                FoliageInventoryDTO fiDTO = DTO as FoliageInventoryDTO;

                missingImageHtml = "<h1> Foliage Missing Image </h1>" +
                                   "<div> This foliage record is missing an image - use the EO Mobile App or EO Admin app to add an appropriate image </div>" +
                                   "<br/>" +
                                   "<div> Foliage Information </div>" +
                                   "<div> Foliage ID: " + fiDTO.Foliage.FoliageId.ToString() + "</div>" +
                                   "<div> Foliage Name: " + fiDTO.Foliage.FoliageName + "</div>" +
                                   "<div> Type Name: " + fiDTO.Foliage.FoliageTypeName + "</div>" +
                                   "<div> Size: " + fiDTO.Foliage.FoliageSize + "</div>";
            }

            return(missingImageHtml);
        }
コード例 #2
0
        private void ShowImage(object sender, RoutedEventArgs e)
        {
            Button b = sender as Button;
            ContainerInventoryDTO containerInventoryDTO = b.CommandParameter as ContainerInventoryDTO;

            GetByteArrayResponse imageResponse = wnd.GetImage(containerInventoryDTO.ImageId);
            ImageWindow          imageWindow   = new ImageWindow();

            imageWindow.Top  = Application.Current.MainWindow.Top + 200;
            imageWindow.Left = Application.Current.MainWindow.Left + 200;

            if (imageResponse.ImageData != null && imageResponse.ImageData.Length > 0)
            {
                BitmapImage image = new BitmapImage();
                using (var mem = new System.IO.MemoryStream(imageResponse.ImageData))
                {
                    mem.Position = 0;
                    image.BeginInit();
                    image.CreateOptions = BitmapCreateOptions.PreservePixelFormat;
                    image.CacheOption   = BitmapCacheOption.OnLoad;
                    image.StreamSource  = mem;
                    image.EndInit();
                }
                image.Freeze();

                imageWindow.ImageBox.Source = image;
            }

            imageWindow.Owner = Application.Current.MainWindow;
            imageWindow.ShowDialog();
        }
コード例 #3
0
        private void ViewImage_Clicked(object sender, EventArgs e)
        {
            IReadOnlyList <Rg.Plugins.Popup.Pages.PopupPage> popupStack = Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopupStack;

            //One at a time, please
            if (popupStack != null && popupStack.Count > 0)
            {
                return;
            }

            Button b = sender as Button;

            b.IsEnabled = false;

            try
            {
                ContainerInventoryDTO container = (ContainerInventoryDTO)((Button)sender).BindingContext;

                if (container != null)
                {
                    long containerImageId = ((App)App.Current).MissingImageId;
                    if (container.ImageId != 0)
                    {
                        containerImageId = container.ImageId;
                    }

                    EOImgData img = ((App)App.Current).GetImage(containerImageId);

                    if (containerImageId == ((App)App.Current).MissingImageId)
                    {
                        MessagingCenter.Send <ContainerInventoryDTO>(container, "ContainerMissingImage");
                    }

                    ((App)App.Current).GetServiceCodeById(container.Inventory.ServiceCodeId).ContinueWith(a => ShowImage(img, a.Result));
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                b.IsEnabled = true;
            }
        }