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


C# Event.Copy方法代码示例

本文整理汇总了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;
        }
开发者ID:mcshaz,项目名称:SimPlanner,代码行数:57,代码来源:CreateCourseAppointment.cs

示例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;
 }
开发者ID:Aslai,项目名称:EE-Music-Bot,代码行数:32,代码来源:Program.cs


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