Esempio n. 1
0
        public ScrollPage ScrollTo(VerticalSection section)
        {
            switch (section)
            {
            case VerticalSection.Bottom:
                app.WaitForElement(scrollView);
                app.ScrollDownTo(bottomLabel);
                break;

            default:
                break;
            }

            return(this);
        }
Esempio n. 2
0
    private void ReadData(string text)
    {
        if (!string.IsNullOrEmpty(text))
        {
            #region VerticalSections
            MatchCollection sectionsCaught = verticalSectionsMatcher.Matches(text);
            for (int i = 0; i < sectionsCaught.Count; i++)
            {
                MatchCollection valuesCaught = quotationCatcher.Matches(sectionsCaught[i].Value);
                if (valuesCaught.Count == 5)
                {
                    string sectionName = valuesCaught[0].Value;
                    if (sectionName.Equals("default"))
                    {
                        sectionName = nameof(RadarLevel.main);
                    }
                    int radarLevelIndex = Array.IndexOf(Enum.GetNames(typeof(RadarLevel)), sectionName);

                    if (radarLevelIndex >= 0)
                    {
                        VerticalSection section = new VerticalSection();
                        try
                        {
                            section.AltitudeMax = Convert.ToSingle(valuesCaught[2].Value);
                            section.AltitudeMin = Convert.ToSingle(valuesCaught[4].Value);
                        }
                        catch (Exception) { }
                        verticalsections[(RadarLevel)radarLevelIndex] = section;
                    }
                }
            }
            #endregion

            #region Other Values
            string[] lines = text.Split('\n');
            foreach (string line in lines)
            {
                if (!string.IsNullOrEmpty(line))
                {
                    string nonComment = line.Split(new string[] { "//" }, StringSplitOptions.None)[0];

                    MatchCollection matched = quotationCatcher.Matches(nonComment);
                    if (matched.Count == 2)
                    {
                        string valueName  = matched[0].Value;
                        int    valueIndex = Array.IndexOf(Enum.GetNames(typeof(Values)), valueName);
                        //Debug.Log(nonComment + " | Matched" + valueIndex + ": " + valueName + " " + matched[1]);
                        if (valueIndex > -1)
                        {
                            float value = 0;
                            try
                            {
                                value = Convert.ToSingle(matched[1].Value);
                            }
                            catch (Exception) { }
                            values[(Values)valueIndex] = value;
                        }
                    }
                }
            }
            #endregion
        }
    }