private void miEditEvent_Click(object sender, RoutedEventArgs e) { ContextMenu cm = ((MenuItem)sender).Parent as ContextMenu; ListBoxItem lbi = cm.PlacementTarget as ListBoxItem; if (lbi == null) { return; } Guid targetGuid = (lbi.DataContext as IEvent).GUID; EventCollection ec = EventCollection.GetDataBase(); if (ec == null) { throw new Exception("Event database is not avalible."); } IEvent evnt = ec.GetEvent(targetGuid); WindowEventSetting winEventSetting = new WindowEventSetting(); winEventSetting.Owner = Calendar.Owner; winEventSetting.UpdateEvent += OnRecievingUpdatedEvent; winEventSetting.WindowStartupLocation = WindowStartupLocation.CenterScreen; winEventSetting.ShowEventSetting(evnt, DisplayMode.Edit); winEventSetting.Show(); }
private void miShowInfo_Click(object sender, RoutedEventArgs e) { ContextMenu cm = ((MenuItem)sender).Parent as ContextMenu; ListBoxItem lbi = cm.PlacementTarget as ListBoxItem; if (lbi == null) { return; } Guid targetGuid = (lbi.DataContext as IEvent).GUID; EventCollection ec = EventCollection.GetDataBase(); if (ec == null) { throw new Exception("Event database is not avalible."); } IEvent evnt = ec.GetEvent(targetGuid); DayContentSelectionEvent(evnt, SelectedDayContentActions.ShowInfo); }