Exemple #1
0
        // Catalogues
        private void btnCataloguesSave_Click(object sender, EventArgs e)
        {
            // Valiations:

            if (tbCataloguesShortName.Text.Length == 0)
            {
                errorProvider.SetError(tbCataloguesShortName, "Must provide a value.");
            }
            else
            {
                errorProvider.SetError(tbCataloguesShortName, "");
            }

            // Save new/changes:

            int    id        = 0;
            string shortName = tbCataloguesShortName.Text;
            string longName  = tbCataloguesLongName.Text;

            if (emCatalogues == EditingModes.Add)
            {
                id = 0;
            }
            else
            {
                id = currentCatalogue.Id;
            }

            Catalogue candidate = new Catalogue(id, shortName, longName);

            if (emCameras == EditingModes.Add)
            {
                id = CatalogueController.AddCatalogue(candidate);
            }
            else
            {
                CatalogueController.EditCatalogue(id, candidate);
            }

            // Reload data:

            lblStatus.Text   = "Issuing catalogue saving command... ";
            currentCatalogue = CatalogueController.GetCatalogues(new List <int>()
            {
                id
            })[0];
            LoadCatalogueData(currentCatalogue);
            PrepareDataLists();
            lblStatus.Text += "Complete.";
        }
Exemple #2
0
        private void ClearData()
        {
            listCameras       = CameraController.GetCameras();
            listCatalogues    = CatalogueController.GetCatalogues();
            listColorSpaces   = ColorSpaceController.GetColorSpaces();
            listFileFormats   = FileFormatController.GetFileFormats();
            listOptics        = OpticsController.GetOptics();
            listPhotographers = PhotographerController.GetPhotographers();
            listScopes        = ScopeController.GetScopes();
            listSites         = SiteController.GetSites();

            tbCollectionId.Text = "(adding)";
            tbDateTime.Text     = "";
            tbComments.Text     = "";
            tbFile.Text         = "";
            tbMetadataFile.Text = "";
            tbObjectId.Text     = "";
            tbObjectTitle.Text  = "";
            tbResolutionX.Text  = "";
            tbResolutionY.Text  = "";
            tbTotalFrames.Value = 1;

            cbCamera.Items.Clear();
            foreach (var item in listCameras)
            {
                cbCamera.Items.Add(item.LongName);
            }

            cbCatalogue.Items.Clear();
            foreach (var item in listCatalogues)
            {
                cbCatalogue.Items.Add(item.LongName);
            }

            cbColorSpace.Items.Clear();
            foreach (var item in listColorSpaces)
            {
                cbColorSpace.Items.Add(item.Name);
            }

            cbFileFormat.Items.Clear();
            foreach (var item in listFileFormats)
            {
                cbFileFormat.Items.Add(item.LongName);
            }

            cbPhotographer.Items.Clear();
            foreach (var item in listPhotographers)
            {
                cbPhotographer.Items.Add(item.GetInformalName());
            }

            cbScope.Items.Clear();
            foreach (var item in listScopes)
            {
                cbScope.Items.Add(item.GetScopeName());
            }

            clbOptics.Items.Clear();
            foreach (var item in listOptics)
            {
                clbOptics.Items.Add(item.Id + "|  " + item.GetOpticName());
            }

            cbSite.Items.Clear();
            foreach (var item in listSites)
            {
                cbSite.Items.Add(item.Name);
            }

            lblStatus.Text = "Loaded all assets.";
        }
Exemple #3
0
        void PrepareDataLists()
        {
            // Populate all hard-coded combo-box values.

            cbOpticType.Items.Clear();
            foreach (var item in Enum.GetValues(typeof(Optic.OpticTypes)))
            {
                cbOpticType.Items.Add(item);
            }

            cbScopeMountType.Items.Clear();
            foreach (var item in Enum.GetValues(typeof(Scope.MountTypes)))
            {
                cbScopeMountType.Items.Add(item);
            }

            cbSiteLongtitudeType.Items.Clear();
            foreach (var item in Enum.GetValues(typeof(Site.LongtitudeTypes)))
            {
                cbSiteLongtitudeType.Items.Add(item);
            }

            cbSiteLatitudeType.Items.Clear();
            foreach (var item in Enum.GetValues(typeof(Site.LatitudeTypes)))
            {
                cbSiteLatitudeType.Items.Add(item);
            }

            // Query database for all values.
            listCameras       = CameraController.GetCameras();
            listCatalogues    = CatalogueController.GetCatalogues();
            listColorSpaces   = ColorSpaceController.GetColorSpaces();
            listFileFormats   = FileFormatController.GetFileFormats();
            listOptics        = OpticsController.GetOptics();
            listPhotographers = PhotographerController.GetPhotographers();
            listScopes        = ScopeController.GetScopes();
            listSites         = SiteController.GetSites();

            // Populate list boxes.
            lbCameras.Items.Clear();
            foreach (var item in listCameras)
            {
                lbCameras.Items.Add(item.Id + " " + item.LongName + " " + (item.MaxResolution.Width * item.MaxResolution.Height / 1000000).ToString() + "MP");
            }

            lbCatalogues.Items.Clear();
            foreach (var item in listCatalogues)
            {
                lbCatalogues.Items.Add(item.Id + " " + item.LongName);
            }

            lbColorSpaces.Items.Clear();
            foreach (var item in listColorSpaces)
            {
                lbColorSpaces.Items.Add(item.Id + " " + item.Name);
            }

            lbFileFormats.Items.Clear();
            foreach (var item in listFileFormats)
            {
                lbFileFormats.Items.Add(item.Id + " " + item.LongName);
            }

            lbOptics.Items.Clear();
            foreach (var item in listOptics)
            {
                lbOptics.Items.Add(item.Id + " " + item.Value + " " + item.OpticType.ToString());
            }

            lbPhotographers.Items.Clear();
            foreach (var item in listPhotographers)
            {
                lbPhotographers.Items.Add(item.Id + " " + item.LastName + ", " + item.FirstName);
            }

            lbScopes.Items.Clear();
            foreach (var item in listScopes)
            {
                lbScopes.Items.Add(item.Id + " " + item.Manufacturer + " " + item.Name);
            }

            lbSites.Items.Clear();
            foreach (var item in listSites)
            {
                lbSites.Items.Add(item.Id + " " + item.Name);
            }

            // Populate specific database fields for every tab.

            cbCamerasColorSpaces.Items.Clear();
            foreach (var item in listColorSpaces)
            {
                cbCamerasColorSpaces.Items.Add(item.Name);
            }
        }