public void OnClickSchoolsLoad(object sender, RoutedEventArgs e)
        {
            textPageTitle.Text = "   School API Data";
            textPageText.Text  = "   Only Top 14 items shown";

            SchoolsContentSupport Support = new SchoolsContentSupport(_configuration);

            try
            {
                IPageDataModel Data = Support.CreatePageDataModel();

                textPageTitle.Text      = "   " + Data.Title;
                textPageText.Visibility = Visibility.Visible;
                textPageText.Text       = Support.StatusMessage;
                ShowPagedButtons(false);

                if (Data.HasContent == true)
                {
                    ShowTableData(Data);
                    EnableListItems(Data.Content.Length);
                }
            }
            catch (Exception ex)
            {
                textPageTitle.Text      = "   School API Data Exception";
                textPageText.Text       = "   Exception loading School API Data with " + ex.Message;
                textPageText.Visibility = Visibility.Visible;

                textPageHeader.Visibility = Visibility.Collapsed;
                EnableListItems(0);
            }
        }
        private void ShowTableData(IPageDataModel Data)
        {
            if (Data.HasHeader == true)
            {
                textPageHeader.Text       = Data.Header;
                textPageHeader.FontSize   = Data.ContentFontSize;
                textPageHeader.Visibility = Visibility.Visible;
            }
            else
            {
                textPageHeader.Visibility = Visibility.Collapsed;
            }

            int count;

            if (Data.HasContent == true)
            {
                listBox.ItemsSource = null;

                ArrayList arrayList = new ArrayList();

                count = Data.Content.Length;
                for (int index = 0; index < count; index++)
                {
                    arrayList.Add(Data.Content[index]);
                }
                listBox.ItemsSource = arrayList;
            }
        }
        public void  ShowPagedContent(int nextIndex)
        {
            textPageTitle.Text = "   School API Data Pages";
            textPageText.Text  = "";

            try
            {
                if (PagedSupport == null)
                {
                    PagedSupport = new SchoolsPagedContentSupport(_configuration);
                }
                IPageDataModel Data = PagedSupport.CreatePageDataModel(nextIndex);

                ShowPagedButtons(true);
                textPageTitle.Text      = "   " + Data.Title;
                textPageText.Visibility = Visibility.Visible;
                textPageText.Text       = PagedSupport.StatusMessage;

                if (Data.HasContent == true)
                {
                    ShowTableData(Data);
                    EnableListItems(Data.Content.Length);
                }
            }
            catch (Exception ex)
            {
                textPageTitle.Text      = "   School API Data Exception";
                textPageText.Text       = "   Exception loading School API Data with " + ex.Message;
                textPageText.Visibility = Visibility.Visible;

                textPageHeader.Visibility = Visibility.Collapsed;
                EnableListItems(0);
            }
        }
        public void OnClickPerformanceLoad(object sender, RoutedEventArgs e)
        {
            PerformancePageContentSupport Support = new PerformancePageContentSupport(_configuration);

            try
            {
                IPageDataModel Data = Support.CreatePageDataModel();

                textPageTitle.Text      = "    " + Data.Title;
                textPageText.Visibility = Visibility.Collapsed;
                ShowPagedButtons(false);
                NextPrevGrid.Visibility = Visibility.Collapsed;

                if (Data.HasContent == true)
                {
                    ShowTableData(Data);
                    EnableListItems(Data.Content.Length);
                }
            }
            catch (Exception ex)
            {
                textPageTitle.Text      = "   School API Performance Data Exception";
                textPageText.Text       = "   Exception loading School API Performance Data with " + ex.Message;
                textPageText.Visibility = Visibility.Visible;

                textPageHeader.Visibility = Visibility.Collapsed;
                EnableListItems(0);
            }
        }
Beispiel #5
0
        public void CreateHeader(IPageDataModel data,
                                 string titleMessage)
        {
            // First setup field
            AddField("Name", 28);
            AddField("Update", 28);
            AddField("City", 12);
            AddField("State", 7);
            AddField("Zip", 5);

            data.Title      = titleMessage;
            data.HasMessage = false;

            // Make header
            data.Header    = MakeHeader();
            data.HasHeader = true;
        }
Beispiel #6
0
        public void CreateDataContentStrings(IPageDataModel data,
                                             Schools currentSchools,
                                             int count)
        {
            data.HasContent      = true;
            data.Content         = new string[count];
            data.ContentFontSize = 18;

            for (int Index = 0; Index < count; Index++)
            {
                var strings = new List <string>
                {
                    currentSchools.schools[Index].name,
                    currentSchools.schools[Index].street,
                    currentSchools.schools[Index].city,
                    currentSchools.schools[Index].state,
                    currentSchools.schools[Index].zip
                };

                data.Content[Index] = MakeContent(strings);
            }
        }