• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TimeOfDay类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TimeOfDay的典型用法代码示例。如果您正苦于以下问题:C# TimeOfDay类的具体用法?C# TimeOfDay怎么用?C# TimeOfDay使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TimeOfDay类属于命名空间,在下文中一共展示了TimeOfDay类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TimeOfDayChangedAction

 protected TimeOfDayChangedAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     v3dLayer = EditorManager.Project.Scene.MainLayer as V3DLayer;
       oldConfig = (TimeOfDay)info.GetValue("oldConfig", typeof(TimeOfDay));
       newConfig = (TimeOfDay)info.GetValue("newConfig", typeof(TimeOfDay));
 }
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:7,代码来源:TimeOfDayChangedAction.cs


示例2: GetOrderList

        public static string GetOrderList(List<int> listDishes, TimeOfDay tod)
        {
            var output = string.Empty;
            listDishes = listDishes.OrderBy(x => x).ToList();
            var last = -1;

            foreach (var dishType in listDishes)
            {
                if (dishType == last)
                    continue;
                last = dishType;

                Dish dish = rest.FindDish(tod, (DishType)dishType);
                if (dish == null)
                {
                    output += "error,";
                    continue;
                }

                var quantity = GetValidQuantity(listDishes, dish);
                if (quantity == -1)
                {
                    Console.WriteLine("Invalid quantity.");
                    break;
                }

                // Concatenating the output and adding the quantity if necessary
                output += quantity > 1 ? rest.FindFood(dish.FoodID).Name + "(x" + quantity + ")," : rest.FindFood(dish.FoodID).Name + ",";
            }

            return output;
        }
开发者ID:PHFernandes,项目名称:TechnicalPracticum,代码行数:32,代码来源:Program.cs


示例3: Filter

 public Filter(bool exclude, FieldIndex fieldIndex, TimeOfDay value, FilterTest test)
 {
     Exclude_ = exclude;
     FieldIndex_ = fieldIndex;
     Value_ = value.DayMinutes;
     Test_ = test;
 }
开发者ID:Jaren14,项目名称:unitimetable,代码行数:7,代码来源:Solver.Filter.cs


示例4: GetTimeBetween

        public static TimeSpan GetTimeBetween(TimeOfDay first, TimeOfDay next)
        {
            var times = new Dictionary<TimeOfDay, DateTime>
            {
                [TimeOfDay.Breakfast] = new DateTime(2015, 2, 1, MedicineWithDoses.BreakfastHour, 0, 0),
                [TimeOfDay.Lunch] = new DateTime(2015, 2, 1, MedicineWithDoses.LunchHour, 0, 0),
                [TimeOfDay.Dinner] = new DateTime(2015, 2, 1, MedicineWithDoses.DinnerHour, 0, 0)
            };

            var firstIdx = (int)first;
            var nextIdx = (int)next;

            if (firstIdx < nextIdx)
            {
                return times[next] - times[first];
            }
            else if (firstIdx > nextIdx)
            {
                return times[next] - times[first].DayBefore();
            }
            else
            {
                return TimeSpan.FromDays(1).Subtract(TimeSpan.FromSeconds(1));
            }



        }
开发者ID:geekpivot,项目名称:HealthClinic.biz,代码行数:28,代码来源:TimeOfDayHelper.cs


