<commit_before>﻿using System;
using App2Night.CustomView.Page;
using App2Night.CustomView.View;
using App2Night.CustomViews;
using App2Night.Model.Enum;
using App2Night.ViewModel;
using Xamarin.Forms;
using Xamarin.Forms.Maps;

namespace App2Night.View
{
    /// <summary>
    /// Create party page.
    /// </summary>
    public class CreatePartyPage : ContentPageWithInfo<CreatePartyViewModel>
    {
        #region Nodes

        private InputContainer<Entry> _entryName = new InputContainer<Entry>
        {
            Input = {Placeholder = "Name"},
            FontSize = 35,
			Image = "\uf1ae"
        };

        private InputContainer<Entry> _descriptionEntry = new InputContainer<Entry>
        {
            Input = {Placeholder = "Description"},
			Image = "\uf040",
            HeightRequest = 100,
            FontSize = 35,
        };

        private readonly InputContainer<DatePicker> _datePicker = new InputContainer<DatePicker>
        {
            Input =
            {
                MinimumDate = DateTime.Now,
                MaximumDate = DateTime.Now.AddMonths(12)
            },
            Image = "\uf073",
            FontSize = 35,
        };

        private InputContainer<TimePicker> _timePicker = new InputContainer<TimePicker> { Image = "\uf017", FontSize = 35, };

        private InputContainer<EnumBindablePicker<MusicGenre>> _musicGenreSwitch =
			new InputContainer<EnumBindablePicker<MusicGenre>>{ Image = "\uf001", FontSize = 35, Input = { SelectedIndex = 0}};

        private InputContainer<Entry> _streetEntry = new InputContainer<Entry>
        {
            Input = {Placeholder = "Street name"},
            FontSize = 35,
        };

        private InputContainer<Entry> _numberEntry = new InputContainer<Entry>
        {
            Input = {Keyboard = Keyboard.Numeric, Placeholder = "Number"},
            FontSize = 35,
        };

        private InputContainer<Entry> _locationEntry = new InputContainer<Entry>
        {
            Input = {Placeholder = "Loaction"},
            FontSize = 35,
        };

        InputContainer<Entry> _zipCodetEntry = new InputContainer<Entry>
        {
            Input = {Keyboard = Keyboard.Numeric, Placeholder = "Zipcode"},
            FontSize = 35,
        };

        private CustomButton _deleteButton = new CustomButton
        {
            Text = "\uf00d",
            ButtonLabel = {FontFamily = "FontAwesome", FontSize = 50},
        };

        private CustomButton _acceptButton = new CustomButton
        {
            Text = "\uf00c",
            ButtonLabel = {FontFamily = "FontAwesome", FontSize = 50},
        };

        private Map _headerMap = new Map()
        {
            HeightRequest = 500
        };

        private Image _image = new Image
        {
            HeightRequest = 100,
            WidthRequest = 100
        };

        private MapWrapper _map;

        TableView _tableView = new TableView
        {
            HorizontalOptions = LayoutOptions.Center,
            RowHeight = 75,
        };

        private TapGestureRecognizer _tapGesture = new TapGestureRecognizer();

        #endregion

