예제 #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public DateTimeValueEditor(PropertyGridLabel label, PropertyItem property)
            : base(label, property)
        {
            currentValue              = property.Value;
            property.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(property_PropertyChanged);
            property.ValueError      += new EventHandler <ExceptionEventArgs>(property_ValueError);

            pnl          = new StackPanel();
            this.Content = pnl;

            dtp                     = new DatePicker();
            dtp.Visibility          = Visibility.Visible;
            dtp.Margin              = new Thickness(0);
            dtp.Padding             = new Thickness(2);
            dtp.VerticalAlignment   = VerticalAlignment.Center;
            dtp.HorizontalAlignment = HorizontalAlignment.Stretch;
            dtp.CalendarOpened     += new RoutedEventHandler(dtp_CalendarOpened);
            dtp.CalendarClosed     += new RoutedEventHandler(dtp_CalendarClosed);
            dtp.LostFocus          += new RoutedEventHandler(dtp_LostFocus);
            dtp.Background          = new SolidColorBrush(Colors.White);
            dtp.Foreground          = this.Property.CanWrite ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(Colors.Gray);

            pnl.Children.Add(dtp);
            dtp.Focus();

            this.ShowTextBox();
        }
예제 #2
0
        public Issue2292()
        {
            var datePicker    = new DatePicker();
            var datePickerBtn = new Button {
                Text = "Click me to call .Focus on DatePicker"
            };

            datePickerBtn.Clicked += (sender, args) => {
                datePicker.Focus();
            };

            var datePickerBtn2 = new Button {
                Text = "Click me to call .Unfocus on DatePicker"
            };

            datePickerBtn2.Clicked += (sender, args) => {
                datePicker.Unfocus();
            };

            Content = new StackLayout {
                Children =
                {
                    datePickerBtn,
                    datePickerBtn2,
                    datePicker,
                }
            };
        }
        // Handle datepicker event, set the scheduled date
        void Add_Schedule(object sender, System.EventArgs e)
        {
            Selected_Schedule_Button_Id = sender.GetHashCode();
            DatePicker datePicker = scheduleDatePicker;

            if (Selected_Schedule_Button_Id == sender.GetHashCode())
            {
                IsEnabled = true;
                datePicker.Focus();
                datePicker.Unfocused += (s, date_select_event) =>
                {
                    TimePicker timePicker = scheduleTimePicker;
                    IsEnabled = true;
                    timePicker.Focus();
                    timePicker.Unfocused += (time_select_sender, time_select_event) =>
                    {
                        if (Selected_Schedule_Button_Id == ((Button)sender).GetHashCode())
                        {
                            ((Button)sender).Text = "Scheduled for: " + datePicker.Date.ToString("dd/MM/yyyy") + " " + timePicker.Time.ToString();
                            //Console.WriteLine(sender.GetHashCode());
                            MessagingCenter.Send(this, "ScheduledDateTime" + ((Button)sender).CommandParameter.ToString(),
                                                 DateTime.Parse(datePicker.Date.ToString("dd/MM/yyyy")
                                                                + " " + timePicker.Time.ToString()));
                        }
                    };
                };
            }
        }
예제 #4
0
        private void HandleDatePicker()
        {
            string message    = string.Empty;
            var    datePicker = new DatePicker
            {
                ClassId   = "MyDatePicker",
                Date      = DateTime.Now,
                IsVisible = false,
                IsEnabled = false
            };

            DatePickerLayout.Children.Add(datePicker);

            btnDatePicker.Clicked += (object sender, EventArgs e) =>
            {
                IsEnabled = true;
                datePicker.Focus();
                //message = datePicker.Date.ToString();
                //DisplayAlert("Notice", message, "OK");
            };

            datePicker.DateSelected += (object sender1, DateChangedEventArgs e) =>
            {
                message = datePicker.Date.ToString();
                DisplayAlert("Notice", message, "OK");
            };
        }
예제 #5
0
파일: Issue2291.cs 프로젝트: zhamppx97/maui
        public Issue2291()
        {
            var btnTest = new Button
            {
                Text = "Fundo"
            };

            var dtPicker = new DatePicker
            {
                IsVisible = false
            };

            Content = new StackLayout
            {
                Children =
                {
                    btnTest,
                    dtPicker
                }
            };

            btnTest.Clicked += (s, e) =>
            {
                dtPicker.Focus();
            };
        }
 private void GroupTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         DatePicker.Focus();
     }
 }