示例5: CanConstructTimeOfDayFrom12HoursAndMinutes

 public void CanConstructTimeOfDayFrom12HoursAndMinutes()
 {
     TimeOfDay time = new TimeOfDay(11, 59, Meridiem.PM);
     const long expected = 23 * TimeSpan.TicksPerHour +
                           59 * TimeSpan.TicksPerMinute;
     Assert.Equal(expected, time.Ticks);
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:7,代码来源:TimeOfDayConstructionTests.cs


示例6: Update

    // Update is called once per frame
    void Update()
    {
        sunMoonTransform[0].Rotate(new Vector3(_degreeRotation, 0, 0) * Time.deltaTime);
        //		if (moon_light.transform.position.y < 0) {
        //			moon_light.enabled = false;
        //			moon_spot_light.enabled = false;
        //		} else {
        //			moon_light.enabled = true;
        //			moon_spot_light.enabled = true;
        //		}
        //		if (sun_light.transform.position.y < 0) {
        //			sun_light.enabled = false;
        //			sun_spot_light.enabled = false;
        //		} else {
        //			sun_light.enabled = true;
        //			sun_spot_light.enabled = true;
        //		}

        _timeOfDay += Time.deltaTime;

        if (_timeOfDay > _dayCycleInSeconds) _timeOfDay -= _dayCycleInSeconds;

        if (_timeOfDay > sunRise &&
            _timeOfDay < sunSet &&
            RenderSettings.skybox.GetColor("_Tint")[3] < 1) {
            _tod = GameTime.TimeOfDay.SunRise;
            updateSkyBox();
        } else if (_timeOfDay > sunSet && RenderSettings.skybox.GetColor("_Tint")[3] > 0) {
            _tod = GameTime.TimeOfDay.SunSet;
            updateSkyBox();
        } else {
            _tod = GameTime.TimeOfDay.Idle;
        }
    }
开发者ID:jreidy,项目名称:CS248_Final_Project,代码行数:35,代码来源:GameTime.cs


示例7: Dish

 public Dish(int dishID, int foodID, DishType dishType, TimeOfDay timeOfDay)
 {
     DishID = dishID;
     FoodID = foodID;
     DishType = dishType;
     TimeOfDay = timeOfDay;
 }
开发者ID:PHFernandes,项目名称:TechnicalPracticum,代码行数:7,代码来源:Dish.cs


示例8: MultipleTypeCustomInstanceAnnotationsOnErrorShouldRoundtrip

        public void MultipleTypeCustomInstanceAnnotationsOnErrorShouldRoundtrip()
        {
            var originalInt = new KeyValuePair<string, ODataValue>("int.error", new ODataPrimitiveValue(1));
            var originalDouble = new KeyValuePair<string, ODataValue>("double.error", new ODataPrimitiveValue(double.NaN));
            DateTimeOffset dateTimeOffset = new DateTimeOffset(2012, 10, 10, 12, 12, 59, new TimeSpan());
            var originalDateTimeOffset = new KeyValuePair<string, ODataValue>("DateTimeOffset.error", new ODataPrimitiveValue(dateTimeOffset));
            Date date = new Date(2014, 12, 12);
            var originalDate = new KeyValuePair<string, ODataValue>("Date.error", new ODataPrimitiveValue(date));
            TimeOfDay time = new TimeOfDay(10, 12, 3, 9);
            var originaltime = new KeyValuePair<string, ODataValue>("TimeOfDay.error", new ODataPrimitiveValue(time));
            TimeSpan timeSpan = new TimeSpan(12345);
            var originalTimeSpan = new KeyValuePair<string, ODataValue>("TimeSpan.error", new ODataPrimitiveValue(timeSpan));
            GeographyPoint geographyPoint = GeographyPoint.Create(32.0, -100.0);
            var originalGeography = new KeyValuePair<string, ODataValue>("Geography.error", new ODataPrimitiveValue(geographyPoint));
            var originalNull = new KeyValuePair<string, ODataValue>("null.error", new ODataNullValue());

            var complexValue = new ODataComplexValue
            {
                TypeName = "ns.ErrorDetails",
                Properties = new[] { new ODataProperty { Name = "ErrorDetailName", Value = "inner property value" } }
            };
            var originalComplex = new KeyValuePair<string, ODataValue>("sample.error", complexValue);

            var error = this.WriteThenReadErrorWithInstanceAnnotation(originalInt, originalDouble, originalDate, originalDateTimeOffset, originaltime, originalTimeSpan, originalGeography, originalNull, originalComplex);

            var annotation = RunBasicVerificationAndGetAnnotationValue("int.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(1);

            annotation = RunBasicVerificationAndGetAnnotationValue("double.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(double.NaN);

            annotation = RunBasicVerificationAndGetAnnotationValue("Date.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(date);

            annotation = RunBasicVerificationAndGetAnnotationValue("DateTimeOffset.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(dateTimeOffset);

            annotation = RunBasicVerificationAndGetAnnotationValue("TimeOfDay.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(time);

            annotation = RunBasicVerificationAndGetAnnotationValue("TimeSpan.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(timeSpan);

            annotation = RunBasicVerificationAndGetAnnotationValue("Geography.error", error);
            annotation.Should().BeOfType<ODataPrimitiveValue>();
            annotation.As<ODataPrimitiveValue>().Value.Should().Be(geographyPoint);

            annotation = RunBasicVerificationAndGetAnnotationValue("null.error", error);
            annotation.Should().BeOfType<ODataNullValue>();

            annotation = RunBasicVerificationAndGetAnnotationValue("sample.error", error);
            annotation.Should().BeOfType<ODataComplexValue>();
            annotation.As<ODataComplexValue>().Properties.First().Value.Should().Be("inner property value");
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:60,代码来源:CustomInstanceAnnotationRoundtripJsonLightTests.cs


示例9: CanConstructTimeOfDayFrom24HoursAndMinutesAndSeconds

 public void CanConstructTimeOfDayFrom24HoursAndMinutesAndSeconds()
 {
     TimeOfDay time = new TimeOfDay(23, 59, 59);
     const long expected = 23 * TimeSpan.TicksPerHour +
                           59 * TimeSpan.TicksPerMinute +
                           59 * TimeSpan.TicksPerSecond;
     Assert.Equal(expected, time.Ticks);
 }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:8,代码来源:TimeOfDayConstructionTests.cs


示例10: GetTimeOfDayState

        /// <summary>
        /// Looks at a supplied time of day and figures out what TimeOfDayState needs to be returned that matches the time of day.
        /// </summary>
        /// <param name="currentTime">The current time.</param>
        /// <returns>
        /// Returns an instance of ITimeOfDayState that represents the current time of day in the game.
        /// </returns>
        internal TimeOfDayState GetTimeOfDayState(DateTime? currentTime = null)
        {
            TimeOfDay time = new TimeOfDay();
            time.Hour = currentTime.Value.Hour;
            time.Minute = currentTime.Value.Minute;

            return this.GetTimeOfDayState(time);
        }
开发者ID:ramseur,项目名称:MudDesigner,代码行数:15,代码来源:TimeOfDayStateManager.cs


示例11: Session

        /// <summary>
        /// Initializes a new instance of the <see cref="Session" /> class.
        /// </summary>
        /// <param name="timeOfDay">The time of day.</param>
        public Session(TimeOfDay timeOfDay)
        {
            this._talks = new List<Talk>();
            this._timeOfDay = timeOfDay;

            // Total possible duration can be 3 hrs if it is a morning session; 4 hrs otherwise
            this.totalPossibleDuration = timeOfDay == TimeOfDay.Morning ? 60 * 3 : 60 * 4;
        }
开发者ID:prashu2705,项目名称:ConfereneTracker,代码行数:12,代码来源:Session.cs


示例12: CanAddPositiveTime

        public void CanAddPositiveTime()
        {
            TimeOfDay startTime = new TimeOfDay(12, 0);
            TimeOfDay actual = startTime.AddHours(13);
            TimeOfDay expected = new TimeOfDay(1, 0);

            Assert.Equal(expected, actual);
        }
开发者ID:kronic,项目名称:corefxlab,代码行数:8,代码来源:TimeOfDayMathTests.cs


示例13: CanCalculateDuration_OverMidnight

        public void CanCalculateDuration_OverMidnight()
        {
            TimeOfDay startTime = new TimeOfDay(23, 0);
            TimeOfDay endTime = new TimeOfDay(1, 0);

            TimeSpan duration = TimeOfDay.CalculateDuration(startTime, endTime);
            Assert.Equal(TimeSpan.FromHours(2), duration);
        }
开发者ID:kronic,项目名称:corefxlab,代码行数:8,代码来源:TimeOfDayMathTests.cs


示例14: FindDish

        public Dish FindDish(TimeOfDay timeOfDay, DishType dishType)
        {
            foreach (var dish in dishList)
                if (dish.TimeOfDay == timeOfDay && dish.DishType == dishType)
                    return dish;

            return null;
        }
开发者ID:PHFernandes,项目名称:TechnicalPracticum,代码行数:8,代码来源:Restaurant.cs


示例15: CanCalculateDuration_Normal

        public void CanCalculateDuration_Normal()
        {
            TimeOfDay startTime = new TimeOfDay(10, 0);
            TimeOfDay endTime = new TimeOfDay(12, 0);

            TimeSpan duration = endTime - startTime;
            Assert.Equal(TimeSpan.FromHours(2), duration);
        }
开发者ID:kronic,项目名称:corefxlab,代码行数:8,代码来源:TimeOfDayMathTests.cs


示例16: TimeChanged

 // Handle switching for the time of day
 void TimeChanged(TimeOfDay newTime)
 {
     Flip ();
     if (newTime == ForceRightWhen) {
         forceVec= force;
     } else {
         forceVec= -force;
     }
 }
开发者ID:JeremyAstolfi,项目名称:time-platformer,代码行数:10,代码来源:WindScript.cs


示例17: CanCompareTimes_Object_Equal

        public void CanCompareTimes_Object_Equal()
        {
            var t1 = new TimeOfDay(0, 0);
            var t2 = new TimeOfDay(0, 0);

            var c = t1.CompareTo((object)t2);

            Assert.Equal(0, c);
        }
开发者ID:kronic,项目名称:corefxlab,代码行数:9,代码来源:TimeOfDayComparisonTests.cs


示例18: CanCompareTimes_Static_After

        public void CanCompareTimes_Static_After()
        {
            var t1 = new TimeOfDay(0, 1);
            var t2 = new TimeOfDay(0, 0);

            var c = TimeOfDay.Compare(t1, t2);

            Assert.Equal(1, c);
        }
开发者ID:kronic,项目名称:corefxlab,代码行数:9,代码来源:TimeOfDayComparisonTests.cs


示例19: CanGetDateTimeFromTimeOnDate

        public void CanGetDateTimeFromTimeOnDate()
        {
            Date date = new Date(2000, 12, 31);
            TimeOfDay time = new TimeOfDay(23, 59, 59);
            DateTime dt = time.On(date);

            DateTime expected = new DateTime(2000, 12, 31, 23, 59, 59);
            Assert.Equal(expected, dt);
        }
开发者ID:GrimDerp,项目名称:corefxlab,代码行数:9,代码来源:TimeOfDayPropertyTests.cs


示例20: Schedule

 public void Schedule(string jobName, IJob job, TimeSpan interval, TimeOfDay startTime, IDictionary<string, string> jobData)
 {
     lock (_lock)
     {
         var schedule = new Schedule(Instance, jobName, job, interval, startTime, jobData);
         _schedules.Add(jobName, schedule);
         schedule.Start();
     }
 }
开发者ID:Kooboo,项目名称:Ecommerce,代码行数:9,代码来源:Scheduler.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TimeOutState类代码示例发布时间:2022-05-24
下一篇:
C# TimeInterval类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap