コード例 #1
0
ファイル: PictureListViewModel.cs プロジェクト: Verkop/SWE2
 public PictureListViewModel(IEnumerable <IPictureModel> p)
 {
     _List = new ObservableCollection <IPictureViewModel>();
     foreach (PictureModel pic in p)
     {
         PictureViewModel v = new PictureViewModel(pic);
         _List.Add(v);
     }
 }
コード例 #2
0
        private IEnumerable <IPictureViewModel> LoadPictureList()
        {
            BusinessLayer bl = new BusinessLayer();

            bl.Sync();
            var models = bl.GetPictures();

            List <PictureViewModel> pictureObjects = new List <PictureViewModel>();

            foreach (PictureModel model in models)
            {
                var pictureViewModelImpl = new PictureViewModel(model);
                pictureObjects.Add(pictureViewModelImpl);
            }

            return(pictureObjects);
        }
コード例 #3
0
ファイル: Report.cs プロジェクト: pgraser/PicDB
        public void PdfReport(PictureViewModel pvm)
        {
            // Create a new PDF document
            PdfDocument document = new PdfDocument();

            document.Info.Title = pvm.FileName;

            // Create an empty page
            PdfPage page = document.AddPage();

            // Get an XGraphics object for drawing
            XGraphics gfx = XGraphics.FromPdfPage(page);

            // Create a font
            XFont font = new XFont("Verdana", 10);

            // Create Image
            var image = XImage.FromFile(pvm.FilePath);

            // Draw the text
            gfx.DrawString("Filename: " + pvm.FileName, font, XBrushes.Black,
                           new XRect(10, 0, page.Width, 10),
                           XStringFormats.TopLeft);
            gfx.DrawString("Photographer: ", font, XBrushes.Black,
                           new XRect(10, 20, page.Width, 20),
                           XStringFormats.TopLeft);
            gfx.DrawString("Name: " + pvm.Photographer.FirstName + " " + pvm.Photographer.LastName, font, XBrushes.Black,
                           new XRect(10, 30, page.Width, 30),
                           XStringFormats.TopLeft);
            gfx.DrawString("Birthday: " + pvm.Photographer.BirthDay, font, XBrushes.Black,
                           new XRect(10, 40, page.Width, 40),
                           XStringFormats.TopLeft);
            gfx.DrawString("Notes: " + pvm.Photographer.Notes, font, XBrushes.Black,
                           new XRect(10, 50, page.Width, 50),
                           XStringFormats.TopLeft);

            gfx.DrawImage(image, 100, 100, page.Width - 200, 200);

            gfx.DrawString("IPTC: ", font, XBrushes.Black,
                           new XRect(10, 410, page.Width, 420),
                           XStringFormats.TopLeft);
            gfx.DrawString("ByLine: " + pvm.IPTC.ByLine + " " + pvm.Photographer.LastName, font, XBrushes.Black,
                           new XRect(10, 420, page.Width, 430),
                           XStringFormats.TopLeft);
            gfx.DrawString("Caption: " + pvm.IPTC.Caption + " " + pvm.Photographer.LastName, font, XBrushes.Black,
                           new XRect(10, 430, page.Width, 440),
                           XStringFormats.TopLeft);
            gfx.DrawString("Headline: " + pvm.IPTC.Headline, font, XBrushes.Black,
                           new XRect(10, 440, page.Width, 250),
                           XStringFormats.TopLeft);
            gfx.DrawString("CopyrightNotice: " + pvm.IPTC.CopyrightNotice, font, XBrushes.Black,
                           new XRect(10, 450, page.Width, 260),
                           XStringFormats.TopLeft);
            gfx.DrawString("Keywords: " + pvm.IPTC.Keywords, font, XBrushes.Black,
                           new XRect(10, 460, page.Width, 270),
                           XStringFormats.TopLeft);

            gfx.DrawString("EXIF: ", font, XBrushes.Black,
                           new XRect(10, 490, page.Width, 420),
                           XStringFormats.TopLeft);
            gfx.DrawString("ExposureProgram: " + pvm.EXIF.ExposureProgram, font, XBrushes.Black,
                           new XRect(10, 500, page.Width, 430),
                           XStringFormats.TopLeft);
            gfx.DrawString("ExposureProgramResource: " + pvm.EXIF.ExposureProgramResource + " " + pvm.Photographer.LastName, font, XBrushes.Black,
                           new XRect(10, 510, page.Width, 440),
                           XStringFormats.TopLeft);
            gfx.DrawString("ExposureTime: " + pvm.EXIF.ExposureTime, font, XBrushes.Black,
                           new XRect(10, 520, page.Width, 250),
                           XStringFormats.TopLeft);
            gfx.DrawString("Flash: " + pvm.EXIF.Flash, font, XBrushes.Black,
                           new XRect(10, 530, page.Width, 260),
                           XStringFormats.TopLeft);
            gfx.DrawString("FNumber: " + pvm.EXIF.FNumber, font, XBrushes.Black,
                           new XRect(10, 540, page.Width, 270),
                           XStringFormats.TopLeft);
            gfx.DrawString("ISORating: " + pvm.EXIF.ISORating, font, XBrushes.Black,
                           new XRect(10, 550, page.Width, 270),
                           XStringFormats.TopLeft);
            gfx.DrawString("ISOValue: " + pvm.EXIF.ISOValue, font, XBrushes.Black,
                           new XRect(10, 560, page.Width, 270),
                           XStringFormats.TopLeft);
            gfx.DrawString("Make: " + pvm.EXIF.Make, font, XBrushes.Black,
                           new XRect(10, 570, page.Width, 270),
                           XStringFormats.TopLeft);

            document.Save(GlobalInformation.Path + "\\Reports\\report" + pvm.ID + ".pdf");
        }
コード例 #4
0
 public EXIFViewModel(IEXIFModel em, PictureViewModel pvm)
 {
     _EXIFModel           = em;
     _PictureViewModel    = pvm;
     pvm.PropertyChanged += SubPropertyChanged;
 }
コード例 #5
0
        /// <summary>
        /// save picture changes to database
        /// </summary>
        /// <param name="currentPicture"></param>
        internal void CurrentPictureChanged(IPictureViewModel currentPicture)
        {
            PictureViewModel pvm = (PictureViewModel)currentPicture;

            Save(pvm.PictureModel);
        }