Esempio n. 1
0
        private void DirectoryTxt_Click(object sender, EventArgs e)
        {
            if (DirectoryFileLabel.Text.Contains("Directory"))
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                fbd.SelectedPath = DirectoryTxt.Text;
                fbd.Description  = "Please select the foler in which to save the files...";
                if (fbd.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }

                string dir = fbd.SelectedPath + "\\";
                DirectoryTxt.Text = dir;
                REG.SetReg("CCDLAB", "BatchSavePath", dir);
                UseOrigDirChck.Checked = false;
            }
            else if (DirectoryFileLabel.Text.Contains("File"))
            {
                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter           = "ZIP|*.zip";
                sfd.InitialDirectory = IMAGESET.GetCommonDirectory();
                sfd.FileName         = sfd.InitialDirectory.Remove(sfd.InitialDirectory.LastIndexOf("\\"));
                sfd.FileName         = sfd.FileName.Substring(sfd.FileName.LastIndexOf("\\") + 1);

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

                DirectoryTxt.Text = sfd.FileName;
            }
        }
Esempio n. 2
0
 private void FitsExtensionTableViewer_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e)
 {
     REG.SetReg("JPChart", /*this.Text + */ "FitsTableLeft", this.Left);
     REG.SetReg("JPChart", /*this.Text + */ "FitsTableTop", this.Top);
     REG.SetReg("JPChart", /*this.Text + */ "FitsTableWidth", this.Width);
     REG.SetReg("JPChart", /*this.Text + */ "FitsTableHeight", this.Height);
 }
Esempio n. 3
0
 private void FitsFound_FormClosing(System.Object sender, System.Windows.Forms.FormClosingEventArgs e)
 {
     REG.SetReg("JPFITS", "FitsFoundPOSX", this.Location.X);
     REG.SetReg("JPFITS", "FitsFoundPOSY", this.Location.Y);
     REG.SetReg("JPFITS", "FitsFoundWIDTH", this.Size.Width);
     REG.SetReg("JPFITS", "FitsFoundHEIGHT", this.Size.Height);
 }
Esempio n. 4
0
        private void GetCommonDirectoryBtn_Click(object sender, EventArgs e)
        {
            DirectoryTxt.Text = IMAGESET.GetCommonDirectory();
            REG.SetReg("CCDLAB", "BatchSavePath", DirectoryTxt.Text);

            UseOrigDirChck.Checked = false;
        }
Esempio n. 5
0
 private void FitsExtensionTableViewer_LocationChanged(object sender, EventArgs e)
 {
     REG.SetReg("JPChart", this.Text + "FitsTableLeft", this.Left);
     REG.SetReg("JPChart", this.Text + "FitsTableTop", this.Top);
     REG.SetReg("JPChart", this.Text + "FitsTableWidth", this.Width);
     REG.SetReg("JPChart", this.Text + "FitsTableHeight", this.Height);
 }
Esempio n. 6
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. 7
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. 8
0
        private void ZipInOneChck_CheckedChanged(object sender, EventArgs e)
        {
            if (ZipInOneChck.Checked)
            {
                UseOrigDirChck.Checked        = false;
                UseOrigDirChck.Enabled        = false;
                GetCommonDirectoryBtn.Enabled = false;
                AppendBtn.Enabled             = false;
                AppendTxt.Enabled             = false;
                AppendBtnChangeBtn.Enabled    = false;

                DirectoryFileLabel.Text = "File Name:";

                string name = IMAGESET.GetCommonDirectory();
                name = name + new DirectoryInfo(name).Name + ".zip";
                DirectoryTxt.Text = name;

                REG.SetReg("CCDLAB", "BatchSavePath", DirectoryTxt.Text);
            }
            else
            {
                UseOrigDirChck.Enabled        = true;
                GetCommonDirectoryBtn.Enabled = true;
                AppendBtn.Enabled             = true;
                AppendTxt.Enabled             = true;
                AppendBtnChangeBtn.Enabled    = true;

                GetCommonDirectoryBtn.PerformClick();
                DirectoryFileLabel.Text = "Directory:";
            }
        }
Esempio n. 9
0
        private void OverwriteBtn_Click(object sender, EventArgs e)
        {
            //write extension index
            REG.SetReg("CCDLAB", "FileExtensionIndex", FileExtension.SelectedIndex.ToString());

            WriteImageSet("overwrite");
        }
Esempio n. 10
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. 11
0
        private void AppendBtn_Click(object sender, EventArgs e)
        {
            //write extension index
            REG.SetReg("CCDLAB", "FileExtensionIndex", FileExtension.SelectedIndex.ToString());
            //write appendage
            REG.SetReg("CCDLAB", "Appendage", AppendTxt.Text);

            WriteImageSet("append");
        }
