Beispiel #1
0
        private void cmdSampInfo_Click(object sender, EventArgs e)
        {
            int    Hour, Minute, Second;
            int    Month, Day, Year;
            int    SampleInterval, SampleCount;
            int    StartDate, StartTime;
            int    Postfix;
            string PostfixStr, StartDateStr;
            string StartTimeStr;

            PostfixStr     = "";
            SampleInterval = 0;
            SampleCount    = 0;
            StartDate      = 0;
            StartTime      = 0;

            // Get the sample information
            //  Parameters:
            //    Filename            :name of file to get information from
            //    SampleInterval      :time between samples
            //    SampleCount         :number of samples in the file
            //    StartDate           :date of first sample
            //    StartTime           :time of first sample

            ULStat = logger.GetSampleInfo(ref SampleInterval, ref SampleCount, ref StartDate, ref StartTime);
            if (ULStat.Value != MccDaq.ErrorInfo.ErrorCode.NoErrors)
            {
                lblComment.Text = ULStat.Message + ".";
            }
            else
            {
                //Parse the date from the StartDate parameter
                Month        = (StartDate >> 8) & 0xff;
                Day          = StartDate & 0xff;
                Year         = (StartDate >> 16) & 0xffff;
                StartDateStr = Month.ToString("00") + "/" +
                               Day.ToString("00") + "/" + Year.ToString("0000");

                //Parse the time from the StartTime parameter
                Hour    = (StartTime >> 16) & 0xffff;
                Minute  = (StartTime >> 8) & 0xff;
                Second  = StartTime & 0xff;
                Postfix = (StartTime >> 24) & 0xff;
                if (Postfix == 0)
                {
                    PostfixStr = " AM";
                }
                if (Postfix == 1)
                {
                    PostfixStr = " PM";
                }
                StartTimeStr = Hour.ToString("00") + ":" +
                               Minute.ToString("00") + ":" + Second.ToString("00")
                               + PostfixStr;

                txtResults.Text =
                    "The sample properties of '" + logger.FileName + "' are:" +
                    "\r\n" + "\r\n" + "\t" + "SampleInterval: " + "\t" +
                    SampleInterval.ToString("0") + "\r\n" + "\t" + "SampleCount: " +
                    "\t" + SampleCount.ToString("0") + "\r\n" + "\t" +
                    "Start Date: " + "\t" + StartDateStr + "\r\n" + "\t" +
                    "Start Time: " + "\t" + StartTimeStr;
            }
        }