protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); if (e.NavigationMode == NavigationMode.Back) { return; } if (!(e.Parameter is IEditorPageParameter)) { throw new NotSupportedException("Parameter is not supported"); } if (e.Parameter is NewCategoryParameter) { var parameter = (e.Parameter as NewCategoryParameter); DeleteButton.Visibility = Visibility.Collapsed; if (parameter.Category is GeneralCategory) { DatePicker.Date = (parameter.Category as GeneralCategory).Date; } ViewModel = new CategoryDetailViewModel(parameter.Category); } else { var parameter = (e.Parameter as EditCategoryParameter); DeleteButton.Visibility = Visibility.Visible; if (parameter.CategoryType == typeof(GeneralCategory)) { var category = DBContext.GeneralCategories .Include(c => c.CategoryContacts) .ThenInclude(cc => cc.Contact) .Single(s => s.ID == parameter.ID); DatePicker.Date = category.Date.Date; ViewModel = new CategoryDetailViewModel(category); } else { var category = DBContext.BirthdayCategories .Include(c => c.CategoryContacts) .ThenInclude(cc => cc.Contact) .Single(s => s.ID == parameter.ID); ViewModel = new CategoryDetailViewModel(category); } } MessageFrame.Navigate(typeof(MessageEditorPage), ViewModel); }
private void listConversations_SelectionChanged(object sender, SelectionChangedEventArgs e) { var item = (ListBox)sender; friendList = (ConversationsModel)item.SelectedItem; if (friendList != null) { if (MessageFrame.CanGoBack) { MessageFrame.GoBack(); MessageFrame.Navigate(typeof(HistoryPage), friendList, new DrillInNavigationTransitionInfo()); } else { MessageFrame.Navigate(typeof(HistoryPage), friendList, new DrillInNavigationTransitionInfo()); } } }