Beispiel #1
0
        public override void Initialize()
        {
            selectedLocations = new List <Location>();
            selectedDateRange = null;
            selectedType      = null;

            double itemsSpacing = 150;

            //set canvas background
            canvas.Background = new SolidColorBrush(Color.FromRgb(239, 239, 239));

            //creates room type combobox
            ComboBox roomTypesComboBox = new ComboBox
            {
                Width  = 200,
                Height = 30,
            };
            List <RoomType> roomTypes = DataModels.GetInstance().GetAllRoomTypes();

            roomTypesComboBox.ItemsSource       = roomTypes;
            roomTypesComboBox.SelectionChanged += ComboBox_SelectionChanged;
            if (roomTypes.Count > 0)
            {
                roomTypesComboBox.SelectedIndex = 0;
            }
            Canvas.SetLeft(roomTypesComboBox, 3 * itemsSpacing + 500);
            Canvas.SetTop(roomTypesComboBox, canvas.Height / 4);
            canvas.Children.Add(roomTypesComboBox);

            //creates booking range calendar
            Calendar bookingCalendar = new Calendar
            {
                SelectionMode = CalendarSelectionMode.SingleRange
            };

            selectedDateRange = new CalendarDateRange(DateTime.Today, DateTime.Today);
            bookingCalendar.SelectedDatesChanged += Calander_SelectedDatesChanged;
            Canvas.SetLeft(bookingCalendar, 2 * itemsSpacing + roomTypesComboBox.Width + 40);
            Canvas.SetTop(bookingCalendar, canvas.Height / 4);
            canvas.Children.Add(bookingCalendar);

            //creates locations check boxes
            Expander locationsExpander = new Expander
            {
                Width  = 160,
                Height = 200,
                Header = "Locations"
            };
            ScrollViewer locationsScrollViewer = new ScrollViewer();
            StackPanel   locationsStackPanel   = new StackPanel();

            locationsExpander.Content     = locationsScrollViewer;
            locationsScrollViewer.Content = locationsStackPanel;
            List <Location> locations = DataModels.GetInstance().GetAllLocations();

            foreach (Location location in locations)
            {
                CheckBox locationCheckBox = new CheckBox {
                    Content = location, FontSize = 20
                };
                locationCheckBox.Checked   += CheckBox_Checked;
                locationCheckBox.Unchecked += CheckBox_Unchecked;
                locationsStackPanel.Children.Add(locationCheckBox);
            }
            Canvas.SetLeft(locationsExpander, itemsSpacing);
            Canvas.SetTop(locationsExpander, canvas.Height / 4);
            canvas.Children.Add(locationsExpander);

            Button searchButton = FrontEndHelper.CreateButton(150, 60, "Search");

            searchButton.Click += FrontEndHelper.GetMainWindow().SearchButton_Click;
            Canvas.SetLeft(searchButton, canvas.Width / 2 - 100);
            Canvas.SetBottom(searchButton, canvas.Height / 6);
            canvas.Children.Add(searchButton);
        }
