Ejemplo n.º 1
0
        private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                // set the filename to save to the current file
                current_file = current_file ?? throw new Exception("No file currently loaded.").Log();

                saveFileDialog1.FileName = current_file.Name;

                // commit all editing stuff
                dataGridView1.EndEdit();
                dataGridView1.CurrentCell = null;

                DialogResult result  = saveFileDialog1.ShowDialog();
                string       newfile = saveFileDialog1.FileName;

                if (result == DialogResult.OK && current_file != null)
                {
                    FitsUtil.WriteFitsHeader(headerBS.List, current_file.FilePath, newfile);
                }
            }
            catch (Exception ex)
            {
                ex.Log().Display();
            }
        }
Ejemplo n.º 2
0
 void UpdateHistoryList(object sender, FitsFile file)
 {
     if (!fileHistoryBS.Contains(file))
     {
         fileHistoryBS.Add(file);
     }
     fileHistoryListBox.SelectedItem = file;
 }
Ejemplo n.º 3
0
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                current_file = current_file ?? throw new Exception("No file currently loaded.").Log();
                dataGridView1.EndEdit();
                dataGridView1.CurrentCell = null;

                FitsUtil.WriteFitsHeader(headerBS.List, current_file.FilePath);
            }
            catch (Exception ex)
            {
                ex.Log().Display();
            }
        }
Ejemplo n.º 4
0
        private void loadFitsHeader(FitsFile file)
        {
            // enable save buttons
            saveToolStripMenuItem.Enabled   = true;
            saveAsToolStripMenuItem.Enabled = true;

            current_file = file ?? throw new Exception("No file currently loaded.").Log(); // set file global variable to the loaded file

            changeWindowTitle(file.Name);                                                  // change window title

            var header = FitsUtil.ReadFitsHeader(current_file.FilePath);

            HeaderRead(this, header);
            FitsLoaded(this, file);
        }
Ejemplo n.º 5
0
        private void Form1_DragDrop(object sender, DragEventArgs e)
        {
            try
            {
                string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);

                foreach (string file in files)
                {
                    var t = new FitsFile(file);
                    if (!fileHistoryBS.Contains(t))
                    {
                        fileHistoryBS.Add(new FitsFile(file));
                    }
                }

                loadFitsHeader(new FitsFile(files[0]));
            }
            catch (Exception ex)
            {
                ex.Log().Display();
            }
        }