当前位置: 首页>>代码示例>>C#>>正文


C# DateTimeOffset.AddTicks方法代码示例

本文整理汇总了C#中DateTimeOffset.AddTicks方法的典型用法代码示例。如果您正苦于以下问题:C# DateTimeOffset.AddTicks方法的具体用法?C# DateTimeOffset.AddTicks怎么用?C# DateTimeOffset.AddTicks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateTimeOffset的用法示例。


在下文中一共展示了DateTimeOffset.AddTicks方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compare_Test2

 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);
 }
开发者ID:yar1k0v,项目名称:csharp-driver,代码行数:14,代码来源:TimeUuidTests.cs

示例2: Dump

        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");
        }
开发者ID:nodatime,项目名称:tzvalidate,代码行数:35,代码来源:Program.cs

示例3: FakeIt

 /// <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;
     };
 }
开发者ID:RichieYang,项目名称:Rebus,代码行数:13,代码来源:RebusTimeMachine.cs

示例4: ConvertToStorageType

 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;
 }
开发者ID:aries544,项目名称:eXpand,代码行数:13,代码来源:SqlDateTimeOverFlowValueConverter.cs

示例5: From_FromFixedDateTime_Tests

    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));
    }
开发者ID:jin29neci,项目名称:FluentDateTime,代码行数:15,代码来源:DateTimeOffsetTests.cs

示例6: ParseDateTimeOffset

        /// <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;
        }
开发者ID:QuickenLoans,项目名称:XSerializer,代码行数:33,代码来源:DefaultDateTimeHandler.cs

示例7: ToType57

        //[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;
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:80,代码来源:ToTypeTests.cs

示例8: ToType56

        //[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;
        }
开发者ID:jmhardison,项目名称:corefx,代码行数:59,代码来源:ToTypeTests.cs

示例9: DATETIMEOFFSET_Data_ScriptsCorrectly

        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");
        }
开发者ID:codedecay,项目名称:TSqlFlex,代码行数:13,代码来源:DataScriptingTests.cs

示例10: AddTicks

 public static void AddTicks(DateTimeOffset dateTimeOffset, long ticks, DateTimeOffset expected)
 {
     Assert.Equal(expected, dateTimeOffset.AddTicks(ticks));
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:4,代码来源:DateTimeOffsetTests.cs

示例11: CanAddTicksAcrossDstTransition

        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);
        }
开发者ID:kronic,项目名称:corefxlab,代码行数:10,代码来源:DateTimeOffsetTests.cs

示例12: ParseDateTimeOffset

        /// <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;
        }
开发者ID:JonOsment,项目名称:XSerializer,代码行数:19,代码来源:DefaultDateTimeHandler.cs

示例13: OKButton_Click

        //// 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)
                    {
//.........这里部分代码省略.........
开发者ID:tempbottle,项目名称:INCC6,代码行数:101,代码来源:AcquireHandlers.cs


注:本文中的DateTimeOffset.AddTicks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。