public void ClearFields()
 {
     if (fieldsLayout.ChildCount > 2)
     {
         fieldsLayout.RemoveViews(2, fieldsLayout.ChildCount - 2);
     }
 }
Beispiel #2
0
        void instructionsChanged(object sender, EventArgs args)
        {
            Android.Text.TextChangedEventArgs arguments = (Android.Text.TextChangedEventArgs)args;
            String text = arguments.Text.ToString();

            if (text != "")
            {
                if (int.Parse(text) > 0 && int.Parse(text) < 10)
                {
                    LinearLayout MedicationInfo = FindViewById <LinearLayout>(Resource.Id.linearMedicationInfo);
                    MedicationInfo.RemoveViews(MedicationInfo.ChildCount - takenAtArray.Length, takenAtArray.Length);
                    takenAtArray = new LinearLayout[int.Parse(text)];
                    for (int i = 0; i < int.Parse(text); i++)
                    {
                        LinearLayout takenAt = new LinearLayout(this);
                        takenAt.Orientation = Orientation.Horizontal;
                        TextView takenAtLabel = new TextView(this);
                        takenAtLabel.Text = "Taken at: ";
                        EditText edit = new EditText(this);
                        edit.Text      = (24 - (24 / (i + 1))).ToString() + ":" + "00";
                        edit.InputType = Android.Text.InputTypes.ClassDatetime;
                        takenAt.AddView(takenAtLabel);
                        takenAt.AddView(edit);
                        takenAtArray[i] = takenAt;
                    }
                    foreach (LinearLayout lin in takenAtArray)
                    {
                        MedicationInfo.AddView(lin);
                    }
                }
            }
        }
Beispiel #3
0
 void RecreateAdapter()
 {
     if (Employees != null && Employees.Count > 0)
     {
         EmployeeTable.RemoveViews(1, Employees.Count);
     }
     Employees = MainDatabase.GetPharmacyDatas <Employee>(Pharmacy.UUID);
     foreach (var employee in Employees)
     {
         AddEmployeeToTable(employee);
     }
 }
        private void GenerateAnswerButtons(QuestionBinding questionBinding)
        {
            LinearLayout buttonLayout = FindViewById <LinearLayout>(Resource.Id.questionContentLayout);
            var          layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent);

            layoutParams.SetMargins(20, 10, 20, 10);
            var idGenerator = new Random(int.MaxValue);

            buttonLayout.RemoveViews(1, buttonLayout.ChildCount - 1);
            foreach (var item in questionBinding.WrongPairs)
            {
                EasyWordButton btn = new EasyWordButton(this);
                var            id  = idGenerator.Next();
                btn.Id = id;
                if (questionBinding.Question.QuestionWordNumber == 1)
                {
                    btn.SetText(item.InLanguage2, TextView.BufferType.Normal);
                }
                else
                {
                    btn.SetText(item.InLanguage1, TextView.BufferType.Normal);
                }

                if (item.PairID == questionBinding.Question.PairID)
                {
                    btn.IsQuestionAnswer = true;
                }
                else
                {
                    btn.IsQuestionAnswer = false;
                }
                btn.PairItem = item;
                btn.Click   += AnswerButtonClicked;
                buttonLayout.AddView(btn);
            }
        }
Beispiel #5
0
        public static void removeNeighborVViewsAndParent(View v)
        {
            LinearLayout parent = (LinearLayout)(v.Parent);

            parent.RemoveViews(0, parent.ChildCount);
        }