本文整理汇总了C#中Event.Copy方法的典型用法代码示例。如果您正苦于以下问题:C# Event.Copy方法的具体用法?C# Event.Copy怎么用?C# Event.Copy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event.Copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCourseAppointment
public static Calendar CreateCourseAppointment(Course course, IIdentity currentUser)
{
TimeZoneInfo tzi = course.Department.Institution.TimeZone;
var currentCal = CreateCal(course);
// Create the event, and add it to the iCalendar
//
Event courseEvt = new Event
{
Class = "PRIVATE",
Created = new CalDateTime(course.CreatedUtc),
LastModified = new CalDateTime(course.CourseDatesLastModified),
Sequence = course.EmailSequence,
Transparency = TransparencyType.Opaque,
Status = course.Cancelled ? EventStatus.Cancelled : EventStatus.Confirmed,
Uid = "course" + course.Id.ToString(),
Priority = 5,
Location = course.Room.ShortDescription,
Attendees = course.CourseParticipants.Select(MapCourseParticipantToAttendee).ToList(),
Summary = course.Department.Abbreviation + " " + course.CourseFormat.CourseType.Abbreviation,
IsAllDay = false,
Description = course.Department.Name + " " + course.CourseFormat.CourseType.Description,
GeographicLocation = GetGeoLocation(course),
Organizer = GetOrganizer(course),
//DtStamp = - this is probably being inserted - check
};
System.Diagnostics.Debug.WriteLine(courseEvt.Organizer);
foreach (var cd in course.AllDays().Take(course.CourseFormat.DaysDuration))
{
var dayEvt = courseEvt.Copy<Event>();
dayEvt.Start = new CalDateTime(course.StartLocal, tzi.Id);
dayEvt.Description += " - " + course.StartLocal.ToString("g");
dayEvt.Duration = TimeSpan.FromMinutes(cd.DurationMins);
if (course.CourseFormat.DaysDuration > 1)
{
string dayNo = $" (day {cd.Day})";
dayEvt.Summary += dayNo;
dayEvt.Description += dayNo;
}
currentCal.Events.Add(dayEvt);
}
// Create a serialization context and serializer factory.
// These will be used to build the serializer for our object.
//set alarm
Alarm alarm = new Alarm
{
Action = AlarmAction.Display,
Summary = course.Department.Abbreviation + ' ' + course.CourseFormat.CourseType.Abbreviation,
Trigger = new Trigger(TimeSpan.FromHours(-1))
};
// Add the alarm to the event
courseEvt.Alarms.Add(alarm);
return currentCal;
}
示例2: NextEvent
//Iterate over all the tracks to find the next event that should be dealt with.
public Event NextEvent()
{
long newTime = 0x7FFFFFFF;
Event ret = new Event ();
Track whichTrack = new Track ();
int trk = 0;
foreach (Track t in MyTracks) {
Event e = t.GetNext ();
if (e.Valid && e.Time < newTime && e.Time >= OldTime ) {
ret = e;
whichTrack = t;
newTime = e.Time;
}
if (!e.Valid) {
valids [trk] = false;
}
if (e.Valid && !valids [trk]) {
Console.WriteLine ("Wow!");
}
++trk;
}
if (ret.Status != 0) {
ret = ret.Copy ();
ret.Delay = ret.Time - OldTime;
OldTime = ret.Time;
} else {
IsFinished = true;
}
whichTrack.Consume ();
return ret;
}