public override Dialog OnCreateDialog (Bundle savedInstanceState)
        {
            var view = LayoutInflater.From (Activity)
                       .Inflate (Resource.Layout.ChangeTimeEntryStartTimeDialogFragment, null);
            tabsRadioButton = view.FindViewById<RadioGroup> (Resource.Id.TabsRadioGroup);
            timeTabRadioButton = view.FindViewById<RadioButton> (Resource.Id.TimeTabRadioButton).SetFont (Font.Roboto);
            dateTabRadioButton = view.FindViewById<RadioButton> (Resource.Id.DateTabRadioButton).SetFont (Font.Roboto);
            timePicker = view.FindViewById<TimePicker> (Resource.Id.TimePicker);
            datePicker = view.FindViewById<DatePicker> (Resource.Id.DatePicker);

            // WORKAROUND: Without these two lines the app will crash on rotation. See #258.
            timePicker.SaveFromParentEnabled = false;
            timePicker.SaveEnabled = true;

            tabsRadioButton.CheckedChange += OnTabsRadioGroupCheckedChange;

            SetupViews ();
            Rebind ();

            var dia = new AlertDialog.Builder (Activity)
            .SetTitle (DialogTitle)
            .SetView (view)
            .SetPositiveButton (Resource.String.ChangeTimeEntryStartTimeDialogOk, OnOkButtonClicked)
            .Create ();

            return dia;
        }
Пример #2
0
 public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     // Note: monthOfYear is a value between 0 and 11, not 1 and 12!
     DateTime selectedDate = new DateTime(year, monthOfYear + 1, dayOfMonth);
     Log.Debug(TAG, selectedDate.ToLongDateString());
     _dateSelectedHandler(selectedDate);
 }
        protected override void OnElementChanged(ElementChangedEventArgs <DateTimePickerView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null)
            {
                return;
            }

            var linearLayout = new LinearLayout(this.Context);

            var      datePicker = new Android.Widget.DatePicker(this.Context);
            Calendar calendar   = Calendar.Instance;

            datePicker.MinDate = GetDateFromDateTime(Element.MinimumDateTime);
            datePicker.MaxDate = GetDateFromDateTime(Element.MaximumDateTime);

            datePicker.Init(calendar.Get(CalendarField.Year), calendar.Get(CalendarField.Month), calendar.Get(CalendarField.DayOfMonth), this);
            var datePickerParams = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent, 1);

            linearLayout.AddView(datePicker, datePickerParams);

            if (Element.PickerMode == PickerMode.DateTime)
            {
                var timePicker       = new Android.Widget.TimePicker(this.Context);
                var timePickerParams = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent, 1);
                linearLayout.AddView(timePicker, timePickerParams);
            }

            SetNativeControl(linearLayout);
        }
Пример #4
0
    protected async override void OnCreate(Bundle bundle)
    {
      base.OnCreate(bundle);

      SetContentView(Resource.Layout.view_expense);

      dialog = ServiceContainer.Resolve<IMessageDialog>();

      var id = Intent.GetIntExtra("ID", -1);
      viewModel = ServiceContainer.Resolve<ExpenseViewModel>();
      await viewModel.Init(id);

      this.ActionBar.Title = viewModel.Title;
      viewModel.IsBusyChanged = (busy) =>
      {
        if (busy)
          AndHUD.Shared.Show(this, "Loading...");
        else
          AndHUD.Shared.Dismiss(this);
      };

      name = FindViewById<EditText>(Resource.Id.name);
      date = FindViewById<DatePicker>(Resource.Id.date);
      notes = FindViewById<EditText>(Resource.Id.notes);
      total = FindViewById<EditText>(Resource.Id.total);
      billable = FindViewById<CheckBox>(Resource.Id.billable);
      category = FindViewById<Spinner>(Resource.Id.category);
      category.Adapter = new ArrayAdapter<string>(this, global::Android.Resource.Layout.SimpleSpinnerDropDownItem, viewModel.Categories);
      category.SetSelection(viewModel.Categories.IndexOf(viewModel.Category));
      name.Text = viewModel.Name;
      date.DateTime = viewModel.Due;
      notes.Text = viewModel.Notes;
      total.Text = viewModel.Total;
      billable.Checked = viewModel.Billable;
    }
