Example #1
0
 public void Compare_Test2()
 {
     var dt0 = new DateTimeOffset(1582, 10, 15, 0, 0, 0, TimeSpan.Zero);
     var arr = new []
     {
         TimeUuid.NewId(dt0.AddTicks(0x00000000007fffL)),
         TimeUuid.NewId(dt0.AddTicks(0x00ff0000000000L)),
         TimeUuid.NewId(dt0.AddTicks(0x07ff0000000000L)),
         TimeUuid.NewId(dt0.AddTicks(0x07ff0000ff0000L))
     };
     var actual = (TimeUuid[])arr.Clone();
     Array.Sort(actual);
     CollectionAssert.AreEqual(arr, actual);
 }
Example #2
0
        private static void Dump(TimeZoneInfo zone, Options options, TextWriter writer)
        {
            writer.Write($"{zone.Id}\n");

            // This will be a bit odd using Windows time zones, as most have permanent
            // daylight saving rules... but for tz data, it should be okay.
            var initial = new DateTimeOffset(2, 1, 1, 0, 0, 0, 0, TimeSpan.Zero);
            var initialOffset = zone.GetUtcOffset(initial);
            var initialDaylight = zone.IsDaylightSavingTime(initial);
            writer.Write("Initially:           {0} {1} {2}\n",
                (initialOffset.Ticks >= 0 ? "+" : "-") + initialOffset.ToString("hh':'mm':'ss", CultureInfo.InvariantCulture),
                initialDaylight ? "daylight" : "standard",
                initialDaylight ? zone.DaylightName : zone.StandardName);

            int fromYear = options.FromYear ?? 1800;
            DateTimeOffset start = new DateTimeOffset(fromYear, 1, 1, 0, 0, 0, TimeSpan.Zero);
            DateTimeOffset end = new DateTimeOffset(options.ToYear, 1, 1, 0, 0, 0, TimeSpan.Zero);

            DateTimeOffset? transition = GetNextTransition(zone, start.AddTicks(-1), end);
            while (transition != null)
            {
                var offset = zone.GetUtcOffset(transition.Value);
                var isDaylight = zone.IsDaylightSavingTime(transition.Value);
                // It's unfortunate that TimeZoneInfo doesn't support the idea of different names
                // for different periods in history. Never mind - this is better than nothing,
                // for diagnostic purposes.
                writer.Write("{0} {1} {2} {3}\n",
                    transition.Value.ToString("yyyy-MM-dd HH:mm:ss'Z'", CultureInfo.InvariantCulture),
                    (offset.Ticks >= 0 ? "+" : "-") + offset.ToString("hh':'mm':'ss", CultureInfo.InvariantCulture),
                    isDaylight ? "daylight" : "standard",
                    isDaylight ? zone.DaylightName : zone.StandardName);
                transition = GetNextTransition(zone, transition.Value, end);
            }
            writer.Write("\n");
        }