        public CreatePartyPage()
        {
            _map = new MapWrapper(_headerMap);
			_map.HeightRequest = 250;
            // add eventHandler to CustomBtn
            _acceptButton.ButtonTapped += Accept;
            _deleteButton.ButtonTapped += Delete;
            //_numberEntry.Input.TextChanged += TextLength;
            //_zipCodetEntry.Input.TextChanged += TextLength;
            // set tap gesture reconizer
            _tapGesture.Tapped += LoadImage;
            // set title of the page
            Title = "Create Party";
            _image.IsVisible = false;
            // Change grid columns and rows if the device is windows
            if (Device.OS == TargetPlatform.Windows)
            {
            }
            // set Content
            _tableView.Root = new TableRoot
            {
                new TableSection("Description")
                {
                    new ViewCell {View = _entryName},
                    new ViewCell {View = _descriptionEntry},
                    new ViewCell {View = _musicGenreSwitch},
                    new ViewCell {View = _timePicker},
                    new ViewCell {View = _datePicker},
                },
                new TableSection("Orte")
                {
                    new ViewCell {View = _map},
                    new ViewCell {View = new Grid
                    {
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {Width = new GridLength(3, GridUnitType.Star)},
                            new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {_streetEntry, 0,0},
                            {_numberEntry, 1,0}
                        }
                    }},
                    new ViewCell {View = new Grid
                    {
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {Width = new GridLength(3, GridUnitType.Star)},
                            new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {_locationEntry, 0,0},
                            {_zipCodetEntry, 1,0}
                        }

                    }},
					new ViewCell {View = new Grid
					{
						ColumnDefinitions =
						{
							new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
							new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
						},
						Children =
						{
								{_acceptButton, 0,0},
								{_deleteButton, 1,0}
						}

					}},
					

                }
            };