Beispiel #2
0
        public override void Initialize()
        {
            userName         = "";
            name             = "";
            email            = "";
            password         = "";
            creditCardSerial = "";
            creditCardCVV    = "";
            expirationDate   = new DateTime();

            double textBoxWidth = 300;
            double labelWdith   = 200;

            StackPanel signupDataStackPanel = new StackPanel
            {
                Margin = new Thickness(0.3 * canvas.Width, 0.05 * canvas.Height, 0, 0)
            };

            canvas.Children.Add(signupDataStackPanel);

            //set user name
            Grid userNameGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } }
            };

            Label userNameLabel = new Label {
                Content = "User Name : ", FontSize = 22
            };

            Grid.SetColumn(userNameLabel, 0);
            userNameGrid.Children.Add(userNameLabel);

            TextBox userNameTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            userNameTextBox.TextChanged += UserNameTextBox_TextChanged;
            Grid.SetColumn(userNameTextBox, 1);
            userNameGrid.Children.Add(userNameTextBox);

            signupDataStackPanel.Children.Add(userNameGrid);

            //set name
            Grid nameGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label nameLabel = new Label {
                Content = "Name : ", FontSize = 22
            };

            Grid.SetColumn(nameLabel, 0);
            nameGrid.Children.Add(nameLabel);

            TextBox nameTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            nameTextBox.TextChanged += NameTextBox_TextChanged;
            Grid.SetColumn(nameTextBox, 1);
            nameGrid.Children.Add(nameTextBox);

            signupDataStackPanel.Children.Add(nameGrid);

            //set email
            Grid emailGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label emailLabel = new Label {
                Content = "Email : ", FontSize = 22
            };

            Grid.SetColumn(emailLabel, 0);
            emailGrid.Children.Add(emailLabel);

            TextBox emailTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            emailTextBox.TextChanged += EmailTextBox_TextChanged;
            Grid.SetColumn(emailTextBox, 1);
            emailGrid.Children.Add(emailTextBox);

            signupDataStackPanel.Children.Add(emailGrid);

            //set password
            Grid passwordGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label passwordLabel = new Label
            {
                Content  = "Password : "******"Credit Card Serial : ", FontSize = 22
            };

            Grid.SetColumn(creditCardSerialLabel, 0);
            creditCardSerialGrid.Children.Add(creditCardSerialLabel);

            TextBox creditCardSerialTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            creditCardSerialTextBox.TextChanged += CreditCardSerialTextBox_TextChanged;
            Grid.SetColumn(creditCardSerialTextBox, 1);
            creditCardSerialGrid.Children.Add(creditCardSerialTextBox);

            signupDataStackPanel.Children.Add(creditCardSerialGrid);

            //set credit card cvv
            Grid creditCardCVVGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label creditCardCVVLabel = new Label {
                Content = "Credit Card CVV : ", FontSize = 22
            };

            Grid.SetColumn(creditCardCVVLabel, 0);
            creditCardCVVGrid.Children.Add(creditCardCVVLabel);

            TextBox creditCardCVVTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            creditCardCVVTextBox.TextChanged += CreditCardCVVTextBox_TextChanged;
            Grid.SetColumn(creditCardCVVTextBox, 1);
            creditCardCVVGrid.Children.Add(creditCardCVVTextBox);

            signupDataStackPanel.Children.Add(creditCardCVVGrid);

            //set credit card expiration date
            Grid creditCardExpirationDateGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label creditCardExpirationDateLabel = new Label {
                Content = "Expiration Date : ", FontSize = 22
            };

            Grid.SetColumn(creditCardExpirationDateLabel, 0);
            creditCardExpirationDateGrid.Children.Add(creditCardExpirationDateLabel);

            DatePicker creditCardExpirationDatePicker = new DatePicker
            {
                Width = textBoxWidth
            };

            creditCardExpirationDatePicker.SelectedDateChanged += CreditCardExpirationDatePicker_SelectedDateChanged;
            Grid.SetColumn(creditCardExpirationDatePicker, 1);
            creditCardExpirationDateGrid.Children.Add(creditCardExpirationDatePicker);

            signupDataStackPanel.Children.Add(creditCardExpirationDateGrid);

            //set signup button
            Button signupButton = FrontEndHelper.CreateButton(0.1 * canvas.Width, 0.075 * canvas.Height, "Signup");

            signupButton.Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0);
            signupButton.Click += FrontEndHelper.GetMainWindow().SignupButtonUserData_Click;
            signupDataStackPanel.Children.Add(signupButton);
        }
Beispiel #3
0
        public override void Initialize()
        {
            double textBoxWidth = 300;
            double labelWdith   = 135;

            StackPanel loginDataStackPanel = new StackPanel
            {
                Margin = new Thickness(0.3 * canvas.Width, 0.3 * canvas.Height, 0, 0)
            };

            canvas.Children.Add(loginDataStackPanel);

            //set user name
            Grid userNameGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } }
            };

            Label userNameLabel = new Label {
                Content = "User Name : ", FontSize = 22
            };

            Grid.SetColumn(userNameLabel, 0);
            userNameGrid.Children.Add(userNameLabel);

            TextBox userNameTextBox = new TextBox {
                FontSize = 22, Width = textBoxWidth
            };

            userNameTextBox.TextChanged += userNameTextBoxChanged;
            Grid.SetColumn(userNameTextBox, 1);
            userNameGrid.Children.Add(userNameTextBox);

            loginDataStackPanel.Children.Add(userNameGrid);

            //sets password
            Grid passwordGrid = new Grid
            {
                ColumnDefinitions = { new ColumnDefinition {
                                          Width = new GridLength(labelWdith)
                                      }, new ColumnDefinition{
                                          Width = GridLength.Auto
                                      } },
                Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0)
            };

            Label passwordLabel = new Label
            {
                Content  = "Password : "******"Login");

            loginButton.Click += FrontEndHelper.GetMainWindow().LoginButtonUserData_Click;
            loginButton.Margin = new Thickness(0, 0.05 * canvas.Height, 0, 0);
            loginDataStackPanel.Children.Add(loginButton);
        }