Пример #5
0
        public void OnDateSet(Android.Widget.DatePicker view, int year, int month, int dayOfMonth)
        {
            DateTime tempDate = new DateTime(year, month + 1, dayOfMonth, 10, 0, 0);
            errorHandlingFunctions newerror = new errorHandlingFunctions();
            string stringDate        = DateToString(year, month, dayOfMonth);
            var    tempStartDate     = FindViewById <Android.Widget.Button>(Resource.Id.AddTermStartDate);
            var    tempEndDate       = FindViewById <Android.Widget.Button>(Resource.Id.AddTermEndDate);
            var    tempEndDateEdit   = FindViewById <Android.Widget.Button>(Resource.Id.editTermEndDate);
            var    tempStartDateEdit = FindViewById <Android.Widget.Button>(Resource.Id.editTermStartDate);

            if (AddTermStartClick == 1)
            {
                tempStartDate.Text = stringDate;
                stringStartDate    = stringDate;
                AddTermStartDate   = tempDate;
                var tempMessage = newerror.compareDates(AddTermStartDate, AddTermEndDate);
                if (tempMessage != "N/A")
                {
                    Toast.MakeText(this, tempMessage, ToastLength.Short).Show();
                }
            }
            else if (AddTermEndClick == 1)
            {
                tempEndDate.Text = stringDate;
                stringEndDate    = stringDate;
                AddTermEndDate   = tempDate;
                var tempMessage = newerror.compareDates(AddTermStartDate, AddTermEndDate);
                if (tempMessage != "N/A")
                {
                    Toast.MakeText(this, tempMessage, ToastLength.Short).Show();
                }
            }
            else if (endClickEdit == 1)
            {
                tempEndDateEdit.Text = stringDate;
                stringEndDateEdit    = stringDate;
                EditTermEndDate      = tempDate;
                var tempMessage = newerror.compareDates(EditTermStartDate, EditTermEndDate);
                if (tempMessage != "N/A")
                {
                    Toast.MakeText(this, tempMessage, ToastLength.Short).Show();
                }
            }
            else if (startClickEdit == 1)
            {
                tempStartDateEdit.Text = stringDate;
                stringStartDateEdit    = stringDate;
                EditTermStartDate      = tempDate;
                var tempMessage = newerror.compareDates(EditTermStartDate, EditTermEndDate);
                if (tempMessage != "N/A")
                {
                    Toast.MakeText(this, tempMessage, ToastLength.Short).Show();
                }
            }
            AddTermStartClick = 0;
            AddTermEndClick   = 0;
            endClickEdit      = 0;
            startClickEdit    = 0;
        }
        public void OnDateSet(Android.Widget.DatePicker view, int year, int month, int dayOfMonth)
        {
            // Note: month is a value between 0 and 11, not 1 and 12!
            DateTime selectedDate = new DateTime(year, month + 1, dayOfMonth);

            Log.Debug(TAG, selectedDate.ToLongDateString());
            _dateSelectedHandler(selectedDate);
        }
Пример #7
0
 public void OnDateSet(DatePicker view, int year, int month, int day)
 {
     ViewModel.SelectedTask.DueDateTime = new DateTime (year, month + 1, day,
         ViewModel.SelectedTask.DueDateTime.Hour,
         ViewModel.SelectedTask.DueDateTime.Minute,
         0);
     tv.Text = ViewModel.SelectedTask.DueDateTime.ToLongDateString ();
 }
Пример #8
0
		public void  OnDateChanged (DatePicker view, int year, int monthOfYear, int dayOfMonth)
		{
			var calendar = Calendar.Instance;
			calendar.Set (datePicker.Year, datePicker.Month, datePicker.DayOfMonth);
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			dateTime = sdf.Format (calendar.Time);

		}
 public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     DateSetEvent?.Invoke(this, new DateSetEventArgs
         {
             Date = new DateTime(year, monthOfYear + 1, dayOfMonth)
         }
     );
 }
Пример #10
0
 public void OnDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     var handler = ValueChanged;
     if (handler != null)
     {
         handler(this, null);
     }
 }
