コード例 #1
0
ファイル: frmManager.cs プロジェクト: RedPhantom/AstroDAM
        // File Formats

        private void btnFileFormatsSave_Click(object sender, EventArgs e)
        {
            // Valiations:

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

            // Save new/changes:

            int    id        = 0;
            string shortName = tbFileFormatShortName.Text;
            string longName  = tbFileFormatLongName.Text;

            if (emFileFormats == EditingModes.Add)
            {
                id = 0;
            }
            else
            {
                id = currentFileFormat.Id;
            }

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

            if (emFileFormats == EditingModes.Add)
            {
                id = FileFormatController.AddFileFormat(candidate);
            }
            else
            {
                FileFormatController.EditFileFormat(id, candidate);
            }

            // Reload data:

            lblStatus.Text    = "Issuing file formats saving command... ";
            currentFileFormat = FileFormatController.GetFileFormats(new List <int>()
            {
                id
            })[0];
            LoadFileFormatData(currentFileFormat);
            PrepareDataLists();
            lblStatus.Text += "Complete.";
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: RedPhantom/AstroDAM
        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.";
        }
コード例 #3
0
ファイル: frmManager.cs プロジェクト: RedPhantom/AstroDAM
        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);
            }
        }