Example #3
0
 /// <summary>
 /// Fakes the current time to the time specified, making slight increments in time for each invocation
 /// (the slight increments can be turned off by setting <paramref name="incrementSlightlyOnEachInvocation"/> to false)
 /// </summary>
 public static void FakeIt(DateTimeOffset fakeTime, bool incrementSlightlyOnEachInvocation = true)
 {
     RebusTime.CurrentTimeFactory = () =>
     {
         var timeToReturn = fakeTime;
         fakeTime = fakeTime.AddTicks(1);
         return timeToReturn;
     };
 }
 public override object ConvertToStorageType(object value) {
     if (value != null) {
         var dateTime = new DateTimeOffset(new DateTime(1753, 1, 1));
         if (dateTime > (DateTimeOffset)value) {
             var time = ((DateTimeOffset)value).TimeOfDay;
             DateTimeOffset storageType = dateTime.AddTicks(time.Ticks);
             return storageType.DateTime;
         }
         dateTime = new DateTimeOffset(new DateTime(9999, 12, 31));
         return dateTime < (DateTimeOffset)value ? dateTime.DateTime : ((DateTimeOffset)value).DateTime;
     }
     return null;
 }
    public void From_FromFixedDateTime_Tests(int value)
    {
        var originalPointInTime = new DateTimeOffset(1976, 12, 31, 17, 0, 0, 0, TimeSpan.Zero);

        Assert.AreEqual(value.Years().From(originalPointInTime), originalPointInTime.AddYears(value));
        Assert.AreEqual(value.Months().From(originalPointInTime), originalPointInTime.AddMonths(value));
        Assert.AreEqual(value.Weeks().From(originalPointInTime), originalPointInTime.AddDays(value*DaysPerWeek));
        Assert.AreEqual(value.Days().From(originalPointInTime), originalPointInTime.AddDays(value));

        Assert.AreEqual(value.Hours().From(originalPointInTime), originalPointInTime.AddHours(value));
        Assert.AreEqual(value.Minutes().From(originalPointInTime), originalPointInTime.AddMinutes(value));
        Assert.AreEqual(value.Seconds().From(originalPointInTime), originalPointInTime.AddSeconds(value));
        Assert.AreEqual(value.Milliseconds().From(originalPointInTime), originalPointInTime.AddMilliseconds(value));
        Assert.AreEqual(value.Ticks().From(originalPointInTime), originalPointInTime.AddTicks(value));
    }
        /// <summary>
        /// Parse the given string representation into a <see cref="DateTimeOffset"/> value.
        /// </summary>
        /// <param name="value">A string representation of a date time.</param>
        /// <returns>A <see cref="DateTimeOffset"/> value.</returns>
        public DateTimeOffset ParseDateTimeOffset(string value)
        {
            int year, month, day, hour, minute, second, offsetHours, offsetMinutes;
            long ticks;
            DateTimeKind dateTimeKind;

            GetDateTimeComponents(value, out year, out month, out day, out hour, out minute, out second, out ticks, out offsetHours, out offsetMinutes, out dateTimeKind);

            TimeSpan utcOffset;

            switch (dateTimeKind)
            {
                case DateTimeKind.Unspecified:
                    utcOffset = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
                    break;
                case DateTimeKind.Utc:
                case DateTimeKind.Local:
                    utcOffset = new TimeSpan(offsetHours, offsetMinutes, 0);
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            var dateTimeOffset = new DateTimeOffset(year, month, day, hour, minute, second, utcOffset);
            dateTimeOffset = dateTimeOffset.AddTicks(ticks);

            return dateTimeOffset;
        }
Example #7
0
        //[Variation("ToString(DateTimeOffset, format) - valid cases")]
        public int ToType57()
        {
            var dto = new DateTimeOffset();
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM"), "0001-01", "datetimeOffset1");

            dto = new DateTimeOffset();
            CError.Equals(XmlConvert.ToString(dto, "yyyy"), "0001", "datetimeOffset2");

            dto = new DateTimeOffset();
            CError.Equals(XmlConvert.ToString(dto, null), "01/01/0001 00:00:00 +00:00", "datetimeOffset3");

            string s = XmlConvert.ToString(XmlConvert.ToDateTimeOffset("2002-12-30"), "yyyy-MM-dd");
            CError.Equals(s, "2002-12-30", "datetimeOffset");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "2002-12-30T23:15:55+00:00", "datetimeOffset4");

            dto = new DateTimeOffset(1, 1, 1, 23, 59, 59, TimeSpan.Zero);
            dto = dto.AddTicks(9999999);
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "0001-01-01T23:59:59+00:00", "datetimeOffset5");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "2002-12-30T23:15:55+00:00", "datetimeOffset6");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-dd"), "2002-12-30", "datetimeOffset7");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto, "HH:mm:ss"), "23:15:55", "datetimeOffset8");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto, "HH:mm:ssZ"), "23:15:55Z", "datetimeOffset9");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, TimeSpan.FromMinutes(0));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "0001-01-01T00:00:00+00:00", "datetimeOffset10");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, TimeSpan.FromMinutes(-840));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "0001-01-01T00:00:00-14:00", "datetimeOffset11");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, TimeSpan.FromMinutes(840));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "9999-12-31T23:59:59+14:00", "datetimeOffset12");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, TimeSpan.FromMinutes(840));
            CError.Equals(XmlConvert.ToString(dto, null), "12/31/9999 23:59:59 +14:00", "datetimeOffset13");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, TimeSpan.FromMinutes(0));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "9999-12-31T23:59:59+00:00", "datetimeOffset14");

            dto = DateTimeOffset.MaxValue;
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "9999-12-31T23:59:59+00:00", "datetimeOffset16");

            dto = DateTimeOffset.MaxValue;
            CError.Equals(XmlConvert.ToString(dto, null), "12/31/9999 23:59:59 +00:00", "datetimeOffset18");

            dto = DateTimeOffset.MinValue;
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:sszzzzzz"), "0001-01-01T00:00:00+00:00", "datetimeOffset19");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, 1, TimeSpan.FromHours(-0));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "0001-01-01T00:00:00.001+00:00", "datetimeOffset22");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, 999, TimeSpan.FromHours(14));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "9999-12-31T23:59:59.999+14:00", "datetimeOffset23");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, 999, TimeSpan.FromHours(-14));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "0001-01-01T00:00:00.999-14:00", "datetimeOffset24");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, 125, TimeSpan.FromHours(14));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "9999-12-31T23:59:59.125+14:00", "datetimeOffset25");

            dto = new DateTimeOffset(2000, 2, 29, 23, 59, 59, 999, TimeSpan.FromHours(-14));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "2000-02-29T23:59:59.999-14:00", "datetimeOffset26");

            dto = new DateTimeOffset(2000, 2, 29, 23, 59, 59, 444, TimeSpan.FromHours(+14));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "2000-02-29T23:59:59.444+14:00", "datetimeOffset27");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, 999, TimeSpan.FromHours(14));
            CError.Equals(XmlConvert.ToString(dto, "yyyy-MM-ddTHH:mm:ss.FFFFFFFzzzzzz"), "9999-12-31T23:59:59.999+14:00", "datetimeOffset28");
            return TEST_PASS;
        }