Пример #11
0
        public void OnDateChanged(DatePicker view, int year, int month, int day)
        {
            mDate = new DateTime(year, month +1, day, mDate.Hour, mDate.Minute, 0); // .NET uses 1 based months, Android uses 0 based months

            Arguments.PutInt(EXTRA_YEAR, mDate.Year);
            Arguments.PutInt(EXTRA_MONTH, mDate.Month);
            Arguments.PutInt(EXTRA_DAY, mDate.Day);

            Console.WriteLine("Date Changed: {0}", mDate.ToLongDateString());
        }
        public void OnDateSet(DatePicker view, int year, int month, int dayOfMonth)
        {
            blankPicker.Text = _dialog.DatePicker.DateTime.ToString(blankPicker.Format);
            blankPicker.Date = new DateTime(year, month, dayOfMonth);
            EController.SetValueFromRenderer(VisualElement.IsFocusedProperty, false);
            Control.ClearFocus();
            HideKeyboard();

            _dialog = null;
        }
Пример #13
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Gets the layout, and all the relevant views it contains.
            Layout = inflater.Inflate(Resource.Layout.signupFragLayout2, null);
            Picker = Layout.FindViewById<DatePicker>(Resource.Id.datepicker);

            // Sets the selected time of the datepicker to be 20 years before DateTime.Now.
            Picker.DateTime = new DateTime(DateTime.Now.Year - 20, DateTime.Now.Month, DateTime.Now.Day);

            return Layout;
        }
Пример #14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.CalendarPage); //Render the UI for CalendarPage

            ButtonNotification = FindViewById <Android.Widget.Button>(Resource.Id.buttonNotification);
            datePicker         = FindViewById <Android.Widget.DatePicker>(Resource.Id.datePicker);

            ButtonNotification.Click += ButtonNotification_Click;
        }
Пример #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);
            SetTheme (Android.Resource.Style.ThemeHoloLightNoActionBar);
            SetContentView (Resource.Layout.frmAggiungiUtente);

            txtCognome = FindViewById<EditText> (Resource.Id.txtCognome);
            txtNome = FindViewById<EditText> (Resource.Id.txtNome);
            txtNumeroTessera = FindViewById<EditText> (Resource.Id.txtNumeroTessera);
            radioTipo = FindViewById<RadioGroup> (Resource.Id.gruppoTipi);
            dataIscrizione = FindViewById<DatePicker> (Resource.Id.datePicker1);
            dataIscrizione.Init (DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day,new DateChangedListener((picker, year, month, day) => {
                valutaScadenza();
            }));
            txtSaldo = FindViewById<EditText> (Resource.Id.txtSaldo);
            txtDataScadenza = FindViewById<TextView> (Resource.Id.txtScadenza);

            Button btnSalva = FindViewById<Button> (Resource.Id.btnSalva);
            Button btnAnnulla = FindViewById<Button> (Resource.Id.btnAnnulla);
            Button btnElimina = FindViewById<Button> (Resource.Id.btnElimina);
            btnScade = FindViewById<ToggleButton> (Resource.Id.btnPuoScadere);
            btnScade.Activated = puoScadere;

            btnScade.CheckedChange+= BtnScade_CheckedChange;

            btnElimina.Enabled = false;
            if (this.Intent.HasExtra("numtessera")) {
                insertMode = false;
                numtessera =  Intent.GetIntExtra ("numtessera",0).ToString();
                btnElimina.Enabled = true;
                riprendiCliente (numtessera);
            }
            btnElimina.Click += BtnElimina_Click;
            btnSalva.Click+= BtnSalva_Click;
            btnAnnulla.Click += (sender, e) => {
                funzioni.MsgBox(this,"Annullare l'inserimento (Tutti i dati non salvati andranno persi!) ?",
                    "Vegetha",
                    "SI",
                    ()=>{SetResult(Result.Ok);  Finish(); },
                    "NO",
                    ()=>{});

            };

            txtCognome.FocusChange+= txtFocusChange;
            txtNome.FocusChange += txtFocusChange;
            radioTipo.CheckedChange += (sender, e) => {
                valutaScadenza ();
            };
            radioTipo.Check( Resource.Id.radioAnnuale);
            valutaScadenza ();
        }
        public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
        {
            var date = new DateTime(year, monthOfYear + 1, dayOfMonth);

            if (callerButton == transactionDateButton)
            {
                ViewModel.SelectedTransaction.Date = date;
            }
            else if (callerButton == enddateButton)
            {
                ViewModel.EndDate = date;
            }
        }
        public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
        {
            var date = new DateTime(year, monthOfYear + 1, dayOfMonth);

            Activity.RunOnUiThread (() => {

                if(mSlidingTabScrollView.mPosition==0)
                {
                    mSampleAdapter.setDateSet1 (date.ToString ("D"));
                }

            });
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

              durationSpinner = FindViewById<Spinner>(Resource.Id.duration_spinner);

              var adapter = ArrayAdapter.CreateFromResource(
              this, Resource.Array.durations, Android.Resource.Layout.SimpleSpinnerItem);

              adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
              durationSpinner.Adapter = adapter;

              datePicker = FindViewById<DatePicker>(Resource.Id.date_picker);
              timePicker = FindViewById<TimePicker>(Resource.Id.time_picker);
              var saveEvent = FindViewById<Button>(Resource.Id.create_event);
              saveEvent.Click += async (sender, args) =>
            {
              App.NewEventViewModel.Date = new DateTime(datePicker.DateTime.Year, datePicker.DateTime.Month, datePicker.DateTime.Day,
            timePicker.CurrentHour.IntValue(), timePicker.CurrentMinute.IntValue(), 0).ToLocalTime();

              switch(durationSpinner.SelectedItemPosition)
              {
            case 0:
              App.NewEventViewModel.DurationMinutes = 5;
              break;
            case 1:
              App.NewEventViewModel.DurationMinutes = 10;
              break;
            case 2:
              App.NewEventViewModel.DurationMinutes = 15;
              break;
            case 3:
              App.NewEventViewModel.DurationMinutes = 30;
              break;
            case 4:
              App.NewEventViewModel.DurationMinutes = 45;
              break;
            case 5:
              App.NewEventViewModel.DurationMinutes = 60;
              break;
            default:
              App.NewEventViewModel.DurationMinutes = 5;
              break;
              }

              AndroidHUD.AndHUD.Shared.Show(this, "Adding Event...");
              await App.NewEventViewModel.AddEvent();
              AndroidHUD.AndHUD.Shared.Dismiss(this);
              Finish();
            };
        }
