예제 #1
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int id = 0;

            int.TryParse(tbCollectionId.Text, out id);

            DateTime     captureDateTime = DateTime.Parse(tbDateTime.Text);
            Catalogue    catalogue       = listCatalogues[cbCatalogue.SelectedIndex];
            int          objectId        = int.Parse(tbObjectId.Text);
            string       objectTitle     = tbObjectTitle.Text;
            int          numberFrames    = Convert.ToInt32(tbTotalFrames.Value);
            FileFormat   fileFormat      = listFileFormats[cbFileFormat.SelectedIndex];
            ColorSpace   colorSpace      = listColorSpaces[cbColorSpace.SelectedIndex];
            Camera       camera          = listCameras[cbCamera.SelectedIndex];
            Scope        scope           = listScopes[cbScope.SelectedIndex];
            Site         site            = listSites[cbSite.SelectedIndex];
            List <Optic> optics          = new List <Optic>();

            foreach (var item in clbOptics.CheckedItems)
            {
                int opticId = int.Parse(item.ToString().Split('|')[0]);
                optics.Add(listOptics.Where(x => x.Id == opticId).ToList()[0]);
            }

            Photographer photographer = listPhotographers[cbPhotographer.SelectedIndex];
            Size         resolution   = Utilities.StringToResolution(tbResolutionX.Text + ";" + tbResolutionY.Text);
            string       comments     = tbComments.Text;
            string       fileName     = tbFile.Text;
            string       metadataFile = tbMetadataFile.Text;

            Collection collection = new Collection(id, captureDateTime, catalogue, objectId, objectTitle,
                                                   numberFrames, fileFormat, colorSpace, camera, scope, site, optics, photographer,
                                                   resolution, comments, fileName, metadataFile);

            if (EditingMode == frmManager.EditingModes.Add)
            {
                CollectionController.AddCollection(collection);
            }
            else
            {
                CollectionController.EditCollection(id, collection);
            }

            ClearData();
            PopulateTreeView();
        }