Exemplo n.º 1
0
        public MainWindowViewModel()
        {
            _businessLayer = new BusinessLayer();

            pictureInfoViewModel = new PictureInfoViewModel();

            pictureViewModel = new PictureViewModel();

            pictureListViewModel = new PictureListViewModel();

            photographerListViewModel = new PhotographerListViewModel();


            pictureListViewModel.PropertyChanged += (s, e) => {
                switch (e.PropertyName)
                {
                case nameof(PictureListViewModel.SelectedImage):
                    pictureViewModel.Picture   = pictureListViewModel.SelectedImage;
                    pictureViewModel.TagString = pictureViewModel.MakeTagString();
                    pictureViewModel.SelectedPhotographerName = pictureViewModel.Picture.Photographer.FullName;
                    OnPropertyChanged(nameof(pictureViewModel));

                    pictureInfoViewModel.IPTCModel = pictureListViewModel.SelectedImage.IPTC;
                    pictureInfoViewModel.EXIFModel = pictureListViewModel.SelectedImage.EXIF;
                    OnPropertyChanged(nameof(pictureInfoViewModel));
                    break;
                }
            };
        }
Exemplo n.º 2
0
        public bool TagReport()
        {
            string FilePath = Path.GetFullPath("../../../PDF_Reports/");
            Dictionary <string, int> TagCount = new Dictionary <string, int>();
            BusinessLayer            _bl      = new BusinessLayer();

            TagCount = _bl.returnAllTagsWithCount();
            string INFO   = "";
            string helper = "";

            foreach (string key in TagCount.Keys)
            {
                //Console.WriteLine(key);
                int count = 0;
                TagCount.TryGetValue(key, out count);
                //Console.WriteLine(count);

                if (count > 1)
                {
                    helper = key + ": " + count + " Bilder\n";
                }
                if (count == 1)
                {
                    helper = key + ": " + count + " Bild\n";
                }

                INFO += helper;
            }


            using (PdfDocument document = new PdfDocument())
            {
                document.Info.Title = "Created with PDFsharp";
                PdfPage page = document.AddPage();

                XGraphics gfx = XGraphics.FromPdfPage(page);
                gfx.SmoothingMode = XSmoothingMode.HighQuality;
                XTextFormatter tf = new XTextFormatter(gfx);

                XFont font_header = new XFont("Verdana", 20, XFontStyle.Bold);
                XFont font_text   = new XFont("Verdana", 11, XFontStyle.Regular);
                XRect rect        = new XRect(gfx.PageOrigin, gfx.PageSize);

                string title = "Tagbericht";

                gfx.DrawRectangle(
                    new XLinearGradientBrush(
                        rect,
                        XColor.FromKnownColor(XKnownColor.White),
                        XColor.FromKnownColor(XKnownColor.White),
                        XLinearGradientMode.ForwardDiagonal),
                    rect);
                gfx.DrawString(title, font_header, XBrushes.Black, rect, XStringFormats.TopCenter);

                rect = new XRect(20, 70, page.Width, 400);
                gfx.DrawRectangle(XBrushes.White, rect);
                tf.Alignment = XParagraphAlignment.Left;
                tf.DrawString(INFO, font_text, XBrushes.Black, rect, XStringFormats.TopLeft);

                string filename     = "Tagbericht.pdf";
                string CompletePath = FilePath + filename;
                CompletePath = Path.GetFullPath(CompletePath);
                document.Save(CompletePath);
            }
            return(true);
        }