private void BirthDayTextView_Clicked(object o, EventArgs e)
        {
            var datepickerdialog = new Android.App.DatePickerDialog(this.Context, Datepickerdialog_DateSet, presenter.BirthDate.Year, presenter.BirthDate.Month, presenter.BirthDate.Day);

            datepickerdialog.SetTitle("Выберите дату рождения");
            datepickerdialog.Show();
        }
        public void Show(EventHandler callback)
        {
            _callback = callback;
            var today  = DateTime.Today;
            var dialog = new Android.App.DatePickerDialog(Forms.Context, OnDateSet, today.Year, today.Month - 1, today.Day);

            dialog.Show();
        }
示例#3
0
        void OnClickDate(object sender, EventArgs e)
        {
            Android.App.DatePickerDialog datePicker = new Android.App.DatePickerDialog(Context, (s, args) => { Date = args.Date; DateBut.Text = Date.ToString("d"); }, DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);

            datePicker.DatePicker.MinDate = Calendar.Instance.TimeInMillis;
            datePicker.UpdateDate(DateTime.Now);
            datePicker.Show();
        }
示例#4
0
        private void SetEventHandlers()
        {
            userBirthDate.Click += delegate
            {
                var today            = DateTime.Today;
                var datepickerdialog = new Android.App.DatePickerDialog(this.Context, Datepickerdialog_DateSet, today.Year, today.Month, today.Day);
                datepickerdialog.SetTitle("Выберите дату рождения");
                datepickerdialog.CancelEvent += delegate
                {
                    choosenBirthDate   = (DateTime)userData["BirthDate"];
                    userBirthDate.Text = ((DateTime)userData["BirthDate"]).ToShortDateString();
                };
                datepickerdialog.Show();
            };
            saveProfileBtn.Click += async delegate
            {
                var FML          = userName.Text.Split(' ');
                var userSendData = new Dictionary <string, object> {
                    { "FirstName", FML[0] }, { "MiddleName", FML[1] }, { "LastName", FML[2] }, { "Sex", choosenGender }, { "BirthDate", choosenBirthDate }, { "PrioritySto", 0 }
                };
                var response = await ClientAPI.PutAsync("User", userSendData);

                if (response == null)
                {
                    return;
                }
                DataPreferences.Instance.SaveUserData(response.Item2);
                DataPreferences.Instance.LoadUserData();
            };
            genderGroup.CheckedChange += (s, e) =>
            {
                switch (e.CheckedId)
                {
                case Resource.Id.userprofile_gender_male:
                    choosenGender = 0;
                    break;

                case Resource.Id.userprofile_gender_female:
                    choosenGender = 1;
                    break;
                }
            };
        }
        void OnTouch(object sender, TouchEventArgs e)
        {
            if (e.Event.Action != MotionEventActions.Up)
            {
                return;
            }

            if (_dialog != null)
            {
                _dialog.Dispose();
            }

            CreateDialog();
            UpdateMinimumDate();
            UpdateMaximumDate();

            _dialog.CancelEvent += OnCancelButtonClicked;

            _dialog.Show();
        }
示例#6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View v = inflater.Inflate(Resource.Layout.MyProfile, container, false);

            var btnCamera = v.FindViewById <Button>(Resource.Id.camerabtn);

            imageView        = v.FindViewById <ImageView>(Resource.Id.imageView);
            btnCamera.Click += BtnCamera_Click;

            DoB = v.FindViewById <TextInputEditText>(Resource.Id.dateofbirth);

            DoB.Click += (sender, e) =>
            {
                DateTime today = DateTime.Today;
                Android.App.DatePickerDialog dialog = new Android.App.DatePickerDialog(Activity, OnDateSet, today.Year, today.Month - 1, today.Day);

                dialog.DatePicker.MinDate = today.Millisecond;
                dialog.Show();
            };

            return(v);
        }
