Exemplo n.º 1
0
        private void FinishClicked(object sender, EventArgs args)
        {
            if (newName.Text == "")
            {
                DisplayAlert("Incomplete Data", "No name was entered, please enter a name.", "OK");
                return;
            }
            string name        = newName.Text;
            string description = newDescription.Text;

            NestedStackLayout.NestedTypes type        = categorySelect.GetSelected();
            NestedStackLayout             stackParent = parentSelect.GetSelected();

            NestedTaskLayout.TaskType taskType = taskSelect.GetSelected();
            if (original != null)
            {
                if (stackParent == original.GetParent())
                {
                    original.SetName(name);
                    original.SetDescription(description);
                    Navigation.RemovePage(this);
                }
                else
                {
                    original.GetParent().RemoveSubView(original);
                    NestedStackLayout newGroup = NestedStackLayout.CreateLayout(parent, stackParent, newName.Text, type, taskType);
                    newGroup.SetDescription(description);
                    stackParent.AddSubView(newGroup);
                    Navigation.RemovePage(this);
                }
            }
            else
            {
                NestedStackLayout newGroup = NestedStackLayout.CreateLayout(parent, stackParent, newName.Text, type, taskType);
                newGroup.SetDescription(description);
                stackParent.AddSubView(newGroup);
                Navigation.RemovePage(this);
            }
        }
 public static NestedStackLayout CreateLayout(DomainGroup dg, NestedStackLayout par, string n, NestedTypes t, NestedTaskLayout.TaskType tt = NestedTaskLayout.TaskType.PassFail)
 {
     if (t == NestedTypes.Task)
     {
         NestedTaskLayout res = new NestedTaskLayout(dg, par, n, tt);
         res.EditTask();
         return(res);
     }
     else
     {
         return(new NestedStackLayout(dg, par, n, t));
     }
 }
 //Fall2018 Team: to do item?
 //Spring2018 Team: we need to have a way to load task information, but data files should be specified before that
 public static NestedStackLayout LoadLayout(DomainGroup dg, NestedStackLayout par, string n, NestedTypes t, NestedTaskLayout.TaskType tt = NestedTaskLayout.TaskType.PassFail)
 {
     if (t == NestedTypes.Task)
     {
         return(new NestedTaskLayout(dg, par, n, tt));
     }
     else
     {
         return(new NestedStackLayout(dg, par, n, t));
     }
 }