private bool SaveToPicture(PictureMetaData pic, bool commit)
        {
            // todo: die worker und modelle können mehrfach verwendet werden!
            IptcWorker    iptcWorker    = new IptcWorker();
            ExifGpsWorker exifGpsWorker = new ExifGpsWorker();

            IptcModel    iptcModel    = iptcView.GetModel();
            ExifGpsModel exifGpsModel = exifGpsView.GetModel();

            bool somethingChanged = false;

            if (iptcWorker.ProcessFile(pic, iptcModel))
            {
                somethingChanged = true;
            }
            if (exifGpsWorker.ProcessFile(pic, exifGpsModel))
            {
                somethingChanged = true;
            }

            if (iptcModel.PendingUpdates)
            {
                iptcModel.UpdateSettings();
            }

            if (somethingChanged && commit)
            {
                if (!pic.SaveChanges())
                {
                    return(this.ShowFileVanishedMsg(pic.Filename));
                }
            }

            return(true);
        }
        public override RequestFileChangeResult RequestFileChange()
        {
            if (!askForFileSave)
            {
                return(RequestFileChangeResult.Close);
            }
            if (this.currentPicture == null)
            {
                return(RequestFileChangeResult.Close);
            }
            if (!this.currentPicture.ExistFile)
            {
                return(RequestFileChangeResult.Close);
            }
            IptcModel    iptcModel    = iptcView.GetModel();
            ExifGpsModel exifGpsModel = exifGpsView.GetModel();

            if (!iptcModel.PendingUpdates && !exifGpsModel.PendingUpdates)
            {
                return(RequestFileChangeResult.Close);
            }
            if (!isDataLoaded)
            {
                return(RequestFileChangeResult.Close);
            }

            DialogResult r = MessageBox.Show("Save changes to this picture?", "Iptc and Gps Editor", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (r == DialogResult.Cancel)
            {
                return(RequestFileChangeResult.DoNotClose);
            }

            if (r == DialogResult.Yes)
            {
                mainForm.WaitCursor(true);
                SaveToPicture(currentPicture, false);
                mainForm.WaitCursor(false);
                return(RequestFileChangeResult.CloseAndSave);
            }

            askForFileSave = false;
            return(RequestFileChangeResult.Close);
        }
Exemplo n.º 3
0
        public override void SetModel(ExifGpsModel m)
        {
            base.SetModel(m);

            this.bindingSource.DataSource = this.model;
        }