Ejemplo n.º 1
0
        private void dataGridView1_UserDeletingRow(object sender, DataGridViewRowCancelEventArgs e)
        {
            HeaderField field = (HeaderField)e.Row.DataBoundItem;

            if (field.isMandatory())
            {
                e.Cancel = true;
            }
        }
Ejemplo n.º 2
0
 private void addHeaderField(HeaderField field = null)
 {
     if (field != null)
     {
         headerBS.Add(field);
     }
     else
     {
         headerBS.AddNew();
     }
 }
Ejemplo n.º 3
0
 private void AddDefaultHeaderButtonOnClick(object sender, EventArgs e)
 {
     try
     {
         var obj = new HeaderField("", ""); addHeaderField(obj);
         obj = new HeaderField("", "      / Added with FitsHeaderEditor"); addHeaderField(obj);
         obj = new HeaderField("OBJECT", Properties.Settings.Default.HeaderFieldObject); addHeaderField(obj);
         obj = new HeaderField("TELESCOP", Properties.Settings.Default.HeaderFieldTelescope); addHeaderField(obj);
         obj = new HeaderField("INSTRUME", Properties.Settings.Default.HeaderFieldInstrument); addHeaderField(obj);
         obj = new HeaderField("OBSERVER", Properties.Settings.Default.HeaderFieldObserver); addHeaderField(obj);
         obj = new HeaderField("DATE-OBS", Properties.Settings.Default.HeaderFieldDate); addHeaderField(obj);
     }
     catch (Exception ex)
     {
         ex.Log().Display();
     }
 }
Ejemplo n.º 4
0
        private void removeHeaderField()
        {
            foreach (DataGridViewRow row in dataGridView1.SelectedRows)
            {
                // first check if the row is new
                if (row.IsNewRow)
                {
                    continue;
                }

                HeaderField field = (HeaderField)row.DataBoundItem;

                if (field.isMandatory())
                {
                    continue;
                }
                dataGridView1.Rows.RemoveAt(row.Index);
            }

            foreach (DataGridViewCell cell in dataGridView1.SelectedCells)
            {
                var row = cell.OwningRow;
                // first check if the row is new
                if (row.IsNewRow)
                {
                    continue;
                }

                HeaderField field = (HeaderField)row.DataBoundItem;

                if (field.isMandatory())
                {
                    continue;
                }
                dataGridView1.Rows.RemoveAt(row.Index);
            }
            //datagrid.RemoveCurrent();
        }
Ejemplo n.º 5
0
        private void findHeaderField(string value)
        {
            DataGridViewRow selectedRow = dataGridView1.CurrentRow;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                row.Selected = false;
                HeaderField field = (HeaderField)row.DataBoundItem;
                if (field == null || field.isEmpty())
                {
                    continue;
                }
                if (field.Key.Trim().Equals(value) || field.Value.Trim().Equals(value))
                {
                    selectedRow = row;
                    break;
                }
            }

            if (selectedRow != null)
            {
                selectedRow.Selected = true;
            }
        }
Ejemplo n.º 6
0
        public static HeaderField EndKeyword()
        {
            HeaderField f = new HeaderField("END", "");

            return(f);
        }