예제 #7
0
 private void TimePicker_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (timepickerfucused)
     {
         DatePicker.Focus();
     }
 }
예제 #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public DateTimeEditor(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            currentValue              = property.Value;
            property.PropertyChanged += property_PropertyChanged;
            property.ValueError      += property_ValueError;

            contentPanel = new StackPanel();
            this.Content = contentPanel;

            datePicker = new DatePicker
            {
                Visibility          = Visibility.Visible,
                Margin              = new Thickness(0),
                VerticalAlignment   = VerticalAlignment.Center,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            datePicker.CalendarOpened += dtp_CalendarOpened;
            datePicker.CalendarClosed += dtp_CalendarClosed;
            datePicker.LostFocus      += dtp_LostFocus;
            contentPanel.Children.Add(datePicker);
            datePicker.Focus();

            this.ShowTextBox();
        }
예제 #9
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label"></param>
        /// <param name="property"></param>
        public DateTimeEditor(PropertyLabel label, PropertyItem property)
            : base(property)
        {
            currentValue = property.Value;
              property.PropertyChanged += property_PropertyChanged;
              property.ValueError += property_ValueError;

              contentPanel = new StackPanel();
              this.Content = contentPanel;

              datePicker = new DatePicker
              {
            Visibility = Visibility.Visible,
            Margin = new Thickness(0),
            VerticalAlignment = VerticalAlignment.Center,
            HorizontalAlignment = HorizontalAlignment.Stretch
              };

              datePicker.CalendarOpened += dtp_CalendarOpened;
              datePicker.CalendarClosed += dtp_CalendarClosed;
              datePicker.LostFocus += dtp_LostFocus;
              contentPanel.Children.Add(datePicker);
              datePicker.Focus();

              this.ShowTextBox();
        }
예제 #10
0
		public Issue2292 ()
		{
			var datePicker = new DatePicker ();
			var datePickerBtn = new Button {
				Text = "Click me to call .Focus on DatePicker"
			};

			datePickerBtn.Clicked += (sender, args) => {
				datePicker.Focus ();
			};

			var datePickerBtn2 = new Button {
				Text = "Click me to call .Unfocus on DatePicker"
			};

			datePickerBtn2.Clicked += (sender, args) => {
				datePicker.Unfocus ();
			};

			Content = new StackLayout {
				Children = {
					datePickerBtn, 
					datePickerBtn2, 
					datePicker,
				}
			};
		}
예제 #11
0
 public void validateDocDate(DatePicker obj, string name)
 {
     if (!validateDate(obj.SelectedDate))
     {
         obj.Focus();
         throw new Exception(string.Format("ระบุวันที่ออก{0}ไม่ถูกต้อง โปรดตรวจสอบ", name));
     }
 }
예제 #12
0
        void ShowDatePicker()
        {
            if (textBox == null)
            {
                return;
            }

            datePicker.SelectedDateChanged -= dtp_SelectedDateChanged;
            datePicker.Visibility           = Visibility.Visible;
            datePicker.Focus();

            textBox.Visibility = Visibility.Collapsed;
            contentPanel.Children.Remove(textBox);
            textBox = null;

            datePicker.SelectedDate         = (DateTime)currentValue;
            datePicker.SelectedDateChanged += dtp_SelectedDateChanged;
        }
예제 #13
0
        void ShowDatePicker()
        {
            if (null == txt)
            {
                return;
            }

            dtp.SelectedDateChanged -= new EventHandler <SelectionChangedEventArgs>(dtp_SelectedDateChanged);
            dtp.Visibility           = Visibility.Visible;
            dtp.Focus();

            txt.Visibility = Visibility.Collapsed;
            pnl.Children.Remove(txt);
            txt = null;

            dtp.SelectedDate         = (DateTime)currentValue;
            dtp.SelectedDateChanged += new EventHandler <SelectionChangedEventArgs>(dtp_SelectedDateChanged);
        }
예제 #14
0
 private void TxtPicker_Focused(object sender, FocusEventArgs e)
 {
     try
     {
         DPHidden.Focus();
     }
     catch (Exception ex)
     {
     }
 }
 private void DateTapGestureRecognizer_Tapped(object sender, EventArgs e)
 {
     if (sender.Equals(btnlFrom))
     {
         dpFrom.Focus();
     }
     else
     {
         dpTo.Focus();
     }
 }
