本文整理汇总了C#中DayOfWeek类的典型用法代码示例。如果您正苦于以下问题:C# DayOfWeek类的具体用法?C# DayOfWeek怎么用?C# DayOfWeek使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DayOfWeek类属于命名空间,在下文中一共展示了DayOfWeek类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DaysTill
/// <summary>
/// Determines the number of days from one DayOfWeek till the next.
/// </summary>
/// <param name="self">the starting DayOfWeek</param>
/// <param name="next">The ending DayOfWeek</param>
/// <returns>the number of days from <paramref name="self"/> to <paramref name="next"/></returns>
/// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not
/// <see cref="DayOfWeekExtensions.InRange"/></exception>
/// <example>
/// Debug.Assert(DayOfWeek.Monday.DaysTill(DayOfWeek.Tuesday) == 1);
/// </example>
public static int DaysTill(this DayOfWeek self, DayOfWeek next)
{
self.CheckRange();
next.CheckRange();
return DaysBetween((int)next, (int)self);
}
示例2: IsWorkingDay
public bool IsWorkingDay(DayOfWeek dayOfWeek)
{
if (dayOfWeek == DayOfWeek.Friday || dayOfWeek == DayOfWeek.Saturday) {
return false;
}
return true;
}
示例3: FirstDayOfWeekInMonth
/// <summary>
/// Returns the first day of week with in the month.
/// </summary>
/// <param name="obj">DateTime Base, from where the calculation will be preformed.</param>
/// <param name="dow">What day of week to find the first one of in the month.</param>
/// <returns>Returns DateTime object that represents the first day of week with in the month.</returns>
public static DateTime FirstDayOfWeekInMonth(this DateTime obj, DayOfWeek dow)
{
var firstDay = new DateTime(obj.Year, obj.Month, 1);
int diff = firstDay.DayOfWeek - dow;
if (diff > 0) diff -= 7;
return firstDay.AddDays(diff * -1);
}
示例4: GetNextDay
public static DayOfWeek GetNextDay(DayOfWeek currentDay)
{
if ((int)currentDay == 6)
return (DayOfWeek)0;
return (DayOfWeek)(currentDay + 1);
}
示例5: DaysSince
/// <summary>
/// Determines the number of days since one DayOfWeek since the previous.
/// </summary>
/// <param name="self">the starting DayOfWeek</param>
/// <param name="prev">The previous DayOfWeek</param>
/// <returns>the number of days since <paramref name="self"/> to <paramref name="prev"/></returns>
/// <exception cref="ArgumentOutOfRangeException">If either DayOfWeek is not
/// <see cref="DayOfWeekExtensions.InRange"/></exception>
/// <example>
/// Debug.Assert(DayOfWeek.Tuesday.DaysSince(DayOfWeek.Monday) == 1);
/// </example>
public static int DaysSince(this DayOfWeek self, DayOfWeek prev)
{
self.CheckRange();
prev.CheckRange();
return DaysBetween((int)self, (int)prev);
}
示例6: ImeDana
static string ImeDana(DayOfWeek danUTjednu)
{
switch (danUTjednu)
{
case DayOfWeek.Monday:
return "ponedjeljak";
case DayOfWeek.Tuesday:
return "utorak";
case DayOfWeek.Wednesday:
return "srijeda";
case DayOfWeek.Thursday:
return "četvrtak";
case DayOfWeek.Friday:
return "petak";
case DayOfWeek.Saturday:
return "subota";
case DayOfWeek.Sunday:
return "nedjelja";
// Dopisati grane case za svaki dan u tjednu (DayOfWeek.Tuesday = Utorak, itd.)
default:
return "Neispravan dan u tjednu";
}
}
示例7:
public TimelineModel this[DayOfWeek i]
{
get
{
return Days[(int)i];
}
}
示例8: ConvertFirstDayToNumber
/// <summary>
/// Convert starting day of week from enum to number - passed to calendar jquery control.
/// </summary>
/// <param name="name">Day name</param>
protected int ConvertFirstDayToNumber(DayOfWeek name)
{
switch (name)
{
case DayOfWeek.Monday:
return 1;
case DayOfWeek.Tuesday:
return 2;
case DayOfWeek.Wednesday:
return 3;
case DayOfWeek.Thursday:
return 4;
case DayOfWeek.Friday:
return 5;
case DayOfWeek.Saturday:
return 6;
default:
return 0;
}
}
示例9: LocationWorkHour
/// <summary>
/// Initializes a new instance of the <see cref="LocationWorkHour"/> class.
/// </summary>
/// <param name="dayOfWeek">The day of week.</param>
/// <param name="workHourTimeRange">The work hour time range.</param>
public LocationWorkHour(DayOfWeek dayOfWeek, TimeRange workHourTimeRange)
{
Check.IsNotNull(dayOfWeek, () => DayOfWeek);
_dayOfWeek = dayOfWeek;
_workHourTimeRange = workHourTimeRange;
}
示例10: MonthView
public MonthView()
{
SetStyle(ControlStyles.Opaque, true);
DoubleBuffered = true;
_dayNamesFormat = "ddd";
_monthTitleFormat = "MMMM yyyy";
_selectionMode = MonthViewSelection.Manual;
_workWeekStart = DayOfWeek.Monday;
_workWeekEnd = DayOfWeek.Friday;
_weekStart = DayOfWeek.Sunday;
_dayNamesVisible = true;
_dayNamesLength = 2;
_viewStart = DateTime.Now;
_itemPadding = new Padding(2);
_monthTitleColor = SystemColors.ActiveCaption;
_monthTitleColorInactive = SystemColors.InactiveCaption;
_monthTitleTextColor = SystemColors.ActiveCaptionText;
_monthTitleTextColorInactive = SystemColors.InactiveCaptionText;
_dayBackgroundColor = Color.Empty;
_daySelectedBackgroundColor = SystemColors.Highlight;
_dayTextColor = SystemColors.WindowText;
_daySelectedTextColor = SystemColors.HighlightText;
_arrowsColor = SystemColors.Window;
_arrowsSelectedColor = Color.Gold;
_dayGrayedText = SystemColors.GrayText;
_todayBorderColor = Color.Maroon;
UpdateMonthSize();
UpdateMonths();
}
示例11: CalendarHighlightRange
/// <summary>
/// Creates a new range with the specified information
/// </summary>
/// <param name="day"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
public CalendarHighlightRange(DayOfWeek day, TimeSpan startTime, TimeSpan endTime)
: this()
{
_dayOfWeek = day;
_startTime = startTime;
_endTime = endTime;
}
示例12: TimeCondition
internal TimeCondition(ValueType valueType, CounterType counter, uint value, DayOfWeek dayOfWeek)
{
ValueType = valueType;
CounterType = counter;
Value = value;
DayOfWeek = dayOfWeek;
}
示例13: DayOfWeekAnnualReccurance
public DayOfWeekAnnualReccurance(DayOfWeek dayOfWeek, WeekOfMonth week, Month month, bool substituteWeekend = true)
: base(substituteWeekend)
{
DayOfWeek = dayOfWeek;
Week = week;
Month = month;
}
示例14: TimeSlot
public TimeSlot(DayOfWeek dayOfWeek, int p1, int p2)
{
// TODO: Complete member initialization
this.dayOfWeek = dayOfWeek;
this.from = p1;
this.to = p2;
}
示例15: DayToUint
public static uint DayToUint(DayOfWeek day)
{
for (int i = 0; i < days.Length; i++)
if (days[i] == day)
return (uint)i;
return 0;
}