Example #1
0
        private void GetCommonDirectoryBtn_Click(object sender, EventArgs e)
        {
            DirectoryTxt.Text = IMAGESET.GetCommonDirectory();
            REG.SetReg("CCDLAB", "BatchSavePath", DirectoryTxt.Text);

            UseOrigDirChck.Checked = false;
        }
Example #2
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);
 }
Example #3
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:";
            }
        }
Example #4
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;
            }
        }
Example #5
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);
 }
Example #6
0
        private void OverwriteBtn_Click(object sender, EventArgs e)
        {
            //write extension index
            REG.SetReg("CCDLAB", "FileExtensionIndex", FileExtension.SelectedIndex.ToString());

            WriteImageSet("overwrite");
        }
Example #7
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);
 }
Example #8
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");
        }
Example #9
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);
        }
Example #10
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);
            }
        }
Example #11
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);
            }
        }
Example #12
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;
            }
        }
Example #13
0
 private void DirectoryTxt_TextChanged(object sender, EventArgs e)
 {
     REG.SetReg("CCDLAB", "BatchSavePath", DirectoryTxt.Text);
 }
Example #14
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;
            }
        }