예제 #16
0
        /// <summary>
        /// When overridden in a derived class, sets cell content as needed for editing.
        /// </summary>
        /// <param name="editingElement">The element that the column displays for a cell in editing mode.</param>
        /// <param name="editingEventArgs">Information about the user gesture that is causing a cell to enter editing mode.</param>
        /// <returns>
        /// When returned by a derived class, the unedited cell value. This implementation returns null in all cases.
        /// </returns>
        protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
        {
            DatePicker datePicker = editingElement as DatePicker;

            if (datePicker == null)
            {
                return(null);
            }

            datePicker.Focus();
            return(datePicker.SelectedDate);
        }
예제 #17
0
        protected override void Init()
        {
            var stackLayout = new StackLayout();

            Content = stackLayout;

            stackLayout.Children.Add(new Label
            {
                Text = "Label to keep picker from getting initial focus"
            });

            var datePicker = new DatePicker();

            stackLayout.Children.Add(datePicker);

            var buttonFocus = new Button
            {
                Text = "Calls Focus() on the date picker, which should open a date picker flyout."
            };

            buttonFocus.Clicked += (s, e) =>
            {
                datePicker.IsVisible = true;
                datePicker.Focus();
            };
            stackLayout.Children.Add(buttonFocus);

            var buttonNotVisible = new Button
            {
                Text = "Makes the picker not visible and calls Focus(), which should open a full screen picker flyout."
            };

            buttonNotVisible.Clicked += (s, e) =>
            {
                datePicker.IsVisible = false;
                datePicker.Focus();
            };
            stackLayout.Children.Add(buttonNotVisible);
        }
예제 #18
0
        private void CalenderIconTapped(DatePicker datePicker)
        {
            Device.BeginInvokeOnMainThread(() =>
            {
                if (datePicker.IsFocused)
                {
                    datePicker.Unfocus();
                }

                datePicker.Focus();
                IsCalenderVisible = true;
            });
        }
 private void DisplayNameTextBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         if (App.IsTrial)
         {
             DatePicker.Focus();
         }
         else
         {
             GroupTextBox.Focus();
         }
     }
 }
예제 #20
0
        protected override object PrepareCellForEdit(FrameworkElement editingElement, RoutedEventArgs editingEventArgs)
        {
            DatePicker control = editingElement as DatePicker;

            if (control == null)
            {
                return(null);
            }

            control.IsDropDownOpen = true;
            control.Focus();
            // This solves the double-tabbing problem that Nick mentioned.
            return(control.Text);
        }
        /// <summary>
        /// Metoda zapisująca dane o wizycie do bazy do tabeli Visit.
        /// </summary>
        /// <remarks>
        /// Metoda wywołuje metodę Count.
        /// Maksymalna liczba wizyt do danego lekarza w jednym dniu to pięć.
        /// </remarks>
        ///<param name="sender"> obiekt wywołujący zdarzenie </param>
        ///<param name="e"> parametr przysyłający dane do zainicjalizowania zdarzeń w metodzie </param>
        private void Umow_Click(object sender, RoutedEventArgs e)
        {
            if (PacjentComboBox.Text == "")
            {
                MessageBox.Show("Wybierz pacjenta");
            }
            else if (LekarzComboBox.Text == "")
            {
                MessageBox.Show("Wybierz lekarza");
            }
            else if (DatePicker.Text == "")
            {
                MessageBox.Show("Wprowadź datę");
                DatePicker.Focus();
            }
            else
            {
                int count = Count();
                if (count >= 5)
                {
                    MessageBox.Show("Brak miejsc na wybrany dzień do lekarza '" + LekarzComboBox.Text + "' Proszę wybrać inny dzień.");
                }


                else
                {
                    SqlConnection con = new SqlConnection();
                    con.ConnectionString = ConfigurationManager.ConnectionStrings["masterDB"].ConnectionString;

                    SqlCommand cmd = new SqlCommand();

                    cmd.CommandText = "Insert into Visit (Pacjent, Lekarz, Data) values (@Pacjent, @Lekarz, @Data)";
                    cmd.Connection  = con;
                    cmd.Parameters.AddWithValue("@Pacjent", PacjentComboBox.Text);
                    cmd.Parameters.AddWithValue("@Lekarz", LekarzComboBox.Text);
                    cmd.Parameters.AddWithValue("@Data", DatePicker.SelectedDate);


                    cmd.Connection = con;
                    con.Open();
                    int a = cmd.ExecuteNonQuery();

                    if (a == 1)
                    {
                        MessageBox.Show("Dane dodane prawidłowo");
                    }
                }
            }
        }
 private void TapGestureRecognizer_Tapped(object sender, EventArgs e)
 {
     if (_tp != null)
     {
         _rootGrid.Children.Remove(_tp);
     }
     _tp = new DatePicker()
     {
         Date = Date ?? DateTime.Today
     };
     _rootGrid.Children.Insert(0, _tp);
     _tp.DateSelected += Tp_DateSelected;
     _tp.Focus();
     _tp.IsVisible = false;
 }
