Пример #1
0
    private void initialize(IEvent eventData) {
      _serverEventData = eventData;
      string bodyContent = string.Empty;
      if (eventData.Body != null)
        bodyContent = _serverEventData.Body.Content;

      _id = _serverEventData.Id;
      _subject = _serverEventData.Subject;
      _locationDisplayName = _serverEventData.Location.DisplayName;
      _start = (DateTimeOffset)_serverEventData.Start;
      _startTime = Start.ToLocalTime().TimeOfDay;
      _end = (DateTimeOffset)_serverEventData.End;
      _endTime = End.ToLocalTime().TimeOfDay;


      //If HTML, take text. Otherwise, use content as is
      string bodyType = _serverEventData.Body.ContentType.ToString();
      if (bodyType == "HTML") {
        bodyContent = Regex.Replace(bodyContent, "<[^>]*>", "");
        bodyContent = Regex.Replace(bodyContent, "\n", "");
        bodyContent = Regex.Replace(bodyContent, "\r", "");
      }
      _body = bodyContent;
      _attendees = _calenderOperations.BuildAttendeeList(_serverEventData.Attendees);

      this.IsNewOrDirty = false;

      this.SaveChangesCommand = new RelayCommand(ExecuteSaveChangesCommandAsync, CanSaveChanges);
      UpdateDisplayString();
    }
Пример #2
0
    public EventViewModel(string currentUserMail) {
      this.Subject = "New Event";
      this.Start = System.DateTime.Now;
      this.End = System.DateTime.Now;
      this.Id = string.Empty;
      this.StartTime = new TimeSpan(System.DateTime.Now.Hour, System.DateTime.Now.Minute, System.DateTime.Now.Second);
      this.EndTime = new TimeSpan(System.DateTime.Now.Hour, System.DateTime.Now.Minute, System.DateTime.Now.Second);

      this.Attendees = currentUserMail;

      this.IsNewOrDirty = true;
      this.SaveChangesCommand = new RelayCommand(ExecuteSaveChangesCommandAsync, CanSaveChanges);

    }