Example #8
0
        //[Variation("ToString(DateTimeOffset) - valid cases")]
        public int ToType56()
        {
            var dto = new DateTimeOffset();
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T00:00:00Z", "datetimeOffset1");

            dto = new DateTimeOffset(2002, 12, 30, 0, 0, 0, 0, TimeSpan.FromHours(-8));
            CError.Equals(XmlConvert.ToString(dto), "2002-12-30T00:00:00-08:00", "datetimeOffset2");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, 556, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto), "2002-12-30T23:15:55.556Z", "datetimeOffset3");

            dto = new DateTimeOffset(1, 1, 1, 23, 59, 59, TimeSpan.Zero);
            dto = dto.AddTicks(9999999);
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T23:59:59.9999999Z", "milisecs");

            dto = new DateTimeOffset(2002, 12, 30, 23, 15, 55, TimeSpan.Zero);
            CError.Equals(XmlConvert.ToString(dto), "2002-12-30T23:15:55Z", "datetimeOffset4");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, TimeSpan.FromHours(0));
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T00:00:00Z", "datetimeOffset5");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, TimeSpan.FromHours(-14));
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T00:00:00-14:00", "datetimeOffset6");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, TimeSpan.FromHours(14));
            CError.Equals(XmlConvert.ToString(dto), "9999-12-31T23:59:59+14:00", "datetimeOffset7");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, TimeSpan.FromHours(0));
            CError.Equals(XmlConvert.ToString(dto), "9999-12-31T23:59:59Z", "datetimeOffset8");

            dto = DateTimeOffset.MaxValue;
            CError.Equals(XmlConvert.ToString(dto), "9999-12-31T23:59:59.9999999Z", "datetimeOffset10");

            dto = DateTimeOffset.MinValue;
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T00:00:00Z", "datetimeOffset11");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, 1, TimeSpan.FromHours(-0));
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T00:00:00.001Z", "datetimeOffset14");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, 999, TimeSpan.FromHours(14));
            CError.Equals(XmlConvert.ToString(dto), "9999-12-31T23:59:59.999+14:00", "datetimeOffset15");

            dto = new DateTimeOffset(1, 1, 1, 0, 0, 0, 999, TimeSpan.FromHours(-14));
            CError.Equals(XmlConvert.ToString(dto), "0001-01-01T00:00:00.999-14:00", "datetimeOffset16");

            dto = new DateTimeOffset(9999, 12, 31, 23, 59, 59, 125, TimeSpan.FromHours(14));
            CError.Equals(XmlConvert.ToString(dto), "9999-12-31T23:59:59.125+14:00", "datetimeOffset17");

            dto = new DateTimeOffset(2000, 2, 29, 23, 59, 59, 999, TimeSpan.FromHours(-14));
            CError.Equals(XmlConvert.ToString(dto), "2000-02-29T23:59:59.999-14:00", "datetimeOffset18");

            dto = new DateTimeOffset(2000, 2, 29, 23, 59, 59, 444, TimeSpan.FromHours(+14));
            CError.Equals(XmlConvert.ToString(dto), "2000-02-29T23:59:59.444+14:00", "datetimeOffset19");

            dto = new DateTimeOffset(2000, 2, 29, 23, 59, 59, 999, TimeSpan.FromHours(-14));
            CError.Equals(XmlConvert.ToString(dto), "2000-02-29T23:59:59.999-14:00", "datetimeOffset20");
            return TEST_PASS;
        }
