public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { try { if (value == null || parameter == null) { return(false); } var isValid = (bool)value; var parameterServiceType = (CalendarEntryOptionsEnum)Enum.Parse(typeof(CalendarEntryOptionsEnum), parameter.ToString()); if (isValid) { return(target | parameterServiceType); } if (parameterServiceType == CalendarEntryOptionsEnum.Attendees) { target &= ~CalendarEntryOptionsEnum.AttendeesToDescription; } return(target &= ~parameterServiceType); } catch (Exception) { } return(CalendarEntryOptionsEnum.None); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var mask = (CalendarEntryOptionsEnum)parameter; target = (CalendarEntryOptionsEnum)value; return((mask & target) != 0); }
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { try { if (value == null || parameter == null) { return false; } var isValid = (bool)value; var parameterServiceType = (CalendarEntryOptionsEnum)Enum.Parse(typeof(CalendarEntryOptionsEnum), parameter.ToString()); if (isValid) { return target | parameterServiceType; } if (parameterServiceType == CalendarEntryOptionsEnum.Attendees) { target &= ~CalendarEntryOptionsEnum.AttendeesToDescription; } return target &= ~parameterServiceType; } catch (Exception) { } return CalendarEntryOptionsEnum.None; }
public static bool CopyDetail(this Appointment appointment, Appointment otherAppointment, CalendarEntryOptionsEnum calendarEntryOptions) { //Copy basic information appointment.OldStartTime = appointment.StartTime; appointment.StartTime = otherAppointment.StartTime; appointment.EndTime = otherAppointment.EndTime; appointment.Subject = otherAppointment.Subject; appointment.AllDayEvent = otherAppointment.AllDayEvent; appointment.Location = otherAppointment.Location; appointment.IsRecurring = otherAppointment.IsRecurring; //Copy status appointment.BusyStatus = otherAppointment.BusyStatus; appointment.Privacy = otherAppointment.Privacy; appointment.MeetingStatus = otherAppointment.MeetingStatus; if (calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Description)) { appointment.Description = otherAppointment.ParseDescription(); } if (calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Attendees) && !calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.AttendeesToDescription)) { appointment.RequiredAttendees = otherAppointment.RequiredAttendees.Select(t => t).ToList(); appointment.OptionalAttendees = otherAppointment.OptionalAttendees.Select(t => t).ToList(); appointment.Organizer = otherAppointment.Organizer; } if (calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Reminders)) { appointment.ReminderSet = otherAppointment.ReminderSet; appointment.ReminderMinutesBeforeStart = otherAppointment.ReminderMinutesBeforeStart; } return(true); }
public static bool CopyDetail(this Appointment appointment, Appointment otherAppointment, CalendarEntryOptionsEnum calendarEntryOptions) { //Copy basic information appointment.OldStartTime = appointment.StartTime; appointment.StartTime = otherAppointment.StartTime; appointment.EndTime = otherAppointment.EndTime; appointment.Subject = otherAppointment.Subject; appointment.AllDayEvent = otherAppointment.AllDayEvent; appointment.Location = otherAppointment.Location; appointment.IsRecurring = otherAppointment.IsRecurring; //Copy status appointment.BusyStatus = otherAppointment.BusyStatus; appointment.Privacy = otherAppointment.Privacy; appointment.MeetingStatus = otherAppointment.MeetingStatus; if (calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Description)) { appointment.Description = otherAppointment.ParseDescription(); } if (calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Attendees) && !calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.AttendeesToDescription)) { appointment.RequiredAttendees = otherAppointment.RequiredAttendees.Select(t => t).ToList(); appointment.OptionalAttendees = otherAppointment.OptionalAttendees.Select(t => t).ToList(); appointment.Organizer = otherAppointment.Organizer; } if (calendarEntryOptions.HasFlag(CalendarEntryOptionsEnum.Reminders)) { appointment.ReminderSet = otherAppointment.ReminderSet; appointment.ReminderMinutesBeforeStart = otherAppointment.ReminderMinutesBeforeStart; } return true; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { CalendarEntryOptionsEnum mask = (CalendarEntryOptionsEnum)parameter; this.target = (CalendarEntryOptionsEnum)value; return ((mask & this.target) != 0); }