예제 #23
0
        public static bool checkDatePickerValidation(DatePicker dp)
        {
            try
            {
                DateTime temp = (DateTime)dp.SelectedDate;
            }

            catch (InvalidOperationException)
            {
                MessageBox.Show("Date you entered not valid...");
                dp.Focus();
                return(false);
            }

            return(true);
        }
예제 #24
0
 private void btn_StartDate_Click(object sender, EventArgs e)
 {
     if (IsDatePickerFocused)
     {
         IsDatePickerFocused = false;
     }
     else
     {
         var btnLocation = btn_StartDate.Location;
         DatePicker.Show();
         DatePicker.Location = new System.Drawing.Point(btnLocation.X - (DatePicker.Width - btn_StartDate.Width) / 2, btnLocation.Y + 24);
         DatePicker.BringToFront();
         DatePicker.Focus();
         IsDatePickerFocused = true;
     }
 }
예제 #25
0
        protected override void OnIsKeyboardFocusWithinChanged(DependencyPropertyChangedEventArgs e)
        {
            var isKeyboardFocusWithin = (bool)e.NewValue;

            if (isKeyboardFocusWithin)
            {
                Content = _datePicker;
                _datePicker.Focus();
            }
            else
            {
                Content = _textBox;
            }

            base.OnIsKeyboardFocusWithinChanged(e);
        }
예제 #26
0
        protected override void Init()
        {
            Title = "Issue 10909";

            var layout = new StackLayout();

            var instructions = new Label
            {
                Padding         = 12,
                Text            = "If pressing the buttons opens the popup of both DatePicker and TimePicker, the test has passed.",
                BackgroundColor = Color.Black,
                TextColor       = Color.White
            };

            var datePickerFocusButton = new Button
            {
                Text = "Set focus on DatePicker"
            };

            var datepicker = new DatePicker();

            var timePickerFocusButton = new Button
            {
                Text = "Set focus on TimePicker"
            };

            var timePicker = new TimePicker();

            layout.Children.Add(instructions);
            layout.Children.Add(datePickerFocusButton);
            layout.Children.Add(datepicker);
            layout.Children.Add(timePickerFocusButton);
            layout.Children.Add(timePicker);

            Content = layout;

            datePickerFocusButton.Clicked += (sender, args) =>
            {
                datepicker.Focus();
            };

            timePickerFocusButton.Clicked += (sender, args) =>
            {
                timePicker.Focus();
            };
        }
예제 #27
0
        /// <summary>
        /// 获取DatePicker的日期值(自动检查和校验日期格式)
        /// </summary>
        /// <param name="dp"></param>
        /// <returns></returns>
        public static DateTime?GetDateTimeVal(this DatePicker dp)
        {
            var dpText = dp.Text;

            if (string.IsNullOrEmpty(dpText))
            {
                return(null);
            }
            DateTime parseVal;

            if (!DateTime.TryParse(dpText, out parseVal))
            {
                MessageBox.Show("错误的日期格式");
                dp.Focus();
                return(null);
            }
            return(parseVal);
        }
