Esempio n. 1
0
 private void FitsFound_Load(System.Object sender, System.EventArgs e)
 {
     this.Left   = (int)REG.GetReg("JPFITS", "FitsFoundPOSX");
     this.Top    = (int)REG.GetReg("JPFITS", "FitsFoundPOSY");
     this.Width  = (int)REG.GetReg("JPFITS", "FitsFoundWIDTH");
     this.Height = (int)REG.GetReg("JPFITS", "FitsFoundHEIGHT");
 }
Esempio n. 2
0
        private void FitsFinder_Load(object sender, EventArgs e)
        {
            DirectoryTxt.Text = (string)REG.GetReg("CCDLAB", "OpenFilesPath");
            string tmplt = (string)REG.GetReg("CCDLAB", "FindFilesTemplate");

            FileTemplateTxt.Text = tmplt.Substring(0, tmplt.LastIndexOf("."));
            int NumKeyValPairs = Convert.ToInt32(REG.GetReg("CCDLAB", "FindFilesNumKeyValPairs"));

            if (NumKeyValPairs > 0)
            {
                string key;
                string keyval;
                System.Windows.Forms.TextBox[]     k  = new System.Windows.Forms.TextBox[] { Key1, Key2, Key3, Key4 };
                System.Windows.Forms.RichTextBox[] kv = new System.Windows.Forms.RichTextBox[] { Key1Value, Key2Value, Key3Value, Key4Value };
                for (int i = 0; i < NumKeyValPairs; i++)
                {
                    key        = (string)REG.GetReg("CCDLAB", String.Concat("FindFilesKey", i));
                    keyval     = (string)REG.GetReg("CCDLAB", String.Concat("FindFilesKeyVal", i));
                    k[i].Text  = key;
                    kv[i].Text = keyval;
                }
            }
            ExtensionDrop.SelectedIndex = Convert.ToInt32(REG.GetReg("CCDLAB", "FindFilesExtIndex"));
            this.Tag = DialogResult.None;

            SubFoldersChck.Checked = Convert.ToBoolean(REG.GetReg("CCDLAB", "SubFoldersChck"));

            CustomExtensionChck.Checked = Convert.ToBoolean(REG.GetReg("CCDLAB", "CustomExtChck"));
            CustomExtensionTxtBox.Text  = (string)REG.GetReg("CCDLAB", "CustomExtTxt");

            //FOUNDFILES = new string[0];
        }
Esempio n. 3
0
        private void FitsFinderWrkr_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            int numparams = Convert.ToInt32(REG.GetReg("CCDLAB", "FindFilesNumKeyValPairs"));

            string[]  fullfilesinit = (string[])e.Argument;
            ArrayList filelist      = new ArrayList();

            string[] KeyParams    = new string[(numparams)];
            string[] KeyValParams = new string[(numparams)];
            int      match        = 0;

            for (int i = 0; i < numparams; i++)            //get the key/keyvalue pairs
            {
                KeyParams[i]    = (string)REG.GetReg("CCDLAB", String.Concat("FindFilesKey", i));
                KeyValParams[i] = (string)REG.GetReg("CCDLAB", String.Concat("FindFilesKeyVal", i));
            }
            //done filling the param pairs...now need to do the work

            for (int ii = 0; ii < fullfilesinit.Length; ii++)
            {
                if (this.WAITBAR.DialogResult == DialogResult.Cancel)
                {
                    this.DialogResult = DialogResult.Cancel;
                    this.Tag          = DialogResult.Cancel;
                    return;
                }
                FitsFinderWrkr.ReportProgress(ii + 1, filelist.Count);

                FITSImage f1 = new FITSImage(fullfilesinit[ii], null, true, false, false, false);

                match = 0;
                for (int j = 0; j < f1.Header.Length; j++)
                {
                    string key = f1.Header[j].Name;
                    for (int k = 0; k < numparams; k++)
                    {
                        if (KeyParams[k] == key && KeyValParams[k] == f1.Header[j].Value)
                        {
                            match++;
                        }
                    }
                }
                if (match == numparams)
                {
                    filelist.Add(fullfilesinit[ii]);
                }
            }

            string[] matchedfiles = new string[(filelist.Count)];
            for (int h = 0; h < filelist.Count; h++)
            {
                matchedfiles[h] = (string)filelist[h];
            }

            e.Result = matchedfiles;

            this.DialogResult = DialogResult.OK;
        }