示例#7
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.dialog_edit, container, false);

            mStartDate        = rootView.FindViewById <EditText>(Resource.Id.etStartDate);
            mEndDate          = rootView.FindViewById <EditText>(Resource.Id.etEndDate);
            mStartDate.Click += (sender, e) => {
                Log.Info("DatePicker2", "" + sender);
                DateTime today = DateTime.Today;
                Android.App.DatePickerDialog dialog = new Android.App.DatePickerDialog(main, OnStartDateSet, today.Year, today.Month - 1, today.Day);
                dialog.DatePicker.MinDate = today.Millisecond;
                dialog.Show();
            };

            mEndDate.Click += (sender, e) => {
                Log.Info("DatePicker2", "" + sender);
                DateTime today = DateTime.Today;
                Android.App.DatePickerDialog dialog = new Android.App.DatePickerDialog(main, OnEndDateSet, today.Year, today.Month - 1, today.Day);
                dialog.DatePicker.MinDate = today.Millisecond;
                dialog.Show();
            };

            return(rootView);
        }
示例#8
0
        public override void OnResume()
        {
            base.OnResume();
            // contentView.RemoveAllViews();
            vm = new GoalsVM();

            Task.Run(() =>
            {
                Task.Delay(70).Wait();
                Platform.RunSafeOnUIThread("GoalViewFragment.OnResume", () =>
                {
                    var contentPanel = view.FindViewById <Android.Widget.LinearLayout>(Resource.Id.contentpanel);
                    contentPanel.RequestFocus();
                    var binding = DataContext <GoalsVM> .FromView(contentPanel);
                    binding.VM  = vm;

                    binding.Add(Resource.Id.editText_description, x => x.Description);
                    binding.Add(Resource.Id.editDate, x => x.Date);

                    var editDate    = view.FindViewById <Android.Widget.EditText>(Resource.Id.editDate);
                    editDate.Click += (sender, e) =>
                    {
                        DateTime goal;
                        if (!DateTime.TryParse(vm.Date, out goal))
                        {
                            goal = DateTime.Now.Date;
                        }
                        Android.App.DatePickerDialog dpd = new Android.App.DatePickerDialog(Activity,
                                                                                            (c, d) =>
                        {
                            editDate.Text = d.Date.ToShortDateString();
                            vm.Date       = d.Date.ToShortDateString();
                        },
                                                                                            goal.Year,
                                                                                            goal.Month,
                                                                                            goal.Day);
                        dpd.Show();
                    };

                    var adapter = new VMListAdapter <GoalLineVM>(Activity, vm.Goals, Resource.Layout.item_goalline, null,
                                                                 (b, gvm) =>
                    {
                        b.Add(Resource.Id.text, x => x.Text);
                        b.Add(Resource.Id.value, x => x.Value);
                        b.Add(Resource.Id.image_remove, (a) =>
                        {
                            vm.DeleteGoal(a);
                        });
                    }
                                                                 );

                    contentView = view.FindViewById <Android.Widget.LinearLayout>(Resource.Id.contentView);
                    contentView.RemoveAllViews();
                    for (int i = 0; i < adapter.Count; i++)
                    {
                        contentView.AddView(adapter.GetView(i, null, contentView));
                    }

                    vm.Goals.CollectionChanged += (sender, e) =>
                    {
                        contentView.RemoveAllViews();
                        for (int i = 0; i < adapter.Count; i++)
                        {
                            contentView.AddView(adapter.GetView(i, null, contentView));
                        }
                    };

                    var text_button    = view.FindViewById <Android.Widget.TextView>(Resource.Id.text_button);
                    text_button.Click += (sender, e) =>
                    {
                        List <String> options = vm.NewPropertyOptions;

                        AlertDialog.Builder builder = new AlertDialog.Builder(Activity);
                        builder.SetTitle(Resource.String.add_target)
                        .SetItems(options.ToArray(), (s, e2) =>
                        {
                            Property result = StandardProperty.none;
                            String clicked  = options[e2.Which];
                            foreach (var value in Property.All())
                            {
                                if (value.FullCapitalizedText == clicked)
                                {
                                    result = value;
                                }
                            }

                            if (result == StandardProperty.none)
                            {
                                return;
                            }
                            vm.AddGoal(result);
                        });

                        builder.Create();
                        builder.Show();
                    };

                    SessionLog.EndPerformance("Navigate");
                });
            });
            GrabAd();
        }