コード例 #1
0
		public EditExpenseView ()
		{
			this.BackgroundColor = UIColor.DarkGray;

			TripHeaderView = new TripInfoHeaderView ();

			addExpenseLabel = new UILabel () {
				Font = UIFont.FromName("AvenirNext-Bold", 17f),
				TextAlignment = UITextAlignment.Left,
				BackgroundColor = UIColor.Clear,
				TextColor = UIColor.White,
				Text = "add new expense"

			};

			expenseName = new UITextField () { 
				Placeholder = "expense name?",
				BorderStyle = UITextBorderStyle.None,
				Font = UIFont.FromName("AvenirNext-Medium", 16f),
				TextColor = UIColor.Black,
				BackgroundColor = UIColor.White
			};

			date = new ActionSheetDatePicker (this);
			date.Title = "Choose Date:";
			date.DatePicker.Mode = UIDatePickerMode.Date;
			date.DatePicker.ValueChanged += (sender, e) => {
				DateTime selectedDate = (sender as UIDatePicker).Date;
				buttonDate.SetTitle(selectedDate.ToString("d"), UIControlState.Normal); 
			};

			amount = new UITextField () { 
				Placeholder = "$ amount?",
				BorderStyle = UITextBorderStyle.None,
				Font = UIFont.FromName("AvenirNext-Medium", 16f),
				TextColor = UIColor.Black,
				BackgroundColor = UIColor.White,
				KeyboardType = UIKeyboardType.NumberPad
			};




			buttonDate = UIButton.FromType (UIButtonType.Custom);
			buttonDate.SetTitle ("spent on Wednessday, Jul 17, 2013", UIControlState.Normal);
			buttonDate.SetTitleColor (UIColor.White, UIControlState.Normal);
			buttonDate.SetTitleColor (UIColor.LightGray, UIControlState.Highlighted);
			buttonDate.Font = UIFont.FromName ("AvenirNext-Medium", 16f);

			buttonDate.TouchUpInside += (sender, e) => {
				date.Show(); 
			};

			TripHeaderView.SizeToFit ();
			addExpenseLabel.SizeToFit();
			buttonDate.SizeToFit();
			expenseName.SizeToFit();
			amount.SizeToFit();

			AddSubviews (TripHeaderView, addExpenseLabel, expenseName, amount, buttonDate);
		}