Пример #19
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Gets the layout, and all the relevant views it contains.
            Layout = inflater.Inflate(Resource.Layout.editEventDateLayout, null);
            Picker = Layout.FindViewById<DatePicker>(Resource.Id.datepicker);

            // Sets the selected time of the datepicker to be either, the time contained in
            // the activities Intent or a day after DateTime.Now.
            Picker.DateTime = new DateTime(Activity.Intent.GetIntExtra("date year", DateTime.Now.Year),
                                               Activity.Intent.GetIntExtra("date month", DateTime.Now.Month),
                                               Activity.Intent.GetIntExtra("date day", DateTime.Now.Day + 1));

            return Layout;
        }
        public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
        {
            var date = new DateTime(year, monthOfYear + 1, dayOfMonth);

            if (callerButton == selectStartDateButton)
            {
                viewModel.StartDate = date;
            }
            else if (callerButton == selectEndDateButton)
            {
                viewModel.EndDate = date;
            }
            AssignDateToButtons();
        }
Пример #21
0
		private void InitDatePicker(DatePicker _datepicker)
		{
			Calendar calendar = Calendar.Instance;
			if (!string.IsNullOrEmpty (initDate)) {
				var date = initDate.Split (new char[]{'-'}, StringSplitOptions.RemoveEmptyEntries);
				var year = Integer.ValueOf(date [0]).IntValue();
				var month = Integer.ValueOf (date [1]).IntValue ()-1;
				var day = Integer.ValueOf (date [2]).IntValue ();
				_datepicker.Init (year, month, day, this);

			}
			else
			  _datepicker.Init (calendar.Get (CalendarField.Year), calendar.Get (CalendarField.Month), calendar.Get (CalendarField.DayOfMonth), this);
			
	
			  
		}
		/**
     * Setting wrap_content on a ViewPager's layout_height in XML
     * doesn't seem to be recognized and the ViewPager will fill the
     * height of the screen regardless. We'll force the ViewPager to
     * have the same height as its immediate child.
     */
		protected override void OnMeasure (int widthMeasureSpec, int heightMeasureSpec)
		{
			base.OnMeasure (widthMeasureSpec, heightMeasureSpec);
			if (ChildCount > 0)
			{
				View childView = GetChildAt(0);

				if (childView != null)
				{
					childView.Measure(widthMeasureSpec, heightMeasureSpec);
					int height = childView.MeasuredHeight;
					SetMeasuredDimension(MeasuredWidth, height);
					LayoutParameters.Height = height;
				}
			}

			_datePicker = (DatePicker) FindViewById(Resource.Id.datePicker);
			_timePicker = (TimePicker) FindViewById(Resource.Id.timePicker);
		}
