示例#1
0
        private void FillDetailsListView(IHDU hdu)
        {
            headerListView.Items.Clear();
            headerListView.Font = new Font(headerListView.Font.FontFamily, 11F);
            for (uint i = 0; i < hdu.Header.CardImages.Length; i++)
            {
                ICardImage ci = hdu.Header.CardImages[i];
                if (!ci.IsEmpty)
                {
                    ListViewItem item = new ListViewItem(new string[] { ci.Key, ci.Value, ci.Comment });
                    item.UseItemStyleForSubItems = false;
                    if (ci.IsComment)
                    {
                        item.SubItems[0].ForeColor = Color.DarkGreen;
                    }
                    else if (ci.IsHistory)
                    {
                        item.SubItems[0].ForeColor = Color.SaddleBrown;
                    }
                    else if (ci.IsWCS)
                    {
                        item.SubItems[0].ForeColor = Color.Blue;
                    }
                    else if (ci.IsTable)
                    {
                        item.SubItems[0].ForeColor = Color.FromArgb(255, 64, 128, 128);
                    }
                    Color c = ((i & 1) != 0) ? Color.FromArgb(255, 240, 240, 240) : item.BackColor;
                    item.SubItems[0].BackColor = item.SubItems[1].BackColor = item.SubItems[2].BackColor = c;

                    item.SubItems[0].Font = new Font(item.SubItems[0].Font, FontStyle.Bold);
                    headerListView.Items.Add(item);
                }
            }
        }
示例#2
0
 internal SliceInfo(IHDU hdu)
 {
     _hdu = hdu;
     _hdu.DataMngr.CurrentSlice = 0;
     _modelState = ModelState.Default;
     _modelState.PixelMinimum = _hdu.DataMngr.Minimum;
     _modelState.PixelMaximum = _hdu.DataMngr.Maximum;
     _modelState.Histogram    = new Histogram(_hdu.DataMngr.Data, 500, _hdu.DataMngr.Minimum, _hdu.DataMngr.Maximum, _hdu.DataMngr.BlankValue);
 }
示例#3
0
        void FillWCS(IHDU hdu)
        {
            string rtf =
                @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Microsoft Sans Serif;}}" + "\n" +
                @"{\*\generator Najm 1.0 beta;}\viewkind4\uc1\pard\f0\fs22" + "\n";

            rtf += hdu.Header.WCSInfo.ToString();
            wcsRichTextBox.Rtf = rtf;
        }
示例#4
0
        private IHDU GetSelectedHDU()
        {
            IHDU     hdu = null;
            TreeNode n   = (structureTreeView).SelectedNode;

            if (n != null && n.Tag != null && n.Tag is IHDU)
            {
                hdu = ((IHDU)n.Tag);
            }
            return(hdu);
        }
示例#5
0
        private void PassToDefaultHandler(KeyValuePair <IHDU, int> pair)
        {
            IHDU hdu       = pair.Key;
            int  sessionID = pair.Value;

            if (sessionID == -1) // we don't have opened session
            {
                IHDU[] hdus = new IHDU[1] {
                    hdu
                };
                sessionID = _handlersManager.OpenSession(_handlersManager.DefaultHandler.ID, hdus);
            }
            _handlersManager.ActivateSession(_handlersManager.DefaultHandler.ID, sessionID);
        }
示例#6
0
        private void FillSummary(IHDU hdu)
        {
            richTextBox.Clear();
            Font oldFont  = richTextBox.SelectionFont;
            Font boldFont = new Font(richTextBox.SelectionFont, FontStyle.Bold | FontStyle.Underline);

            richTextBox.SelectionFont = boldFont;
            richTextBox.AppendText("Summary:\n");
            richTextBox.SelectionFont = oldFont;
            richTextBox.AppendText(hdu.Header.SummaryText + "\n");
            richTextBox.SelectionFont = oldFont;
            // well, sometimes the scroll is far down for some reason ans sometimes is up as expected.
            // So, I'm scrolling all the way up now.
            richTextBox.SelectionStart = 0;
            richTextBox.ScrollToCaret();
        }
示例#7
0
        internal void HandlerButton_Click(object sender, EventArgs e)
        {
            int  session     = -1;
            Guid guidHandler = Guid.Empty;

#if !DEBUG
            try
            {
#endif
            StartWaitCursor();
            ToolStripButton b = (ToolStripButton)sender;
            IHDU hdu          = GetSelectedHDU();
            if (hdu != null)
            {
                IHDU[] hdus = new IHDU[1] {
                    hdu
                };
                guidHandler = (Guid)b.Tag;
                session     = _handlersManager.OpenSession(guidHandler, hdus);
                _handlersManager.ActivateSession(guidHandler, session);
            }
#if !DEBUG
        }
#endif
#if !DEBUG
            catch (System.Exception ex)
            {
                // close session on exception to avoid any leftover UI elemts...etc
                if (session != -1 && guidHandler != Guid.Empty)
                {
                    _handlersManager.CloseSession(guidHandler, session);
                }
                MessageBox.Show(ex.Message);
            }
            finally
            {
#endif
            EndWaitCursor();
#if !DEBUG
        }
#endif
        }
示例#8
0
 internal void DisplayHDUHeader(IHDU hdu)
 {
     FillSummary(hdu);
     FillDetailsListView(hdu);
     FillWCS(hdu);
 }