            Content = new Grid
            {
                ColumnDefinitions =
                {
                    new ColumnDefinition {Width = new GridLength(0, GridUnitType.Star)},
                    new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                    new ColumnDefinition {Width = new GridLength(0, GridUnitType.Star)},
                },
                RowDefinitions =
                {
                    new RowDefinition {Height = new GridLength(0, GridUnitType.Star)},
                    new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, //Image 
                    new RowDefinition {Height = new GridLength(4, GridUnitType.Star)}, //TableView
                },
                Children =
                {
                    {_image, 1, 1},
                    {_tableView, 1, 2}
                }
            };
        }

        private void TextLength(object sender, TextChangedEventArgs e)
        {
            int _limit = 6; //Enter text limit

            string text = ((InputContainer<Entry>) sender).Input.Text; //Get Current Text
            if (text.Length > _limit) //If it is more than your character restriction<commit_msg>Removed padding.<commit_after>﻿using System;
using App2Night.CustomView.Page;
using App2Night.CustomView.View;
using App2Night.CustomViews;
using App2Night.Model.Enum;
using App2Night.ViewModel;
using Xamarin.Forms;
using Xamarin.Forms.Maps;

namespace App2Night.View
{
    /// <summary>
    /// Create party page.
    /// </summary>
    public class CreatePartyPage : ContentPageWithInfo<CreatePartyViewModel>
    {
        #region Views

        private InputContainer<Entry> _entryName = new InputContainer<Entry>
        {
            Input = {Placeholder = "Name"},
            FontSize = 35,
			Image = "\uf1ae"
        };

        private InputContainer<Entry> _descriptionEntry = new InputContainer<Entry>
        {
            Input = {Placeholder = "Description"},
			Image = "\uf040",
            HeightRequest = 100,
            FontSize = 35,
        };

        private readonly InputContainer<DatePicker> _datePicker = new InputContainer<DatePicker>
        {
            Input =
            {
                MinimumDate = DateTime.Now,
                MaximumDate = DateTime.Now.AddMonths(12)
            },
            Image = "\uf073",
            FontSize = 35,
        };

        private InputContainer<TimePicker> _timePicker = new InputContainer<TimePicker> { Image = "\uf017", FontSize = 35, };

        private InputContainer<EnumBindablePicker<MusicGenre>> _musicGenreSwitch =
			new InputContainer<EnumBindablePicker<MusicGenre>>{ Image = "\uf001", FontSize = 35, Input = { SelectedIndex = 0}};

        private InputContainer<Entry> _streetEntry = new InputContainer<Entry>
        {
            Input = {Placeholder = "Street name"},
            FontSize = 35,
        };

        private InputContainer<Entry> _numberEntry = new InputContainer<Entry>
        {
            Input = {Keyboard = Keyboard.Numeric, Placeholder = "Number"},
            FontSize = 35,
        };

        private InputContainer<Entry> _locationEntry = new InputContainer<Entry>
        {
            Input = {Placeholder = "Loaction"},
            FontSize = 35,
        };

        InputContainer<Entry> _zipCodetEntry = new InputContainer<Entry>
        {
            Input = {Keyboard = Keyboard.Numeric, Placeholder = "Zipcode"},
            FontSize = 35,
        };

        private CustomButton _deleteButton = new CustomButton
        {
            Text = "\uf1f8",
            ButtonLabel = {FontFamily = "FontAwesome", FontSize = 50},
        };

        private CustomButton _acceptButton = new CustomButton
        {
            Text = "\uf00c",
            ButtonLabel = {FontFamily = "FontAwesome", FontSize = 50},
        };

        private Map _headerMap = new Map()
        {
            HeightRequest = 500
        };

        private Image _image = new Image
        {
            HeightRequest = 100,
            WidthRequest = 100
        };

        private MapWrapper _map;

        TableView _tableView = new TableView
        {
            HorizontalOptions = LayoutOptions.Center,
            RowHeight = 75,
        };

        private TapGestureRecognizer _tapGesture = new TapGestureRecognizer();

        #endregion

        public CreatePartyPage()
        {
            _map = new MapWrapper(_headerMap); 
            // set tap gesture reconizer
            _tapGesture.Tapped += LoadImage;
            // set title of the page
            Title = "Create Party";
            _image.IsVisible = false;
            // Change grid columns and rows if the device is windows
            if (Device.OS == TargetPlatform.Windows)
            {
            }
            // set Content
            _tableView.Root = new TableRoot
            {
                new TableSection("Description")
                {
                    new ViewCell {View = _entryName},
                    new ViewCell {View = _descriptionEntry},
                    new ViewCell {View = _musicGenreSwitch},
                    new ViewCell {View = _timePicker},
                    new ViewCell {View = _datePicker},
                },
                new TableSection("Orte")
                {
                    new ViewCell {View = _map},
                    new ViewCell {View = new Grid
                    {
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {Width = new GridLength(3, GridUnitType.Star)},
                            new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {_streetEntry, 0,0},
                            {_numberEntry, 1,0}
                        }
                    }},
                    new ViewCell {View = new Grid
                    {
                        ColumnDefinitions =
                        {
                            new ColumnDefinition {Width = new GridLength(3, GridUnitType.Star)},
                            new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                        },
                        Children =
                        {
                            {_locationEntry, 0,0},
                            {_zipCodetEntry, 1,0}
                        }

                    }},
					new ViewCell {View = new Grid
					{
						ColumnDefinitions =
						{
							new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
							new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
						},
						Children =
						{
								{_acceptButton, 0,0},
								{_deleteButton, 1,0}
						}

					}},
					

                }
            };


            Content = new Grid
            {
                ColumnSpacing = 0,
                RowSpacing = 0,
                ColumnDefinitions =
                {
                    new ColumnDefinition {Width = new GridLength(0, GridUnitType.Star)},
                    new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)},
                    new ColumnDefinition {Width = new GridLength(0, GridUnitType.Star)},
                },
                RowDefinitions =
                {
                    new RowDefinition {Height = new GridLength(0, GridUnitType.Star)},
                    new RowDefinition {Height = new GridLength(1, GridUnitType.Star)}, //Image 
                    new RowDefinition {Height = new GridLength(4, GridUnitType.Star)}, //TableView
                },
                Children =
                {
                    {_image, 1, 1},
                    {_tableView, 1, 2}
                }
            };
        }

        private void TextLength(object sender, TextChangedEventArgs e)
        {
            int _limit = 6; //Enter text limit

            string text = ((InputContainer<Entry>) sender).Input.Text; //Get Current Text
            if (text.Length > _limit) //If it is more than your character restriction
{'fraction_non_alphanumeric': 0.08528392617212362, 'fraction_numerical': 0.01322395870164769, 'mean_word_length': 1.3609348914858097, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1358131', 'n_tokens_mistral': 3827, 'n_tokens_neox': 3310, 'n_words': 834}