Пример #23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            SetContentView(Resource.Layout.NewJourneyCalendar);
            /************************************************|
            * 				DECLARING VARIABLES				 |
            * 					for global class use		 |
            * 												 |
            *************************************************/
            // Date Picker
            dateStart = (DatePicker)FindViewById (Resource.Id.DatePickerStart);
            dateEnd = (DatePicker)FindViewById (Resource.Id.DatePickerEnd);

            // Buttons - Next Buttons
            nextButtonDateStart = (Button)FindViewById (Resource.Id.nextButtonDateStart);
            nextButtonDateEnd = (Button)FindViewById (Resource.Id.nextButtonDateEnd);

            // Buttons - Back Buttons
            backButtonDateStart = (Button)FindViewById (Resource.Id.backButtonDateStart);
            backButtonDateEnd = (Button)FindViewById (Resource.Id.backButtonDateEnd);

            // View Flipper
            flipper = (ViewFlipper) FindViewById (Resource.Id.viewFlipper1);

            /*backButtonDateEnd.Click += delegate {
                flipper.ShowPrevious();
            };*/

            /************************************************|
            * 				INVOKING METHODS				 |
             	* 												 |
            * 												 |
            *************************************************/

            // Listener for Date
            onDateChanged (dateStart);
            onDateChanged (dateEnd);

            // Transitions
            Transitions (backButtonDateEnd);
            Transitions (backButtonDateStart);
        }
Пример #24
0
		public void DatePickDialogShow(EditText edit_birth)
		{
			var datepickerlayout = (LinearLayout) activity.LayoutInflater.Inflate (Resource.Layout.commondatepickerlayout, null);
			datePicker = datepickerlayout.FindViewById<DatePicker> (Resource.Id.datepicker);
			InitDatePicker (datePicker);
		
			var builder = new AlertDialog.Builder (activity).SetView(datepickerlayout);
			builder.SetPositiveButton ("设置", (sender, e) => {
				dialog.Dismiss();	
				edit_birth.Text = dateTime;

			});
			builder.SetNegativeButton ("取消", (sender, e) => {
				dialog.Dismiss();	

			});
			dialog= builder.Create ();

			dialog.Show();
			OnDateChanged (null, 0, 0, 0);
		}