예제 #28
0
        // Token: 0x0600260F RID: 9743 RVA: 0x000B603C File Offset: 0x000B423C
        protected override void SetFocusCore()
        {
            DatePicker owningDatePicker = this.OwningDatePicker;

            if (owningDatePicker.Focusable)
            {
                if (!owningDatePicker.Focus())
                {
                    TextBox textBox = owningDatePicker.TextBox;
                    if (textBox == null || !textBox.IsKeyboardFocused)
                    {
                        throw new InvalidOperationException(SR.Get("SetFocusFailed"));
                    }
                }
                return;
            }
            throw new InvalidOperationException(SR.Get("SetFocusFailed"));
        }
        ///<summary>
        ///Metoda zapisująca dane w tabeli Badanie.
        ///</summary>
        ///<remarks>
        ///Metoda zapisuję dane po sprawdzeniu czy wszystkie pola są wypełnione </remarks>
        ///<param name="sender"> obiekt wywołujący zdarzenie </param>
        ///<param name="e"> parametr przysyłający dane do zainicjalizowania zdarzeń w metodzie </param>
        private void Umow_Click(object sender, RoutedEventArgs e)
        {
            if (PacjentComboBox.Text == "")
            {
                MessageBox.Show("Wybierz pacjenta");
                PacjentComboBox.Focus();
            }
            else if (BadanieComboBox.Text == "")
            {
                MessageBox.Show("Wybierz badanie");
                BadanieComboBox.Focus();
            }
            else if (DatePicker.Text == "")
            {
                MessageBox.Show("Wprowadź datę");
                DatePicker.Focus();
            }

            else
            {
                SqlConnection con = new SqlConnection();
                con.ConnectionString = ConfigurationManager.ConnectionStrings["masterDB"].ConnectionString;

                SqlCommand cmd = new SqlCommand();

                cmd.CommandText = "Insert into Badanie (Pacjent, Badanie, Data) values (@Pacjent, @Badanie, @Data)";
                cmd.Connection  = con;
                cmd.Parameters.AddWithValue("@Pacjent", PacjentComboBox.Text);
                cmd.Parameters.AddWithValue("@Badanie", BadanieComboBox.Text);
                cmd.Parameters.AddWithValue("@Data", DatePicker.SelectedDate);

                cmd.Connection = con;
                con.Open();
                int a = cmd.ExecuteNonQuery();

                if (a == 1)
                {
                    MessageBox.Show("Dane dodane prawidłowo");
                }
                con.Close();
            }
        }
예제 #30
0
		protected override void Init()
		{
			var datePicker = new DatePicker
			{
				AutomationId = DatePicker
			};
			var datePickerFocusButton = new Button
			{
				Text = "Click to focus DatePicker",
				Command = new Command(() => datePicker.Focus())
			};
			Content = new StackLayout
			{
				Children =
				{
					datePicker,
					datePickerFocusButton
				}
			};
		}
예제 #31
0
        public DatePickerButton()
        {
            //create the datepicker, make it invisible on the form.
            _Picker = new DatePicker
            {
                IsVisible = false
            };

            //handle the focus/unfocus or rather the showing and hiding of the dateipicker
            _Picker.Focused   += _Picker_Focused;
            _Picker.Unfocused += _Picker_Unfocused;

            //command for the button
            Command = new Command((obj) =>
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    this.Focus();
                });
                //try to get the parent layout and add the datepicker
                if (_ParentLayout == null)
                {
                    _ParentLayout = _GetParentLayout(ParentView);
                    if (_ParentLayout != null)
                    {
                        //add the picker to the closest layout up the tree
                        _ParentLayout.Children.Add(_Picker);
                    }
                    else
                    {
                        throw new InvalidOperationException("The DatePickerButton needs to be inside an Layout type control that can have other children");
                    }
                }
                //show the picker modal
                Device.BeginInvokeOnMainThread(() =>
                {
                    _Picker.Focus();
                });
            });
            _UpdateText();
        }
        protected override void SetFocusCore()
        {
            DatePicker owner = OwningDatePicker;

            if (owner.Focusable)
            {
                if (!owner.Focus())
                {
                    TextBox tb = owner.TextBox;
                    //The focus should have gone to the TextBox inside DatePicker
                    if (tb == null || !tb.IsKeyboardFocused)
                    {
                        throw new InvalidOperationException(SR.Get(SRID.SetFocusFailed));
                    }
                }
            }
            else
            {
                throw new InvalidOperationException(SR.Get(SRID.SetFocusFailed));
            }
        }
예제 #33
0
        protected override void Init()
        {
            var datePicker = new DatePicker
            {
                AutomationId = DatePicker
            };
            var datePickerFocusButton = new Button
            {
                Text    = "Click to focus DatePicker",
                Command = new Command(() => datePicker.Focus())
            };

            Content = new StackLayout
            {
                Children =
                {
                    datePicker,
                    datePickerFocusButton
                }
            };
        }