Esempio n. 12
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. 13
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. 14
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. 15
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. 16
0
        private void OpenFITSImage(String FileName)
        {
            try
            {
                FILENAME = FileName;
                String file = FILENAME.Substring(FILENAME.LastIndexOf("\\"));
                this.Text = file.Substring(1);
                string[] list = FITSBinTable.GetAllExtensionNames(FileName);
                REG.SetReg("JPFITS", "BinTableOpenFilesPath", FileName.Substring(0, FileName.LastIndexOf("\\")));

                for (int i = 0; i < list.Length; i++)
                {
                    if (list[i] == "")
                    {
                        MenuChooseTable.DropDownItems.Add("UNNAMED");
                    }
                    else
                    {
                        MenuChooseTable.DropDownItems.Add(list[i]);
                    }

                    ((ToolStripMenuItem)MenuChooseTable.DropDownItems[MenuChooseTable.DropDownItems.Count - 1]).CheckOnClick = true;
                    this.MenuChooseTable.DropDownItems[MenuChooseTable.DropDownItems.Count - 1].Click += new System.EventHandler(MenuChooseTable_Click);
                    ((ToolStripMenuItem)this.MenuChooseTable.DropDownItems[MenuChooseTable.DropDownItems.Count - 1]).CheckedChanged += new System.EventHandler(MenuChooseTable_CheckedChanged);
                }

                this.Show();

                if (list.Length == 1)
                {
                    PopulateTable(list[0]);
                }
                else
                {
                    MenuChooseTable.ShowDropDown();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Data + "	"+ e.InnerException + "	" + e.Message + "	"+ e.Source + "	" + e.StackTrace + "	"+ e.TargetSite);
            }
        }
Esempio n. 17
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. 18
0
        private void FileExtension_SelectedIndexChanged(object sender, EventArgs e)
        {
            REG.SetReg("CCDLAB", "FileExtensionIndex", FileExtension.SelectedIndex.ToString());

            if (FileExtension.SelectedIndex == 3)            //jpg
            {
                InvertGrayScaleChck.BringToFront();
                InvertGrayScaleChck.Visible = true;
            }
            else if (FileExtension.SelectedIndex == 4)            //zip
            {
                ZipInOneChck.BringToFront();
                ZipInOneChck.Visible = true;
            }
            else
            {
                InvertGrayScaleChck.Visible = false;
                InvertGrayScaleChck.Checked = false;

                ZipInOneChck.Visible = false;
                ZipInOneChck.Checked = false;
            }
        }
Esempio n. 19
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);
        }
Esempio n. 20
0
        private void FindBtn_Click(object sender, EventArgs e)
        {
            string dir = DirectoryTxt.Text;

            if (!Directory.Exists(dir))
            {
                throw new Exception("Directory doesn't exist...");
            }

            bool subdirs = SubFoldersChck.Checked;

            REG.SetReg("CCDLAB", "SubFoldersChck", subdirs);

            //need to get search params and write them to reg for later FindFiles()
            string extension;

            if (CustomExtensionChck.Checked)
            {
                extension = CustomExtensionTxtBox.Text;
            }
            else
            {
                extension = ExtensionDrop.Items[ExtensionDrop.SelectedIndex].ToString();
            }

            string filetemplate = String.Concat(FileTemplateTxt.Text, extension);            //file template for cursory directory search, which we'll start with
            int    count        = 0;

            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 < k.Length; i++)
            {
                if (k[i].Text.Length == 0)
                {
                    continue;
                }
                REG.SetReg("CCDLAB", String.Concat("FindFilesKey", count), k[i].Text);
                REG.SetReg("CCDLAB", String.Concat("FindFilesKeyVal", count), kv[i].Text);
                count++;
            }
            REG.SetReg("CCDLAB", "FindFilesNumKeyValPairs", count.ToString());
            REG.SetReg("CCDLAB", "FindFilesExtIndex", ExtensionDrop.SelectedIndex);
            REG.SetReg("CCDLAB", "FindFilesTemplate", filetemplate);
            REG.SetReg("CCDLAB", "CustomExtChck", CustomExtensionChck.Checked);
            REG.SetReg("CCDLAB", "CustomExtTxt", CustomExtensionTxtBox.Text);

            string[] fullfilesinit;
            if (!subdirs)
            {
                fullfilesinit = Directory.GetFiles(dir, filetemplate, System.IO.SearchOption.TopDirectoryOnly);                //cursory search
            }
            else
            {
                fullfilesinit = Directory.GetFiles(dir, filetemplate, System.IO.SearchOption.AllDirectories); //cursory search
            }
            if (count > 0)                                                                                    //then we're doing more than just a cursory file template search
            {
                this.WAITBAR = new WaitBar();
                this.WAITBAR.ProgressBar.Maximum = fullfilesinit.Length;
                this.WAITBAR.Text = "Searching files...";
                FitsFinderWrkr.RunWorkerAsync(fullfilesinit);
                this.WAITBAR.ShowDialog();
            }
            else
            {
                FOUNDFILES        = fullfilesinit;
                this.Tag          = DialogResult.OK;
                this.DialogResult = DialogResult.OK;
            }
        }
Esempio n. 21
0
 private void DirectoryTxt_TextChanged(object sender, EventArgs e)
 {
     REG.SetReg("CCDLAB", "BatchSavePath", DirectoryTxt.Text);
 }