Esempio n. 1
0
		protected override async void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			SetContentView(Resource.Layout.pollview_new);

			mActivityContext = this;

			mCatagoryLayout = FindViewById<LinearLayout> (Resource.Id.pollview_catagoryLinearLayout);

			Spinner spinner = FindViewById<Spinner> (Resource.Id.pollTypeSpinner);
			spinner.ItemSelected += HandleSearchOptionSelected;
			ArrayAdapter adapter = ArrayAdapter.CreateFromResource (
				this, Resource.Array.poll_views, Android.Resource.Layout.SimpleSpinnerItem);

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

			mSearchText = FindViewById<EditText> (Resource.Id.pollsPageSearchField);

			FindViewById<Button> (Resource.Id.searchButton).Click += SearchClicked;
			FindViewById<Button> (Resource.Id.addPollButton).Click += AddPollClicked;

			this.SearchOptions = new ObservableCollection<PollSearchOptionViewModel>();
			this.Bindings = new BindingManager (this);

			bool keywordSearch = ((NavigationCriteria != null) && (!string.IsNullOrEmpty(NavigationCriteria.SearchQuery)));
			this.PopulateFilterOptions(keywordSearch);

			this.NavigationCriteria = DeserializeNavigationCriteria<PollsPageSearchNavigationCriteria> ();

			FindViewById<EditText>(Resource.Id.pollsPageSearchField).TextChanged += HandleSearchTextChanged;

            await SearchPollsAsync();
		}
Esempio n. 2
0
		protected override async void OnCreate (Bundle bundle)
		{
			MyVoteActivity.setLoadingMessage ("Loading User Registration interface...");
			base.OnCreate (bundle);

			this.NavigationCriteria = new RegistrationPageNavigationCriteria ();
			this.NavigationCriteria.PollId = Intent.GetIntExtra ("NavigationCriteria_PollId", 0);
			this.NavigationCriteria.ProfileId = Intent.GetStringExtra ("NavigationCriteria_ProfileId");

			this.Bindings = new BindingManager (this);

			SetContentView(Resource.Layout.registration);

			_SubmitButton = FindViewById<Button>(Resource.Id.SubmitRegistrationButton);
			_SubmitButton.Click += SubmitRegistrationClicked;
            _SubmitButton.Enabled = false;


            FindViewById(Resource.Id.registration_sex).Click += HandleClick;
            _date = FindViewById<Button>(Resource.Id.registration_dob);
            _date.Click += (sender, e) =>
            {
                ShowDialog(0);
            };


			// OnInitialize isn't async, so we have to go old school.
			await this.CreateUserAsync();

            _date.Text = !this.User.BirthDate.HasValue ? "Enter birthdate" : this.User.BirthDate.Value.ToString ("d");  

			this.InitializeBindings (this.User);

		}
Esempio n. 3
0
		protected override async void OnCreate (Bundle bundle)
		{
            PollAnswers = new ObservableCollection<PollAnswerViewModel>();

			MyVoteActivity.setLoadingMessage ("Loading Add Poll interface...");
			base.OnCreate (bundle);

			SetContentView(Resource.Layout.addpoll);

			_Spinner = FindViewById<Spinner> (Resource.Id.categorySpinner);

			_Spinner.ItemSelected += pollTypeSelected;;
			var adapter = ArrayAdapter.CreateFromResource (
				this, Resource.Array.poll_categories, Android.Resource.Layout.SimpleSpinnerItem);		

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

			_SubmitButton = FindViewById<Button>(Resource.Id.postPollButton);
			_SubmitButton.Click += SubmitClicked;
			_SubmitButton.Enabled = false;

			_PollImageView = FindViewById<ImageView> (Resource.Id.newPollImage);
			_PollImageView.Click += GetPollImage;

			_SelectUseNoDateRadioButton = FindViewById<RadioButton> (Resource.Id.radioButton1);
			_SelectUseNoDateRadioButton.Click += shouldHideDateVariables;

			_SelectUseDateRadioButton = FindViewById<RadioButton> (Resource.Id.radioButton2);
			_SelectUseDateRadioButton.Click += shouldHideDateVariables;

			_StartDateLabel = FindViewById<TextView> (Resource.Id.addpoll_startDateLabel);
			_StartDateButton = FindViewById<Button> (Resource.Id.addPollStartDateButton);

			_EndDateLabel = FindViewById<TextView> (Resource.Id.addpoll_endDateLabel);
            _EndDateButton = FindViewById<Button> (Resource.Id.addPollEndDateButton);

            _StartDateButton.Click += (sender, e) =>
            {
                ShowDialog(0);
            };

            _EndDateButton.Click += (sender, e) =>
            {
                ShowDialog(1);
            };


            _Answers = new List<int>()
            {
                Resource.Id.answerA,
                Resource.Id.answerB,
                Resource.Id.answerC,
                Resource.Id.answerD,
                Resource.Id.answerE,
            };

            foreach (var id in _Answers)
            {
                FindViewById<EditText>(id).TextChanged += HandleTextChanged;
            }

			if (IsThereAnAppToTakePictures ()) {
				CreateDirectoryForPictures ();
			}

            this.Bindings = new BindingManager (this);

            await this.CreatePollAsync();

            this.Poll.PollMinAnswers = 1;
            this.Poll.PollMaxAnswers = 1;
            SpecifyDates = false;

            this.SetupAnswers();

            await this.LoadCategoriesAsync();
            this.Poll.PollCategoryID = this.Categories[this._Spinner.SelectedItemPosition].ID;
            FindViewById<EditText>(Resource.Id.description).TextChanged += (sender, e) => this.Poll.PollQuestion = e.Text.ToString();
            toggleDateControls (false);
		}