Esempio n. 1
0
        private void btnNextTime_Click(object sender, EventArgs e)
        {
            if (m_EnterOCRAttachDate)
            {
                if (!SanityCheckOCRDate())
                {
                    return;
                }
                DateTime dateToAttachToOCR = ucUtcTime.DateTimeUtc.Date;
                m_Operation.SetAttachDateToOCR(dateToAttachToOCR);
                StartExport(UsedTimeBase.EmbeddedTimeStamp);
            }
            else if (!m_FirstTimeSet)
            {
                if (IsDuplicatedFrame(m_CurrFrameNo))
                {
                    ShowDuplicatedFrameMessage();
                    return;
                }

                if (!SanityCheckOCRDate())
                {
                    return;
                }

                m_FirstTimeFrame = m_CurrFrameNo;
                m_FirstTimeSet   = true;

                lblTimesHeader.Text = "Enter the UTC time of the last exported frame:";
                btnNextTime.Text    = "Start Export";
                ucUtcTime.EnterTimeAtTheSameDate();
                m_Operation.SetStartTime(ucUtcTime.DateTimeUtc, m_FirstTimeFrame);

                m_VideoController.MoveToFrame((int)nudLastFrame.Value);
            }
            else
            {
                if (IsDuplicatedFrame(m_CurrFrameNo))
                {
                    ShowDuplicatedFrameMessage();
                    return;
                }

                m_LastTimeFrame = m_CurrFrameNo;
                m_Operation.SetEndTime(ucUtcTime.DateTimeUtc, m_LastTimeFrame);

                DialogResult checkResult = m_Operation.EnteredTimeIntervalLooksOkay();

                switch (checkResult)
                {
                case DialogResult.OK:
                    StartExport(UsedTimeBase.UserEnterred);
                    break;

                case DialogResult.Retry:
                    PrepareToEnterStartTime();
                    return;

                case DialogResult.Abort:
                    m_VideoController.CloseOpenedVideoFile();
                    return;
                }
            }

            UpdateShowingFieldControls();
        }
Esempio n. 2
0
        private void btnNextTime_Click(object sender, EventArgs e)
        {
            if (m_EnterOCRAttachDate)
            {
                DateTime dateToAttachToOCR = ucUtcTime.DateTimeUtc.Date;
                m_Operation.SetAttachDateToOCR(dateToAttachToOCR);
                StartExport(UsedTimeBase.EmbeddedTimeStamp);
            }
            else if (!m_FirstTimeSet)
            {
                if (IsDuplicatedFrame(m_CurrFrameNo))
                {
                    ShowDuplicatedFrameMessage();
                    return;
                }

                if (ucUtcTime.DateTimeUtc.Date == DateTime.Now.Date)
                {
                    if (m_VideoController.ShowMessageBox(
                            "The date component is also exported into the FITS header. Please ensure that the selected date it correct. Press OK to contrinue or Cancel to go back and change the date.",
                            "Tangra",
                            MessageBoxButtons.OKCancel,
                            MessageBoxIcon.Warning,
                            MessageBoxDefaultButton.Button2) == DialogResult.Cancel)
                    {
                        return;
                    }
                }

                m_FirstTimeFrame = m_CurrFrameNo;
                m_FirstTimeSet   = true;

                lblTimesHeader.Text = "Enter the UTC time of the last exported frame:";
                btnNextTime.Text    = "Start Export";
                ucUtcTime.EnterTimeAtTheSameDate();
                m_Operation.SetStartTime(ucUtcTime.DateTimeUtc, m_FirstTimeFrame);

                m_VideoController.MoveToFrame((int)nudLastFrame.Value);
            }
            else
            {
                if (IsDuplicatedFrame(m_CurrFrameNo))
                {
                    ShowDuplicatedFrameMessage();
                    return;
                }

                m_LastTimeFrame = m_CurrFrameNo;
                m_Operation.SetEndTime(ucUtcTime.DateTimeUtc, m_LastTimeFrame);

                DialogResult checkResult = m_Operation.EnteredTimeIntervalLooksOkay();

                switch (checkResult)
                {
                case DialogResult.OK:
                    StartExport(UsedTimeBase.UserEnterred);
                    break;

                case DialogResult.Retry:
                    PrepareToEnterStartTime();
                    return;

                case DialogResult.Abort:
                    m_VideoController.CloseOpenedVideoFile();
                    return;
                }
            }

            UpdateShowingFieldControls();
        }