private void listViewDormBook_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            BookDorm    dormB       = listViewDormBook.SelectedItem as BookDorm;
            Dorm        dorm        = DormDatabase.Get(dormB.IdDorm);
            MainControl mainControl = (MainControl)Window.GetWindow(this);

            mainControl.MainHomeLayout.Children.Clear();
            TransitioningContentSlide.OnApplyTemplate();
            mainControl.MainHomeLayout.VerticalAlignment   = VerticalAlignment.Top;
            mainControl.MainHomeLayout.HorizontalAlignment = HorizontalAlignment.Left;
            mainControl.MainHomeLayout.Width  = 1150;
            mainControl.MainHomeLayout.Height = 720;
            mainControl.MainHomeLayout.Children.Add(new ShowDorm(dorm, BookDatabase.GetOwnerByIdDorm(dorm.Id), 2));
        }
Exemplo n.º 2
0
        private void btnCanel_Click(object sender, RoutedEventArgs e)
        {
            Button           button      = sender as Button;
            BookDorm         dormB       = button.DataContext as BookDorm;
            Dorm             dorm        = DormDatabase.Get(dormB.IdDorm);
            MainControl      mainControl = (MainControl)Window.GetWindow(this);
            MessageBoxResult result      = MessageBox.Show("Would you like to cancel booking this dorm?", "Notify", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                if (BookDatabase.DeleteDormWhenBookUser(mainControl.user.Email, dorm.Id))
                {
                    mainControl.MainHomeLayout.Children.Clear();
                    mainControl.MainHomeLayout.VerticalAlignment   = VerticalAlignment.Top;
                    mainControl.MainHomeLayout.HorizontalAlignment = HorizontalAlignment.Left;
                    mainControl.MainHomeLayout.Width  = 1150;
                    mainControl.MainHomeLayout.Height = 720;
                    mainControl.MainHomeLayout.Children.Add(new MyDorm(mainControl.user));
                }
                break;
            }
        }