public Dictionary <TimeSpan, ICalendarItem> GetHourItems(ObservableCollection <KeyValuePair <DateTime, ICalendarItem> > list, DateTime date, int from, ICalendarItem item = null) { Dictionary <TimeSpan, ICalendarItem> tempList = new Dictionary <TimeSpan, ICalendarItem>(); foreach (KeyValuePair <DateTime, ICalendarItem> obj in list) { if (date.Date == obj.Key.Date && obj.Key.Hour == from) { TimeSpan ProperTime = ExistsInDictionary(tempList, obj.Key.TimeOfDay); if (item != null) { if (item.GetType() == typeof(ActivityContainer)) { tempList.Add(ProperTime, obj.Value); continue; } if (item.GetType() == obj.Value.GetType() && item.GetType() != typeof(Activity)) { tempList.Add(ProperTime, obj.Value); continue; } if (item.GetType() == typeof(Activity) && obj.Value.GetType() == typeof(Activity)) { if (((Activity)item).Id == ((Activity)obj.Value).Id) { tempList.Add(ProperTime, obj.Value); } } } else { tempList.Add(ProperTime, obj.Value); } } } return(tempList); }
public ObservableCollection <ICalendarItem> GetDateItems(ObservableCollection <KeyValuePair <DateTime, ICalendarItem> > list, DateTime date, ICalendarItem item = null) { ObservableCollection <ICalendarItem> tempList = new ObservableCollection <ICalendarItem>(); foreach (KeyValuePair <DateTime, ICalendarItem> obj in list) { if (obj.Key.Date == date.Date) { if (item != null) { if (item.GetType() == typeof(ActivityContainer)) { tempList.Add(obj.Value); continue; } if (item.GetType() == obj.Value.GetType() && item.GetType() != typeof(Activity)) { tempList.Add(obj.Value); continue; } if (item.GetType() == typeof(Activity) && obj.Value.GetType() == typeof(Activity)) { if (((Activity)item).Id == ((Activity)obj.Value).Id) { tempList.Add(obj.Value); } } } else { tempList.Add(obj.Value); } } } return(tempList); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { if (CurrentItem.GetType() == typeof(Activity)) { Activity tempItem = (Activity)CurrentItem; int row = 0; AddItemToGrid(ViewModel.Content["TYPE"].ToString(), tempItem.Title, row); row++; foreach (ActivityProperty obj in tempItem.Properties) { AddItemToGrid(obj.Name, tempItem.PropertyValues.FirstOrDefault(x => x.Key == obj.Property).Value, row); row++; } } else if (CurrentItem.GetType() == typeof(Notification)) { PropertyGrid.ColumnDefinitions.Clear(); PropertyGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(2, GridUnitType.Star) }); PropertyGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(3, GridUnitType.Star) }); Notification tempItem = (Notification)CurrentItem; AddItemToGrid(ViewModel.Content["TYPE"].ToString(), tempItem.Title, 0); AddItemToGrid(ViewModel.Content["ALARM_NAME"].ToString() + " " + ViewModel.Content["TYPE"].ToString().ToLower(), (tempItem.Primary ? ViewModel.Content["ALARM_PRIMARY"].ToString() : ViewModel.Content["ALARM_SECONDARY"].ToString()), 1); AddItemToGrid(ViewModel.Content["ALARM_TRIGGERTIME"].ToString(), tempItem.TriggerTime.ToString("dd-MM-yyyy HH:mm"), 2); if (!tempItem.Primary) { AddItemToGrid(ViewModel.Content["ALARM_TEXT"].ToString(), tempItem.Text, 3); } } }