예제 #34
0
        private void addInputType(InputType inputType)
        {
            if (inputType.Type == InputType.INPUT_TYPE_PASSWORD)
            {
                PasswordBox passwordBox = new PasswordBox();
                passwordBox.Password = inputType.Value;
                ContentPanel.Children.Add(passwordBox);
                passwordBox.Focus();
                passwordBox.LostFocus += new RoutedEventHandler(TextChanged_Clicked);
                passwordBox.KeyDown += OnKeyDownHandler;
            } else if (inputType.Type == InputType.INPUT_TYPE_DATE)
            {
                DatePicker datePicker = new DatePicker();
                datePicker.Header = inputType.Name;
                datePicker.Value = toDateTime(inputType.Value);
                ContentPanel.Children.Add(datePicker);
                datePicker.Focus();
                datePicker.ValueChanged += Date_Changed;

            } else
            {
                TextBox textBox = new TextBox();
                textBox.Text = inputType.Value;
                InputScope Keyboard = new InputScope();
                InputScopeName ScopeName = new InputScopeName();
                switch (inputType.Type)
                {
                    case InputType.INPUT_TYPE_DATE:
                        ScopeName.NameValue = InputScopeNameValue.Date;
                        break;
                    case InputType.INPUT_TYPE_AMOUNT:
                        ScopeName.NameValue = InputScopeNameValue.CurrencyAmount;
                        break;
                    case InputType.INPUT_TYPE_EMAIL:
                        ScopeName.NameValue = InputScopeNameValue.EmailUserName;
                        break;
                    case InputType.INPUT_TYPE_NUMBER:
                        ScopeName.NameValue = InputScopeNameValue.Number;
                        break;
                    case InputType.INPUT_TYPE_PASSWORD:
                        ScopeName.NameValue = InputScopeNameValue.Password;
                        break;
                    case InputType.INPUT_TYPE_PHONE:
                        ScopeName.NameValue = InputScopeNameValue.TelephoneNumber;
                        break;
                    case InputType.INPUT_TYPE_URL:
                        ScopeName.NameValue = InputScopeNameValue.Url;
                        break;
                    case InputType.INPUT_TYPE_STRING:
                        ScopeName.NameValue = InputScopeNameValue.Text;
                        break;
                }
                Keyboard.Names.Add(ScopeName);
                textBox.InputScope = Keyboard;
                ContentPanel.Children.Add(textBox);
                textBox.Focus();
                textBox.LostFocus += new RoutedEventHandler(TextChanged_Clicked);
                textBox.KeyDown += OnKeyDownHandler;
            }
        }
        public CreateEventPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            masterLayout = new CustomLayout();
            masterLayout.BackgroundColor = Color.FromRgb(244, 244, 244);
            deviceSpec = DependencyService.Get<IDeviceSpec>();

			PurposeColorTitleBar mainTitleBar = new PurposeColorTitleBar(Color.FromRgb(8, 135, 224), "Purpose Color", Color.Black, "back", true);
            mainTitleBar.imageAreaTapGestureRecognizer.Tapped += imageAreaTapGestureRecognizer_Tapped;
            PurposeColorSubTitleBar subTitleBar = new PurposeColorSubTitleBar(Constants.SUB_TITLE_BG_COLOR, "Create Reminder", false, true);
            subTitleBar.BackButtonTapRecognizer.Tapped += BackButtonTapRecognizer_Tapped;

			CustomImageButton startDatePickerButton = new CustomImageButton();
			CustomImageButton startTimePickerButton = new CustomImageButton();
			CustomImageButton endDatePickerButton = new CustomImageButton();
			CustomImageButton endTimePickerButton = new CustomImageButton();


            CustomEntry title = new CustomEntry();
			title.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			title.Placeholder = " Title";
			title.TextColor = Color.Black;
			title.BackgroundColor = Color.White;


            CustomEntry messege = new CustomEntry();
			messege.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			messege.Placeholder = " Description";
			messege.TextColor = Color.Black;
			messege.BackgroundColor = Color.White;


			DatePicker startDatePicker = new DatePicker();
			startDatePicker.WidthRequest = 0;
			startDatePicker.HeightRequest = 0;
			startDatePicker.IsVisible = false;
			startDatePicker.DateSelected += (object sender, DateChangedEventArgs e) => 
			{
				
				startDatePickerButton.Text = startDatePicker.Date.ToString("dd/MM/yyyy");
			};

			DatePicker endDatePicker = new DatePicker();
			endDatePicker.WidthRequest = 0;
			endDatePicker.HeightRequest = 0;
			endDatePicker.IsVisible = false;
			endDatePicker.DateSelected += (object sender, DateChangedEventArgs e) => 
			{
				endDatePickerButton.Text = endDatePicker.Date.ToString("dd/MM/yyyy");
			};

			TimePicker startTimePicker = new TimePicker();
			startTimePicker.WidthRequest = 0;
			startTimePicker.HeightRequest = 0;
			startTimePicker.IsVisible = false;
			startTimePicker.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => 
			{
                try
                {

                    if ("Time" == e.PropertyName)
                    {
                        //	string tie = startTimePicker.Time.ToString("hh:mm tt");
                        string amPM = (startTimePicker.Time.Hours > 12) ? "PM" : "AM";
                        startTimePickerButton.Text = startTimePicker.Time.ToString(); //startTimePicker.Time.Hours.ToString () + " : " + startTimePicker.Time.Minutes.ToString() + "  " + amPM;

                    }

                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};


			TimePicker endTimePicker = new TimePicker();
			endTimePicker.WidthRequest = 0;
			endTimePicker.HeightRequest = 0;
			endTimePicker.IsVisible = false;
			endTimePicker.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => 
			{
                try
                {
                    if ("Time" == e.PropertyName)
                    {
                        string amPM = (endTimePicker.Time.Hours > 12) ? "PM" : "AM";
                        endTimePickerButton.Text = endTimePicker.Time.ToString();// endTimePicker.Time.Hours.ToString () + " : " + endTimePicker.Time.Minutes.ToString() + "  " + amPM;
                    }
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};

            //startDatePickerButton = new CustomImageButton();
            startDatePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
            startDatePickerButton.Text = "Start Date";
            startDatePickerButton.FontSize = 17;
            startDatePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            startDatePickerButton.TextOrientation = interfaces.TextOrientation.Left;
            startDatePickerButton.TextColor = Color.Gray;
            startDatePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			startDatePickerButton.Clicked += (object sender, EventArgs e) => 
			{
                try
                {
					startDatePicker.Date = DateTime.Now.AddDays(1);
                    startDatePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};



           // startTimePickerButton = new CustomImageButton();
            startTimePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
            startTimePickerButton.Text = " Start Time";
            startTimePickerButton.TextOrientation = TextOrientation.Middle;         
            startTimePickerButton.FontSize = 17;
            startTimePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
            startTimePickerButton.TextOrientation = interfaces.TextOrientation.Left;
            startTimePickerButton.TextColor = Color.Gray;
            startTimePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			startTimePickerButton.Clicked += (object sender, EventArgs e) => 
			{
                try
                {
                    startTimePicker.Time = new TimeSpan(12, 00, 00);
                    startTimePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};
		
		
		   // endDatePickerButton = new CustomImageButton();
            endDatePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
			endDatePickerButton.Text = "End Date";
			endDatePickerButton.FontSize = 17;
			endDatePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			endDatePickerButton.TextOrientation = interfaces.TextOrientation.Left;
			endDatePickerButton.TextColor = Color.Gray;
			endDatePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			endDatePickerButton.Clicked += (object sender, EventArgs e) => 	
			{
                try
                {
					endDatePicker.Date = DateTime.Now.AddDays(1);
                    endDatePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};


		   // endTimePickerButton = new CustomImageButton();
            endTimePickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
			endTimePickerButton.Text = " End Time";
			endTimePickerButton.FontSize = 17;
			endTimePickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			endTimePickerButton.TextOrientation = interfaces.TextOrientation.Left;
			endTimePickerButton.TextColor = Color.Gray;
			endTimePickerButton.WidthRequest = deviceSpec.ScreenWidth * 40 / 100;
			endTimePickerButton.Clicked += (object sender, EventArgs e) => 	
			{
                try
                {
                    endTimePicker.Time = new TimeSpan(12, 00, 00);
                    endTimePicker.Focus();
                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};

			CustomImageButton reminderPickerButton = new CustomImageButton ();
			Picker reminderPicker = new Picker ();
			reminderPicker.Items.Add ("15");
			reminderPicker.Items.Add ("30");
			reminderPicker.Items.Add ("45");
			reminderPicker.Items.Add ("60");
			reminderPicker.WidthRequest = 0;
			reminderPicker.HeightRequest = 0;
			reminderPicker.SelectedIndexChanged += (object sender, EventArgs e) => 
			{
				reminderPickerButton.Text = reminderPicker.Items[reminderPicker.SelectedIndex];
			};


            reminderPickerButton.ImageName = Device.OnPlatform("select_box_whitebg.png", "select_box_whitebg.png", "//Assets//select_box_whitebg.png");
			reminderPickerButton.Text = " Reminder";
			reminderPickerButton.TextOrientation = TextOrientation.Middle;         
			reminderPickerButton.FontSize = 17;
			reminderPickerButton.FontFamily = Constants.HELVERTICA_NEUE_LT_STD;
			reminderPickerButton.TextOrientation = interfaces.TextOrientation.Left;
			reminderPickerButton.TextColor = Color.Gray;
			reminderPickerButton.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			reminderPickerButton.Clicked += (object sender, EventArgs e) => 
			{
				reminderPicker.Focus();
			};

			Button createReminderButton = new Button ();
			createReminderButton.Text = "Create Reminder";
			createReminderButton.TextColor = Color.White;
			createReminderButton.BackgroundColor = Color.FromRgb( 30, 126, 210 );
			createReminderButton.WidthRequest = deviceSpec.ScreenWidth * 90 / 100;
			createReminderButton.Clicked += async (object sender, EventArgs e) =>
			{
                try
                {

                    App.CalPage = this;
                    if (startDatePickerButton.Text == "Start Date" || endDatePickerButton.Text == "End Date")
                    {
                        await DisplayAlert(Constants.ALERT_TITLE, "Please select start date and end date to proceed", Constants.ALERT_OK);
                        return;
                    }
                    IReminderService reminder = DependencyService.Get<IReminderService>();

                    if (Device.OS == TargetPlatform.iOS)
                    {
                        var access = await reminder.RequestAccessAsync();
                        if (!access)
                            return;
                    }

                    int reminderValue = 0;
                    if (reminderPickerButton.Text != null && reminderPickerButton.Text.Length > 0 && reminderPicker.SelectedIndex >= 0)
                    {
                        reminderValue = Convert.ToInt32(reminderPickerButton.Text);
                    }

                    DateTime startDateAndTime = new DateTime(startDatePicker.Date.Year, startDatePicker.Date.Month, startDatePicker.Date.Day, startTimePicker.Time.Hours, startTimePicker.Time.Minutes, 0);
                    DateTime endDateAndTime = new DateTime(endDatePicker.Date.Year, endDatePicker.Date.Month, endDatePicker.Date.Day, endTimePicker.Time.Hours, endTimePicker.Time.Minutes, 0);

                    // add this to app datetime fields to serve to api.
                    App.SelectedActionStartDate = startDateAndTime.ToString(); //to be converted into UTC
                    App.SelectedActionEndDate = endDateAndTime.ToString(); //to be converted into UTC
                    App.SelectedActionReminderValue = reminderValue;
                    if (!reminder.Remind(startDateAndTime, endDateAndTime, title.Text, messege.Text, reminderValue))
                    {
                        await DisplayAlert("Purpose Color", "Error in creating calendar event", Constants.ALERT_OK);
                    }
                    else
                    {
                        IProgressBar progress = DependencyService.Get<IProgressBar>();
                        progress.ShowToast("Calander event created");
                        if (Device.OS != TargetPlatform.iOS)
                        { //Navigation.PopAsync(); 
                            await Navigation.PopModalAsync();
                        }

                    }

                }
                catch (Exception ex)
                {
                    var test = ex.Message;
                }
			};

            masterLayout.AddChildToLayout(mainTitleBar, 0, 0);
            masterLayout.AddChildToLayout(subTitleBar, 0, Device.OnPlatform(9, 10, 10));

			masterLayout.AddChildToLayout(startDatePicker, 0, 0);
            masterLayout.AddChildToLayout(startTimePicker, 0, 0);
			masterLayout.AddChildToLayout(endDatePicker, 0, 0);
			masterLayout.AddChildToLayout(endTimePicker, 0, 0);
			masterLayout.AddChildToLayout(reminderPicker, 0, 0);

			masterLayout.AddChildToLayout (title, 5, 20);
			masterLayout.AddChildToLayout(messege, 5, 30);
			masterLayout.AddChildToLayout(startDatePickerButton, 5, 40);
			masterLayout.AddChildToLayout(startTimePickerButton, 55, 40);
			masterLayout.AddChildToLayout(endDatePickerButton, 5, 50);
			masterLayout.AddChildToLayout(endTimePickerButton, 55, 50);
			masterLayout.AddChildToLayout(reminderPickerButton, 5, 70);
			masterLayout.AddChildToLayout(createReminderButton, 5, 80);
            Content = masterLayout;
        }