Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Проверка поступления письма от работодателя
            if (Intent.GetStringExtra("id") == null)
            {
                SetContentView(Resource.Layout.ActivityLayout1);
                name        = FindViewById <EditText>(Resource.Id.name);
                salary      = FindViewById <EditText>(Resource.Id.salary);
                phone       = FindViewById <EditText>(Resource.Id.phone);
                email       = FindViewById <EditText>(Resource.Id.email);
                gender      = FindViewById <Spinner>(Resource.Id.gender);
                jobPosition = FindViewById <EditText>(Resource.Id.jobPosition);

                //Адаптер для элемента Spinner
                aas            = new ArrayAdapter <String>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
                gender.Adapter = aas;
                aas.Add(String.Empty);
                aas.Add("Мужской");
                aas.Add("Женский");
                gender.ItemSelected += sp_ItemSelected;

                submit        = FindViewById <Button>(Resource.Id.submit);
                submit.Click += button_Clicked;
            }

            else
            {
                SetContentView(Resource.Layout.activityLayoutDialog);
                dialogWindow();

                index = Intent.GetStringExtra("id");
                int id = 0;


                id       = int.Parse(index);
                ans      = new Answer();
                ans.id   = id;
                ans.text = Intent.GetStringExtra("answer");

                // Отображение списка писем в ListView
                _answerList            = FindViewById <ListView>(Resource.Id.answers);
                _answerList.Visibility = ViewStates.Visible;
                _answer = new List <Answer>();
                _answer.Add(ans);
                _answerList.Adapter = new answerListAdapter(this, _answer);

                EditText backLetter = FindViewById <EditText>(Resource.Id.backLetter);
                Button   sendBack   = FindViewById <Button>(Resource.Id.btn_sendBack);
                int      count      = 1;
                sendBack.Click += delegate
                {
                    Answer answer = new Answer();
                    answer.id   = count;
                    answer.text = backLetter.Text;
                    _answer.Add(answer);
                    _answerList.Adapter = new answerListAdapter(this, _answer);
                    backLetter.Text     = String.Empty;
                    count++;
                };
            }
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Проверка поступления письма от работодателя
            if (Intent.GetStringExtra("id") == null)
            {
                SetContentView(Resource.Layout.ActivityLayout1);
                name = FindViewById<EditText>(Resource.Id.name);
                salary = FindViewById<EditText>(Resource.Id.salary);
                phone = FindViewById<EditText>(Resource.Id.phone);
                email = FindViewById<EditText>(Resource.Id.email);
                gender = FindViewById<Spinner>(Resource.Id.gender);
                jobPosition = FindViewById<EditText>(Resource.Id.jobPosition);

                //Адаптер для элемента Spinner
                aas = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem);
                gender.Adapter = aas;
                aas.Add(String.Empty);
                aas.Add("Мужской");
                aas.Add("Женский");
                gender.ItemSelected += sp_ItemSelected;

                submit = FindViewById<Button>(Resource.Id.submit);
                submit.Click += button_Clicked;
            }

            else
            {

                SetContentView(Resource.Layout.activityLayoutDialog);
                dialogWindow();

                index = Intent.GetStringExtra("id");
                int id = 0;

                id = int.Parse(index);
                ans = new Answer();
                ans.id = id;
                ans.text = Intent.GetStringExtra("answer");

                // Отображение списка писем в ListView
                _answerList = FindViewById<ListView>(Resource.Id.answers);
                _answerList.Visibility = ViewStates.Visible;
                _answer = new List<Answer>();
                _answer.Add(ans);
                _answerList.Adapter = new answerListAdapter(this, _answer);

                EditText backLetter = FindViewById<EditText>(Resource.Id.backLetter);
                Button sendBack = FindViewById<Button>(Resource.Id.btn_sendBack);
                int count = 1;
                sendBack.Click += delegate
                {
                    Answer answer = new Answer();
                    answer.id = count;
                    answer.text = backLetter.Text;
                    _answer.Add(answer);
                    _answerList.Adapter = new answerListAdapter(this, _answer);
                    backLetter.Text = String.Empty;
                    count++;
                };
            }
        }