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(); }
private void initialize(IContact contactData) { _serverContactData = contactData; _id = _serverContactData.Id; _contactDisplayName = TidyValue(_serverContactData.DisplayName); _contactFileAs = TidyValue(_serverContactData.FileAs); _contactFirstName = TidyValue(_serverContactData.GivenName); _contactLastName = TidyValue(_serverContactData.Surname); _contactJobTitle = TidyValue(_serverContactData.JobTitle); if (_serverContactData.EmailAddresses[0] != null) _contactEmail = TidyValue(_serverContactData.EmailAddresses[0].Address); _contactWorkPhone = TidyValue(_serverContactData.BusinessPhones[0]); _contactMobilePhone = TidyValue(_serverContactData.MobilePhone1); this.IsNewOrDirty = false; this.SaveChangesCommand = new RelayCommand(ExecuteSaveChangesCommandAsync, CanSaveChanges); UpdateDisplayString(); }
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); }
public ContactItemViewModel() { this.Id = string.Empty; this._contactDisplayName = "New Contact"; this._contactFileAs = string.Empty; this._contactFirstName = string.Empty; this._contactLastName = string.Empty; this._contactJobTitle = string.Empty; this._contactEmail = string.Empty; this._contactWorkPhone = string.Empty; this._contactMobilePhone = string.Empty; this.SaveChangesCommand = new RelayCommand(ExecuteSaveChangesCommandAsync, CanSaveChanges); this.IsNewOrDirty = true; }