コード例 #2
0
		public EditTripScreenView (RectangleF frame, Trip trip)
		{
			//this.Frame = frame;

			_scrollView = new UIScrollView (frame);
			this.BackgroundColor = UIColor.White;

			_tripNameTextField = new UITextField () { 
				Placeholder = "Trip Name",
				BorderStyle = UITextBorderStyle.RoundedRect,
			};

			_tripNameTextField = new UITextField () { 
				Placeholder = "trip name",
				BorderStyle = UITextBorderStyle.None,
				Font = UIFont.FromName("AvenirNext-Medium", 16f),
				TextColor = UIColor.Black,
				BackgroundColor = UIColor.White
			};

			_btnStartDate = UIButton.FromType (UIButtonType.Custom);
			_btnStartDate.SetTitle ("from Wednessday, Jul 17, 2013", UIControlState.Normal);
			_btnStartDate.SetTitleColor (UIColor.White, UIControlState.Normal);
			_btnStartDate.SetTitleColor (UIColor.LightGray, UIControlState.Highlighted);
			_btnStartDate.Font = UIFont.FromName ("AvenirNext-Medium", 16f);



			actionSheetDatePickerStartDate = new ActionSheetDatePicker (this);
			actionSheetDatePickerStartDate.Title = "Choose Date:";
			actionSheetDatePickerStartDate.DatePicker.Mode = UIDatePickerMode.Date;
			actionSheetDatePickerStartDate.DatePicker.ValueChanged += (sender, e) => {
				DateTime selectedDate = (sender as UIDatePicker).Date;
				_btnStartDate.SetTitle(selectedDate.ToString("D"), UIControlState.Normal); 
			};

			_btnStartDate.TouchUpInside += (sender, e) => {
				actionSheetDatePickerStartDate.Show(); 
			};

			_btnEndDate = UIButton.FromType (UIButtonType.Custom);
			_btnEndDate.SetTitle ("to Wednessday, Jul 17, 2013", UIControlState.Normal);
			_btnEndDate.SetTitleColor (UIColor.White, UIControlState.Normal);
			_btnEndDate.SetTitleColor (UIColor.LightGray, UIControlState.Highlighted);
			_btnEndDate.Font = UIFont.FromName ("AvenirNext-Medium", 16f);

			_btnEndDate.TouchUpInside += (sender, e) => {
				actionSheetDatePickerEndDate.Show();
			};
			actionSheetDatePickerEndDate = new ActionSheetDatePicker (this);
			actionSheetDatePickerEndDate.Title = "Choose Date:";
			actionSheetDatePickerEndDate.DatePicker.Mode = UIDatePickerMode.Date;
			actionSheetDatePickerEndDate.DatePicker.ValueChanged += (sender, e) => {
				DateTime selectedDate = (sender as UIDatePicker).Date;
				_btnEndDate.SetTitle(selectedDate.ToString("D"), UIControlState.Normal); 
			};


			_tripDescTextField = new UITextView () { 
				Font = UIFont.FromName("AvenirNext-Medium", 16f),
				TextColor = UIColor.Black,
				BackgroundColor = UIColor.White,
				Text = "Desc"
			};


			_tripBudgetTextField = new UITextField () { 
				Placeholder = "budget",
				BorderStyle = UITextBorderStyle.None,
				Font = UIFont.FromName("AvenirNext-Medium", 16f),
				TextColor = UIColor.Black,
				BackgroundColor = UIColor.White,
				KeyboardType = UIKeyboardType.NumberPad
			};

			ButtonExpenses = UIButton.FromType (UIButtonType.RoundedRect);
			ButtonExpenses.SetTitle ("expenses", UIControlState.Normal);


			ButtonDeleteTrip = UIButton.FromType (UIButtonType.RoundedRect);
			ButtonDeleteTrip.SetTitle ("delete trip", UIControlState.Normal);

			_tripNameTextField.SizeToFit ();
			_btnStartDate.SizeToFit ();
			_btnEndDate.SizeToFit ();
			_tripDescTextField.SizeToFit ();
			_tripBudgetTextField.SizeToFit ();
			ButtonExpenses.SizeToFit ();

			ButtonDeleteTrip.SizeToFit();

			_tripNameTextField.ShouldReturn += (t) => {
				t.ResignFirstResponder();
				return true;
			};


			// set content size to default for now
			//TODO: implement observer and set accordingly
			_scrollView.ContentSize = new SizeF (frame.Width, frame.Height);

			_scrollView.AddSubviews (_tripNameTextField, _btnStartDate, 
			                         _btnEndDate, _tripDescTextField,
			                         _tripBudgetTextField, ButtonExpenses, ButtonDeleteTrip);

			_scrollView.SizeToFit ();
			_scrollView.BackgroundColor = this.BackgroundColor = UIColor.DarkGray;

			this.AddSubview ( _scrollView);
		}
コード例 #3
0
        public EditExpenseView()
        {
            this.BackgroundColor = UIColor.DarkGray;

            TripHeaderView = new TripInfoHeaderView();

            addExpenseLabel = new UILabel()
            {
                Font            = UIFont.FromName("AvenirNext-Bold", 17f),
                TextAlignment   = UITextAlignment.Left,
                BackgroundColor = UIColor.Clear,
                TextColor       = UIColor.White,
                Text            = "add new expense"
            };

            expenseName = new UITextField()
            {
                Placeholder     = "expense name?",
                BorderStyle     = UITextBorderStyle.None,
                Font            = UIFont.FromName("AvenirNext-Medium", 16f),
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.White
            };

            date                          = new ActionSheetDatePicker(this);
            date.Title                    = "Choose Date:";
            date.DatePicker.Mode          = UIDatePickerMode.Date;
            date.DatePicker.ValueChanged += (sender, e) => {
                DateTime selectedDate = (sender as UIDatePicker).Date;
                buttonDate.SetTitle(selectedDate.ToString("d"), UIControlState.Normal);
            };

            amount = new UITextField()
            {
                Placeholder     = "$ amount?",
                BorderStyle     = UITextBorderStyle.None,
                Font            = UIFont.FromName("AvenirNext-Medium", 16f),
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.White,
                KeyboardType    = UIKeyboardType.NumberPad
            };



            buttonDate = UIButton.FromType(UIButtonType.Custom);
            buttonDate.SetTitle("spent on Wednessday, Jul 17, 2013", UIControlState.Normal);
            buttonDate.SetTitleColor(UIColor.White, UIControlState.Normal);
            buttonDate.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);
            buttonDate.Font = UIFont.FromName("AvenirNext-Medium", 16f);

            buttonDate.TouchUpInside += (sender, e) => {
                date.Show();
            };

            TripHeaderView.SizeToFit();
            addExpenseLabel.SizeToFit();
            buttonDate.SizeToFit();
            expenseName.SizeToFit();
            amount.SizeToFit();

            AddSubviews(TripHeaderView, addExpenseLabel, expenseName, amount, buttonDate);
        }
