示例#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);
            }
        }
示例#2
0
        //Spring2018 Team: this will need to be rewritten to use a data file
        private static void BuildTestNestedLayout(DomainGroup dg, List <List <string> > orderedNames, int curIndex, NestedStackLayout parent)
        {
            if (curIndex >= orderedNames.Count)
            {
                return;
            }
            var names = orderedNames[curIndex];

            foreach (string name in names)
            {
                //Fall2018 Team: we may need to find a better way to do the NestedStackLayout
                //Spring2018 Team: this is a really hacky way to set the NestedStackLayout type but this is just a test
                NestedStackLayout child = NestedStackLayout.LoadLayout(dg, parent, name, (NestedStackLayout.NestedTypes)curIndex + 1);
                BuildTestNestedLayout(dg, orderedNames, curIndex + 1, child);
                parent.AddSubView(child);
            }
        }
示例#3
0
        public PatientManager()
        {
            if (instance != null)
            {
                throw new Exception("There should only be one PatientManager!");
            }
            instance = this;
            patients = new ObservableCollection <Patient>();
            //Fall2018 Team: here is where you can change the names of the default patients in the list
            patients.Add(new Patient("John Doe")
            {
                PatientAge = "18", Gender = "Male"
            });
            patients.Add(new Patient("Jane Doe")
            {
                PatientAge = "8", Gender = "Female"
            });

            //Spring2018 Team: adding a patient with real data
            //Spring2018 Team: using .LoadLayout instead of .CreateLayout because Create will ask for task information
            Patient p = new Patient("Jane", true)
            {
                PatientAge = "14", Gender = "Female"
            };
            DomainGroup       pd = p.DGroup;
            NestedStackLayout dl = pd.domainLayout;

            //Fall2018 Team: here is where we can change the names of the default domains
            NestedStackLayout behavior = NestedStackLayout.LoadLayout(pd, dl,
                                                                      "Behavior", NestedStackLayout.NestedTypes.Domain);
            NestedStackLayout commun = NestedStackLayout.LoadLayout(pd, dl,
                                                                    "Communication", NestedStackLayout.NestedTypes.Domain);
            NestedStackLayout play = NestedStackLayout.LoadLayout(pd, dl,
                                                                  "Play", NestedStackLayout.NestedTypes.Domain);
            NestedStackLayout visual = NestedStackLayout.LoadLayout(pd, dl,
                                                                    "Visual Performance", NestedStackLayout.NestedTypes.Domain);
            NestedStackLayout self = NestedStackLayout.LoadLayout(pd, dl,
                                                                  "Self Care", NestedStackLayout.NestedTypes.Domain);

            dl.AddSubView(behavior);
            dl.AddSubView(commun);
            dl.AddSubView(play);
            dl.AddSubView(visual);
            dl.AddSubView(self);

            //Fall2018 Team: here are the default goals and tasks and subcategory
            NestedStackLayout refrain = NestedStackLayout.LoadLayout(pd, behavior,
                                                                     "Refrain Aggression", NestedStackLayout.NestedTypes.Subcategory);
            NestedStackLayout tSelf = NestedStackLayout.LoadLayout(pd, refrain,
                                                                   "Towards Self", NestedStackLayout.NestedTypes.Goal);
            NestedStackLayout tOthers = NestedStackLayout.LoadLayout(pd, refrain,
                                                                     "Towards Others", NestedStackLayout.NestedTypes.Goal);
            NestedStackLayout restroom = NestedStackLayout.LoadLayout(pd, behavior,
                                                                      "Restroom Training", NestedStackLayout.NestedTypes.Subcategory);
            NestedStackLayout dontHit = NestedStackLayout.LoadLayout(pd, tOthers,
                                                                     "Refrain from hitting others", NestedStackLayout.NestedTypes.Task, NestedTaskLayout.TaskType.PassFail);

            behavior.AddSubView(refrain);
            behavior.AddSubView(restroom);
            refrain.AddSubView(tSelf);
            refrain.AddSubView(tOthers);
            tOthers.AddSubView(dontHit);

            pd.RegisterStack(behavior.GetStackType(), behavior);
            pd.RegisterStack(commun.GetStackType(), commun);
            pd.RegisterStack(play.GetStackType(), play);
            pd.RegisterStack(visual.GetStackType(), visual);
            pd.RegisterStack(self.GetStackType(), self);

            pd.RegisterStack(refrain.GetStackType(), refrain);
            pd.RegisterStack(restroom.GetStackType(), restroom);
            pd.RegisterStack(tSelf.GetStackType(), tSelf);
            pd.RegisterStack(tOthers.GetStackType(), tOthers);
            pd.RegisterStack(dontHit.GetStackType(), dontHit);

            patients.Add(p);
        }