Example #9
0
        public void DATETIMEOFFSET_Data_ScriptsCorrectly()
        {
            DateTimeOffset baseData = new DateTimeOffset(2000, 10, 31, 2, 33, 44, new TimeSpan(3,0,0));
            object data = baseData;
            var fieldInfo = SchemaScriptingTests.FakeColumn("test", "test", 32, "datetimeoffset", false, 0, 0);
            Assert.AreEqual("'2000-10-31T02:33:44+03:00'", FieldScripting.valueAsTSQLLiteral(data, fieldInfo), "datetimeoffset no fractional seconds");
            Assert.AreEqual("2000-10-31T02:33:44+03:00", FieldScripting.formatDatetimeoffset(data, false), "datetimeoffset no fractional seconds");

            baseData = baseData.AddTicks(1234567);
            data = baseData;
            Assert.AreEqual("'2000-10-31T02:33:44.1234567+03:00'", FieldScripting.valueAsTSQLLiteral(data, fieldInfo), "datetimeoffset fractional seconds");
            Assert.AreEqual("2000-10-31T02:33:44.1234567+03:00", FieldScripting.formatDatetimeoffset(data, false), "datetimeoffset fractional seconds");
        }
Example #10
0
 public static void AddTicks(DateTimeOffset dateTimeOffset, long ticks, DateTimeOffset expected)
 {
     Assert.Equal(expected, dateTimeOffset.AddTicks(ticks));
 }
Example #11
0
        public void CanAddTicksAcrossDstTransition()
        {
            var tz = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
            var dto = new DateTimeOffset(2015, 3, 8, 1, 59, 59, 999, TimeSpan.FromHours(-8)).AddTicks(9999);
            var result = dto.AddTicks(1, tz);

            var expected = new DateTimeOffset(2015, 3, 8, 3, 0, 0, TimeSpan.FromHours(-7));
            Assert.Equal(expected, result);
            Assert.Equal(expected.Offset, result.Offset);
        }
        /// <summary>
        /// Parse the given string representation into a <see cref="DateTimeOffset"/> value.
        /// </summary>
        /// <param name="value">A string representation of a date time.</param>
        /// <returns>A <see cref="DateTimeOffset"/> value.</returns>
        public DateTimeOffset ParseDateTimeOffset(string value)
        {
            int year, month, day, hour, minute, second, offsetHours, offsetMinutes;
            long ticks;
            DateTimeKind dateTimeKind;

            GetDateTimeComponents(value, out year, out month, out day, out hour, out minute, out second, out ticks, out offsetHours, out offsetMinutes, out dateTimeKind);

            var offset = new TimeSpan(offsetHours, offsetMinutes, 0);
            var dateTimeOffset = new DateTimeOffset(year, month, day, hour, minute, second, offset);
            dateTimeOffset = dateTimeOffset.AddTicks(ticks);

            return dateTimeOffset;
        }