Esempio n. 4
0
        private void FITSImageSetSaver_Shown(object sender, EventArgs e)
        {
            //get appendage
            AppendTxt.Text = (string)REG.GetReg("CCDLAB", "Appendage");

            //get directory
            DirectoryTxt.Text = IMAGESET.GetCommonDirectory();            // (string)REG.GetReg("CCDLAB", "BatchSavePath");

            //get file extension index
            FileExtension.SelectedIndex = Convert.ToInt32(REG.GetReg("CCDLAB", "FileExtensionIndex"));
        }
Esempio n. 5
0
 private void FitsExtensionTableViewer_Load(object sender, EventArgs e)
 {
     //try
     {
         this.Left   = (int)REG.GetReg("JPChart", /*this.Text + */ "FitsTableLeft");
         this.Top    = (int)REG.GetReg("JPChart", /*this.Text + */ "FitsTableTop");
         this.Width  = (int)REG.GetReg("JPChart", /*this.Text + */ "FitsTableWidth");
         this.Height = (int)REG.GetReg("JPChart", /*this.Text + */ "FitsTableHeight");
     }
     //catch (...) {}
 }
Esempio n. 6
0
        private void DirectoryTxt_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fb = new FolderBrowserDialog();

            fb.SelectedPath = (string)REG.GetReg("CCDLAB", "OpenFilesPath");
            fb.ShowDialog();
            string dir = fb.SelectedPath;

            DirectoryTxt.Text = dir;
            REG.SetReg("CCDLAB", "OpenFilesPath", dir);
        }
Esempio n. 7
0
        private void SaveListBtn_Click(System.Object sender, System.EventArgs e)
        {
            int Ninds = FileListTxt.SelectedIndices.Count;

            if (Ninds == 0)            //no files selected but asked to save files
            {
                MessageBox.Show("No Files Selected!...", "Error");
                return;
            }

            string[] selectfiles = new string[Ninds];
            for (int j = 0; j < Ninds; j++)
            {
                selectfiles[j] = (string)FileListTxt.Items[FileListTxt.SelectedIndices[j]];
            }

            string         dir = (string)REG.GetReg("CCDLAB", "OpenFilesPath");
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.InitialDirectory = dir;
            dlg.Filter           = "CCDLAB File List (*.CFL)|*.CF"; DialogResult res = dlg.ShowDialog();

            if (res == DialogResult.OK)
            {
                string       file = dlg.FileName;
                FileStream   fs   = new FileStream(file, System.IO.FileMode.Create, FileAccess.Write);
                StreamWriter sw   = new StreamWriter(fs);
                sw.WriteLine(selectfiles.Length);
                for (int u = 0; u < selectfiles.Length; u++)
                {
                    sw.WriteLine(selectfiles[u]);
                }
                sw.Flush();
                fs.Flush();
                sw.Close();
                fs.Close();
                this.DialogResult = DialogResult.Yes;
                this.Close();

                REG.SetReg("CCDLAB", "FoundFileList", file);
            }
        }
Esempio n. 8
0
        private void UseOrigDirChck_CheckedChanged(object sender, EventArgs e)
        {
            if (UseOrigDirChck.Checked)
            {
                string paths = "";

                for (int i = 0; i < IMAGESET.Count; i++)
                {
                    string        currentPath = IMAGESET[i].FilePath;
                    DirectoryInfo dirinf      = new DirectoryInfo(currentPath);
                    paths += "..." + dirinf.Name + "\\\r\n";
                }

                DirectoryTxt.Text = paths;
            }
            else
            {
                DirectoryTxt.Text = (string)REG.GetReg("CCDLAB", "BatchSavePath");
            }
        }
Esempio n. 9
0
        private void FileOpenMenu_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter           = "FITS|*.fits;*.fit;*.fts|All Files|*.*";
            ofd.InitialDirectory = (String)REG.GetReg("JPFITS", "BinTableOpenFilesPath");

            if (ofd.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }

            XDrop.Items.Clear();
            YDrop.Items.Clear();
            int c = MenuChooseTableEntries.DropDownItems.Count;

            for (int i = 2; i < c; i++)
            {
                MenuChooseTableEntries.DropDownItems.RemoveAt(2);
            }
            MenuChooseTable.DropDownItems.Clear();

            OpenFITSImage(ofd.FileName);
        }