Пример #25
0
        private void WireObjects()
        {
            this.refreshButton   = FindViewById <Android.Widget.Button>(Resource.Id.RefreshButton);
            refreshButton.Click += (object sender, EventArgs e) => this.DoUpdate();
            this.datePicker      = FindViewById <Android.Widget.DatePicker>(Resource.Id.datePicker1);
            this.highTideOne     = FindViewById <TextView>(Resource.Id.highTide1);;
            this.highTideTwo     = FindViewById <TextView>(Resource.Id.highTide2);
            this.lowTideOne      = FindViewById <TextView>(Resource.Id.lowTide1);
            this.lowTideTwo      = FindViewById <TextView>(Resource.Id.lowTide2);
            this.sunSetView      = FindViewById <TextView>(Resource.Id.sunSet);
            this.sunRiseView     = FindViewById <TextView>(Resource.Id.sunRise);
            this.highTideLabel   = FindViewById <TextView>(Resource.Id.highTideLabel);
            spinner              = FindViewById <Spinner>(Resource.Id.spinner1);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.location_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
        }
        public override Dialog OnCreateDialog (Bundle state)
        {
            var time = Toggl.Phoebe.Time.Now;
            if (model != null && model.StartTime != DateTime.MinValue) {
                time = model.StartTime.ToLocalTime ();
            }
            var date = Toggl.Phoebe.Time.Now;
            if (model != null && model.StartTime != DateTime.MinValue) {
                date = model.StartTime.ToLocalTime ().Date;
            }

            var view = LayoutInflater.From (Activity)
                .Inflate (Resource.Layout.ChangeTimeEntryStartTimeDialogFragment, null);
            TabsRadioGroup = view.FindViewById<RadioGroup> (Resource.Id.TabsRadioGroup);
            TimeTabRadioButton = view.FindViewById<RadioButton> (Resource.Id.TimeTabRadioButton).SetFont (Font.Roboto);
            DateTabRadioButton = view.FindViewById<RadioButton> (Resource.Id.DateTabRadioButton).SetFont (Font.Roboto);
            TimePicker = view.FindViewById<TimePicker> (Resource.Id.TimePicker);
            DatePicker = view.FindViewById<DatePicker> (Resource.Id.DatePicker);

            TabsRadioGroup.CheckedChange += OnTabsRadioGroupCheckedChange;

            TimePicker.CurrentHour = new Java.Lang.Integer (time.Hour);
            TimePicker.CurrentMinute = new Java.Lang.Integer (time.Minute);
            TimePicker.SetIs24HourView (new Java.Lang.Boolean (
                DateFormat.Is24HourFormat (ServiceContainer.Resolve<Context> ())));
            TimePicker.TimeChanged += OnTimePickerTimeChanged;

            DatePicker.Init (date.Year, date.Month - 1, date.Day, this);

            Rebind ();

            var dia = new AlertDialog.Builder (Activity)
                .SetTitle (Resource.String.ChangeTimeEntryStartTimeDialogTitle)
                .SetView (view)
                .SetPositiveButton (Resource.String.ChangeTimeEntryStartTimeDialogOk, OnOkButtonClicked)
                .Create ();

            return dia;
        }
Пример #27
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Item);

            textName = FindViewById<EditText> (Resource.Id.editTextName);
            dateExpiry = FindViewById<DatePicker> (Resource.Id.datePickerExpiry);
            buttonSave = FindViewById<Button> (Resource.Id.buttonSave);

            dateExpiry.DateTime = DateTime.Now.AddDays (7);

            if (Intent.HasExtra("ITEM_ID"))
                itemId = Intent.GetStringExtra ("ITEM_ID");
            if (Intent.HasExtra ("ITEM_NAME"))
                textName.Text = Intent.GetStringExtra ("ITEM_NAME");
            if (Intent.HasExtra ("ITEM_EXPIRY")) {
                var str = Intent.GetStringExtra ("ITEM_EXPIRY");
                dateExpiry.DateTime = DateTime.Parse (str);
            }

            buttonSave.Click += async delegate {

                var item = new Item {
                    Id = itemId,
                    Name = textName.Text,
                    Expires = dateExpiry.DateTime
                };

                if (string.IsNullOrEmpty(itemId))
                    await AzureMobile.MobileService.GetTable<Item>().InsertAsync(item);
                else
                    await AzureMobile.MobileService.GetTable<Item>().UpdateAsync(item);

                Finish();
            };
        }
		public void OnDateSet ( DatePicker view, int year, int monthOfYear, int dayOfMonth )
		{
			//throw new NotImplementedException ();
		}
 void DatePicker.IOnDateChangedListener.OnDateChanged (DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     Rebind ();
 }
Пример #30
0
 public void OnDateSet(Android.Widget.DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     Text = new DateTime(year, monthOfYear + 1, dayOfMonth).ToString(Constants.DateTimeFormat.DateOnlyFormat);
 }
 public void OnDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     datePicker.InternalSetValueAndRaiseChanged(new DateTime(year, (monthOfYear + 1), dayOfMonth));
 }