コード例 #4
0
        public EditTripScreenView(RectangleF frame, Trip trip)
        {
            //this.Frame = frame;

            _scrollView          = new UIScrollView(frame);
            this.BackgroundColor = UIColor.White;

            _tripNameTextField = new UITextField()
            {
                Placeholder = "Trip Name",
                BorderStyle = UITextBorderStyle.RoundedRect,
            };

            _tripNameTextField = new UITextField()
            {
                Placeholder     = "trip name",
                BorderStyle     = UITextBorderStyle.None,
                Font            = UIFont.FromName("AvenirNext-Medium", 16f),
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.White
            };

            _btnStartDate = UIButton.FromType(UIButtonType.Custom);
            _btnStartDate.SetTitle("from Wednessday, Jul 17, 2013", UIControlState.Normal);
            _btnStartDate.SetTitleColor(UIColor.White, UIControlState.Normal);
            _btnStartDate.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);
            _btnStartDate.Font = UIFont.FromName("AvenirNext-Medium", 16f);



            actionSheetDatePickerStartDate                          = new ActionSheetDatePicker(this);
            actionSheetDatePickerStartDate.Title                    = "Choose Date:";
            actionSheetDatePickerStartDate.DatePicker.Mode          = UIDatePickerMode.Date;
            actionSheetDatePickerStartDate.DatePicker.ValueChanged += (sender, e) => {
                DateTime selectedDate = (sender as UIDatePicker).Date;
                _btnStartDate.SetTitle(selectedDate.ToString("D"), UIControlState.Normal);
            };

            _btnStartDate.TouchUpInside += (sender, e) => {
                actionSheetDatePickerStartDate.Show();
            };

            _btnEndDate = UIButton.FromType(UIButtonType.Custom);
            _btnEndDate.SetTitle("to Wednessday, Jul 17, 2013", UIControlState.Normal);
            _btnEndDate.SetTitleColor(UIColor.White, UIControlState.Normal);
            _btnEndDate.SetTitleColor(UIColor.LightGray, UIControlState.Highlighted);
            _btnEndDate.Font = UIFont.FromName("AvenirNext-Medium", 16f);

            _btnEndDate.TouchUpInside += (sender, e) => {
                actionSheetDatePickerEndDate.Show();
            };
            actionSheetDatePickerEndDate                          = new ActionSheetDatePicker(this);
            actionSheetDatePickerEndDate.Title                    = "Choose Date:";
            actionSheetDatePickerEndDate.DatePicker.Mode          = UIDatePickerMode.Date;
            actionSheetDatePickerEndDate.DatePicker.ValueChanged += (sender, e) => {
                DateTime selectedDate = (sender as UIDatePicker).Date;
                _btnEndDate.SetTitle(selectedDate.ToString("D"), UIControlState.Normal);
            };


            _tripDescTextField = new UITextView()
            {
                Font            = UIFont.FromName("AvenirNext-Medium", 16f),
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.White,
                Text            = "Desc"
            };


            _tripBudgetTextField = new UITextField()
            {
                Placeholder     = "budget",
                BorderStyle     = UITextBorderStyle.None,
                Font            = UIFont.FromName("AvenirNext-Medium", 16f),
                TextColor       = UIColor.Black,
                BackgroundColor = UIColor.White,
                KeyboardType    = UIKeyboardType.NumberPad
            };

            ButtonExpenses = UIButton.FromType(UIButtonType.RoundedRect);
            ButtonExpenses.SetTitle("expenses", UIControlState.Normal);


            ButtonDeleteTrip = UIButton.FromType(UIButtonType.RoundedRect);
            ButtonDeleteTrip.SetTitle("delete trip", UIControlState.Normal);

            _tripNameTextField.SizeToFit();
            _btnStartDate.SizeToFit();
            _btnEndDate.SizeToFit();
            _tripDescTextField.SizeToFit();
            _tripBudgetTextField.SizeToFit();
            ButtonExpenses.SizeToFit();

            ButtonDeleteTrip.SizeToFit();

            _tripNameTextField.ShouldReturn += (t) => {
                t.ResignFirstResponder();
                return(true);
            };


            // set content size to default for now
            //TODO: implement observer and set accordingly
            _scrollView.ContentSize = new SizeF(frame.Width, frame.Height);

            _scrollView.AddSubviews(_tripNameTextField, _btnStartDate,
                                    _btnEndDate, _tripDescTextField,
                                    _tripBudgetTextField, ButtonExpenses, ButtonDeleteTrip);

            _scrollView.SizeToFit();
            _scrollView.BackgroundColor = this.BackgroundColor = UIColor.DarkGray;

            this.AddSubview(_scrollView);
        }