Exemplo n.º 1
0
        // Fill up the ChildrenComboBox with the User's children
        private async void fillUpChildrenComboBox()
        {
            DatabaseHandler databaseHandler = new DatabaseHandler();
            JObject         children;

            try  // If a user is already has a child
            {
                children = await databaseHandler.getResults(this.User);
            }
            catch  // If a user is not has a child yet
            {
                return;
            }

            childrenArray = new string[children.Count];

            int i = 0;

            foreach (KeyValuePair <string, JToken> child in children)
            {
                childrenArray[i] = child.Key;
                i++;
            }

            childrenComboBox.ItemsSource = childrenArray;
        }
        // Get and display the results of a current user
        private async void getResults()
        {
            JObject children;

            try  // If a result is already exists
            {
                children = await databaseHandler.getResults(User);
            }
            catch  // If a result is not exists yet
            {
                return;
            }

            foreach (KeyValuePair <string, JToken> child in children)
            {
                string childName = child.Key;
                JToken testTypes = child.Value;

                Label childNameLabel = new Label();
                childNameLabel.FontSize   = 20;
                childNameLabel.Margin     = new Thickness(0, 30, 0, 0);
                childNameLabel.FontWeight = FontWeights.Bold;
                childNameLabel.Content    = childName;

                foreach (KeyValuePair <string, JToken> test in (JObject)testTypes)
                {
                    string   testType     = test.Key;
                    string   results      = test.Value.ToString();
                    string[] resultsArray = results.Split('_');

                    if (testType == "Iránytévesztés")
                    {
                        ResultStackPanel.Children.Add(childNameLabel);

                        foreach (var result in resultsArray)
                        {
                            string[] oneResultArray = result.Split('/');

                            Label resultLabel = new Label();
                            resultLabel.FontSize = 16;
                            resultLabel.Margin   = new Thickness(30, 0, 0, 0);
                            resultLabel.Content  = oneResultArray[0] + '/' + oneResultArray[1] + ",   Ismétlések időtartama (mp): " + oneResultArray[2];

                            ResultStackPanel.Children.Add(resultLabel);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        // Get and display the children of a current user
        private async void getResults()
        {
            JObject children;

            try  // If a result is already exists
            {
                children = await databaseHandler.getResults(User);
            }
            catch  // If a result is not exists yet
            {
                return;
            }

            foreach (KeyValuePair <string, JToken> child in children)
            {
                string ID;
                string childName = child.Key;
                JToken testTypes = child.Value;

                Label childNameLabel = new Label();
                childNameLabel.FontSize = 20;
                childNameLabel.Margin   = new Thickness(0, 30, 0, 0);
                childNameLabel.Content  = childName;

                foreach (KeyValuePair <string, JToken> test in (JObject)testTypes)
                {
                    string testType = test.Key;

                    if (testType == "ID")
                    {
                        ID = test.Value.ToString();
                        childNameLabel.Content = childName + "  -  " + ID;

                        ChildrenStackPanel.Children.Add(childNameLabel);
                    }
                }
            }
        }