Пример #32
0
        protected override void OnElementChanged(ElementChangedEventArgs <DateTimePicker> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null || this.Element == null)
            {
                return;
            }


            MainActivity activity = Forms.Context as MainActivity;

            LayoutInflater inflater = (LayoutInflater)(activity.LayoutInflater);

            Android.Views.View dateLayout = Android.Views.View.Inflate(activity, Resource.Layout.DateTimePicker, null);

            Android.Widget.Button date_button = dateLayout.FindViewById <Android.Widget.Button>(Resource.Id.date_button);
            Android.Widget.Button time_button = dateLayout.FindViewById <Android.Widget.Button>(Resource.Id.time_button);

            datePicker = dateLayout.FindViewById <Android.Widget.DatePicker>(Resource.Id.date_picker);
            timePicker = dateLayout.FindViewById <Android.Widget.TimePicker>(Resource.Id.time_picker);

            date_button.Click += Date_button_Click;
            time_button.Click += TimePicker_Click;

            SetNativeControl(dateLayout);



            //Android.Views.View dateLayout = inflater.Inflate(Resource.Layout.DateTimePicker, null, false) as LinearLayout;

            //AlertDialog alertDialog = new AlertDialog.Builder(activity).Create();

            //Android.Widget.DatePicker datePicker = dateLayout.FindViewById<Android.Widget.DatePicker>(Resource.Id.date_picker);
            //Android.Widget.TimePicker timePicker = dateLayout.FindViewById<Android.Widget.TimePicker>(Resource.Id.time_picker);

            //Calendar calendar = new GregorianCalendar(datePicker.Year,
            //                   datePicker.Month,
            //                   datePicker.DayOfMonth,
            //                   timePicker.Hour,
            //                   timePicker.Minute);

            //alertDialog.SetView(dateLayout);

            //SetNativeControl(alertDialog.);



            //datePicker = new Android.Widget.DatePicker(this.Context);

            //this.SetNativeControl(datePicker);



            //MainActivity activity = Forms.Context as MainActivity;

            //DatePickerFragment frag = DatePickerFragment.NewInstance(delegate (DateTime time)
            //{
            //    //_dateDisplay.Text = time.ToLongDateString();
            //});
            //frag.Show(activity.FragmentManager, DatePickerFragment.TAG);
        }
        public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
        {
            var date = new DateTime(year, monthOfYear + 1, dayOfMonth);

            Activity.RunOnUiThread (() => {

                if(clickFlag==0)
                {
                    mGuZhangPuTongBegin.Text=date.ToString ("D");
                    mBeginDate=date.ToString ("D");
                }
                if(clickFlag==1)
                {
                    mGuZhangPuTongEnd.Text=date.ToString ("D");
                    mEndDate=date.ToString ("D");
                }

            });
        }
Пример #34
0
        public void OnDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth)
        {
            string[] less10strings=new string[] {"01","02","03","04","05","06","07","08","09"};
            string monthstring = (monthOfYear <=8) ? less10strings [monthOfYear] : monthOfYear.ToString();
            if (monthOfYear >= 9) {
                monthstring = (monthOfYear + 1).ToString ();
            }
            string daystring = (dayOfMonth <=9) ? less10strings [dayOfMonth-1] : dayOfMonth.ToString();

            this.picktimebutton.Text = year + "/" + monthstring + "/" + daystring;
        }
Пример #35
0
 // when dialog box is closed, below method will be called.
 public void OnDateSet(DatePicker view, int selectedYear,
     int selectedMonth, int selectedDay)
 {
     var date = new DateTime(selectedYear, selectedMonth + 1, selectedDay);
     var txt = ListActionHelper.filterView.FindViewById<TextView>(textView);
     var formattedDateTime = date.ToString("ddd, dd MMM yyyy");
     txt.Text = formattedDateTime;
 }
Пример #36
0
 public void OnDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     var handler = ValueChanged;
     handler?.Invoke(this, null);
 }
Пример #37
0
 public void OnDateSet(DatePicker view, int year, int month, int day)
 {
     var date = new DateTime (year, month + 1, day);
     View.FindViewById<EditText> (Resource.Id.date).Text = date.ToString ("yyyy MMMMM dd");
 }
 // For some reason this method never triggeres
 public void OnDateChanged(Android.Widget.DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     // assign values to (Element as StyledDateTimePicker).SelectedDateTime here
 }
Пример #39
0
 public void OnDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth)
 {
     DateChanged.Invoke(view, new DateChangedEventArgs(year, monthOfYear, dayOfMonth));
 }
Пример #40
0
 public void OnDateSet(Android.Widget.DatePicker view, int year, int month, int dayOfMonth)
 {
     ((MyDatePicker2)Element).SelectedDate = (view.DateTime.Month < 10 ? "0" + view.DateTime.Month : view.DateTime.Month + "") + "/" + (view.DateTime.Day < 10 ? "0" + view.DateTime.Day : view.DateTime.Day + "") + "/" + view.DateTime.Year;
     ((MyDatePicker2)Element).Unfocus();
 }