Example #13
0
        //// BUTTONCLICK HANDLERS ///////////////////////////////////////////////

        public DialogResult OKButton_Click(object sender, EventArgs e)
        {
            DialogResult dr = DialogResult.Cancel;
            if (ap.modified)
            {
                INCCDB.AcquireSelector sel = new INCCDB.AcquireSelector(det, ap.item_type, DateTime.Now);
                ap.MeasDateTime = sel.TimeStamp; ap.lm.TimeStamp = sel.TimeStamp;
                NC.App.DB.AcquireParametersMap().Add(sel, ap);  // it's a new one, not the existing one modified
                NC.App.DB.UpdateAcquireParams(ap, det.ListMode);
            }

            // The acquire is set to occur, build up the measurement state 
            AnalysisWizard.ResetMeasurement();
            Integ.BuildMeasurement(ap, det, mo);

            switch (ap.data_src)
            {
                case ConstructedSource.Live:             // set up the instrument list for the action controller
                    UIIntegration.Controller.file = false;  // make sure to use the DAQ controller, not the file controller
                    NC.App.AppContext.FileInput = null;  // reset the cmd line file input flag
                    if (det.ListMode)
                    {
                        // patch override lm.Interval with run_count_time from dialog
                        NC.App.Opstate.Measurement.AcquireState.lm.Interval = NC.App.Opstate.Measurement.AcquireState.run_count_time;

                        // Check NC.App.Opstate.Measurement.AnalysisParams for at least one VSR 
                        // If not present, inform and pop up the wizard
                        // If present, inform with new dialog, do not pop up the wizard
                        if (NC.App.Opstate.Measurement.AnalysisParams.HasMultiplicity())
                        {
                            dr = DialogResult.OK;
                        }
                        else
                        {
                            AnalysisWizard awl = new AnalysisWizard(AnalysisWizard.AWSteps.Step2B, ap, det);  // analyzers are created in here, placed on global measurement
                            dr = awl.ShowDialog();
                            if (dr == DialogResult.OK)
                            {
                                NC.App.DB.UpdateAcquireParams(ap); //update it again
                                NC.App.DB.UpdateDetector(det);
                            }
                        }

                        if (dr == DialogResult.OK)
                        {
                            // if ok, the analyzers are set up, so can kick it off now.
                            UIIntegration.Controller.ActivateDetector(det); 
                        }
                    }
                    else
                    {
                        SRInstrument sri = new SRInstrument(det);
                        sri.selected = true;
                        sri.Init(NC.App.Loggers.Logger(LMLoggers.AppSection.Data), NC.App.Loggers.Logger(LMLoggers.AppSection.Analysis));
                        if (!Instruments.All.Contains(sri))
                            Instruments.All.Add(sri); // add to global runtime list 
                        dr = DialogResult.OK;
                    }
                    break;
                case ConstructedSource.DB:
                    NC.App.AppContext.DBDataAssay = true;
                    UIIntegration.Controller.file = true;
                    IDDAcquireDBMeas dbdlg = new IDDAcquireDBMeas(this);
                    if (dbdlg.HasItems())
                    {
                        dr = dbdlg.ShowDialog();
                        if (dr == DialogResult.OK)
                        {
                            DateTimeOffset dto = dbdlg.measurementId.MeasDateTime;
                            DateTimeOffset cur = new DateTimeOffset(dto.Ticks, dto.Offset);
                            NC.App.Logger(NCCReporter.LMLoggers.AppSection.App).TraceEvent(NCCReporter.LogLevels.Info, 87654,
                                    "Using " + dto.ToString("MMM dd yyy HH:mm:ss.ff K"));

                            // get the cycles for the selected measurement from the database, and add them to the current measurement
                            CycleList cl = NC.App.DB.GetCycles(det, dbdlg.measurementId);
                            foreach(Cycle cycle in cl)  // add the necessary meta-data to the cycle identifier instance
                            {
                                cycle.UpdateDataSourceId(ap.data_src, det.Id.SRType, 
                                                    cur.AddTicks(cycle.TS.Ticks), det.Id.FileName);
                                cur = cycle.DataSourceId.dt;
                            }

                            NC.App.Opstate.Measurement.Add(cl);

                            // TODO: for Reanalysis, a full reconstruction of the measurement state based on the ResultsRec state and the method parameter map contents (for Calib and Verif)
                        }
                    }
                    else
                        MessageBox.Show("No items found in database matching these parameters", "WARNING");
                    break;
                case ConstructedSource.Manual:
                    UIIntegration.Controller.file = true;
                    NC.App.AppContext.DBDataAssay = true;
                    IDDManualDataEntry mdlg = new IDDManualDataEntry();
                    mdlg.AH = this;
                    dr = mdlg.ShowDialog();
                    if (dr == DialogResult.OK)
                    {
                        // the work is done in the dialog class
                    }
                    break;

                case ConstructedSource.CycleFile:
                    NC.App.AppContext.TestDataFileAssay = true;
                    UIIntegration.Controller.file = true;
                    dr = UIIntegration.GetUsersFile("Select a test data (disk) file", NC.App.AppContext.FileInput, "INCC5 Test data (disk)", "dat");
                    break;
                case ConstructedSource.ReviewFile:
                    NC.App.AppContext.ReviewFileAssay = true;
                    UIIntegration.Controller.file = true;
                    dr = UIIntegration.GetUsersFile("Select an NCC file", NC.App.AppContext.FileInput, "INCC5 Review", "NCC");
                    break;
                case ConstructedSource.NCDFile:
                    NC.App.AppContext.NCDFileAssay = true;
                    UIIntegration.Controller.file = true;
                    if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                    {
                        AnalysisWizard aw = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                        dr = aw.ShowDialog(); // show LM-relevant acquire-style settings for modification or confirmation
                    }
                    else
                    {
                        dr = UIIntegration.GetUsersFilesFolder("Select NCD files or folder", NC.App.AppContext.FileInput, "LMMM NCD", "ncd");
                    }
                    break;
                case ConstructedSource.SortedPulseTextFile:
                    NC.App.AppContext.PulseFileAssay = true;
                    UIIntegration.Controller.file = true;
                    if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                    {
                        AnalysisWizard aw1 = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                        dr = aw1.ShowDialog();  // show LM-relevant acquire-style settings for modification or confirmation
                    }
                    else
                    {
                        dr = UIIntegration.GetUsersFilesFolder("Select pulse files or folder", NC.App.AppContext.FileInput, "pulse", "txt");
                    }
                    break;
                case ConstructedSource.PTRFile: 
                    NC.App.AppContext.PTRFileAssay = true;
                    UIIntegration.Controller.file = true;
                    if (NC.App.Opstate.Measurement.MeasOption == AssaySelector.MeasurementOption.unspecified)
                    {
                        AnalysisWizard aw2 = new AnalysisWizard(AnalysisWizard.AWSteps.Step2A, ap, det);
                        dr = aw2.ShowDialog();  // show LM-relevant acquire-style settings for modification or confirmation
                    }
                    else
                    {
                        dr = UIIntegration.GetUsersFilesFolder("Select PTR-32 files or folder", NC.App.AppContext.FileInput, "PTR-32", "bin", "chn");
                    }
                    break;
                case ConstructedSource.NILAFile:
                    NC.App.AppContext.NILAFileAssay = true;
                    UIIntegration.Controller.file = true;
                    dr = UIIntegration.GetUsersFilesFolder("Select NILA files or folder", NC.App.AppContext.FileInput, "MTS NILA", "dat");
                    //dr = DialogResult.Cancel;
                    break;
                default:
                    break;
            }
            return dr;
        }