protected async override void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); PrepodTitle.Text = "Список преподавателей"; // Код для статуса загрузки. await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ShowAsync(); var progInd = Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ProgressIndicator; progInd.Text = "Подождите, идёт загрузка меню"; await progInd.ShowAsync(); // Код для сообщения об ошибке отсутствия интернета if (!HelperClass.CheckConnection()) { var dialog = new MessageDialog("Соединение с интернетом не установлено."); dialog.Title = "Проблема с подключением к интернету."; await dialog.ShowAsync(); Frame.Navigate(typeof(PageError)); } else { // Объект для хранения данных с сервера в формате xml. XmlReader xmlreader = await HelperClass.GetXmlReader(string.Format("http://www.sakhiepi.ru/mobile/rasp/professor_list.aspx?data=1")); //отображение try { xmlreader.ReadStartElement("main"); int k = 0; do { ListViewItem Lvi = new ListViewItem(); Lvi.Padding = new Thickness(0, 0, 0, 0); Lvi.Margin = new Thickness(0, 0, 0, 15); StackPanel Panel = new StackPanel(); Panel.Margin = new Thickness(0, 0, 0, 9.5); Panel.Tag = xmlreader.GetAttribute("id"); TextBlock tb2 = new TextBlock(); tb2.Padding = new Thickness(10, 0, 0, 0); tb2.FontWeight = FontWeights.Normal; tb2.FontSize = 30; tb2.TextWrapping = TextWrapping.Wrap; tb2.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0xff, 0xff, 0xff)); tb2.Text = xmlreader.GetAttribute("name"); Panel.Children.Add(tb2); Lvi.Content = Panel; PrepodListView.Items.Add(Lvi); k++; }while (xmlreader.ReadToNextSibling("prof")); } catch (Exception) { ListViewItem Lvi = new ListViewItem(); Lvi.Padding = new Thickness(0, 0, 0, 0); Lvi.Margin = new Thickness(0, 0, 0, 15); StackPanel Panel = new StackPanel(); Panel.Margin = new Thickness(0, 0, 0, 9.5); TextBlock tb1 = new TextBlock(); tb1.Padding = new Thickness(10, 0, 0, 0); tb1.FontWeight = FontWeights.Bold; tb1.FontSize = 30; tb1.TextWrapping = TextWrapping.Wrap; tb1.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0, 0xff, 0xe8)); tb1.Text = "Список преподавателей пуст"; Panel.Children.Add(tb1); Lvi.Content = Panel; PrepodListView.Items.Add(Lvi); } await progInd.HideAsync(); } }
protected override async void OnNavigatedTo(NavigationEventArgs e) { await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ShowAsync(); var progInd = Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ProgressIndicator; progInd.Text = "Подождите, идёт загрузка меню"; await progInd.ShowAsync(); this.navigationHelper.OnNavigatedTo(e); if (!HelperClass.CheckConnection()) { var dialog = new MessageDialog("Соединение с интернетом не установлено."); dialog.Title = "Проблема с подключением к интернету."; await dialog.ShowAsync(); Frame.Navigate(typeof(PageError)); return; } NewsListTitle.Text = HelperClass.NewsYear + ", " + HelperClass.NewsMonthName; string Adress = string.Format("http://www.sakhiepi.ru/mobile/winphone/read_news.aspx?y={0}&m={1}&lang=1", HelperClass.NewsYear, HelperClass.NewsMonth); XmlReader xmlreader = await HelperClass.GetXmlReader(Adress); //отображение try { xmlreader.ReadStartElement("main"); int k = 0; do { ListViewItem Lvi = new ListViewItem(); Lvi.Padding = new Thickness(0, 0, 0, 0); Lvi.Margin = new Thickness(0, 0, 0, 15); StackPanel Panel = new StackPanel(); Panel.Margin = new Thickness(0, 0, 0, 9.5); Panel.Tag = xmlreader.GetAttribute("page_id"); TextBlock tb1 = new TextBlock(); tb1.Padding = new Thickness(10, 0, 0, 0); tb1.FontWeight = FontWeights.Bold; tb1.FontSize = 18; tb1.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0, 0xff, 0xe8)); tb1.Text = xmlreader.GetAttribute("pubdate"); TextBlock tb2 = new TextBlock(); tb2.Padding = new Thickness(10, 0, 0, 0); tb2.FontWeight = FontWeights.Normal; tb2.FontSize = 25; tb2.TextWrapping = TextWrapping.Wrap; tb2.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0xff, 0xff, 0xff)); tb2.Text = xmlreader.GetAttribute("newstxt"); Panel.Children.Add(tb1); Panel.Children.Add(tb2); Lvi.Content = Panel; AllNews.Items.Add(Lvi); k++; }while (xmlreader.ReadToNextSibling("news")); } catch (Exception) { ListViewItem Lvi = new ListViewItem(); Lvi.Padding = new Thickness(0, 0, 0, 0); Lvi.Margin = new Thickness(0, 0, 0, 15); StackPanel Panel = new StackPanel(); Panel.Margin = new Thickness(0, 0, 0, 9.5); TextBlock tb1 = new TextBlock(); tb1.Padding = new Thickness(10, 0, 0, 0); tb1.FontWeight = FontWeights.Bold; tb1.FontSize = 25; tb1.TextWrapping = TextWrapping.Wrap; tb1.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0, 0xff, 0xe8)); tb1.Text = "На выбранный месяц новостей нет"; Panel.Children.Add(tb1); Lvi.Content = Panel; AllNews.Items.Add(Lvi); } // Конец выполнения статуса загрузки (окончание). await progInd.HideAsync(); }
protected async override void OnNavigatedTo(NavigationEventArgs e) { this.navigationHelper.OnNavigatedTo(e); NameFacultet.Text = HelperClass.NameFacultet; await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ShowAsync(); var progInd = Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ProgressIndicator; progInd.Text = "Подождите, идёт загрузка меню"; await progInd.ShowAsync(); if (!HelperClass.CheckConnection()) { var dialog = new MessageDialog("Соединение с интернетом не установлено."); dialog.Title = "Проблема с подключением к интернету."; await dialog.ShowAsync(); Frame.Navigate(typeof(PageError)); } else { XmlReader xmlreader = await HelperClass.GetXmlReader(string.Format("http://www.sakhiepi.ru/mobile/rasp/gr_list.aspx?fid={0}", HelperClass.IdFacultet)); //отображение try { xmlreader.ReadStartElement("main"); int k = 0; do { ListViewItem Lvi = new ListViewItem(); Lvi.Padding = new Thickness(0, 0, 0, 0); Lvi.Margin = new Thickness(0, 0, 0, 15); StackPanel Panel = new StackPanel(); Panel.Margin = new Thickness(0, 0, 0, 9.5); Panel.Tag = xmlreader.GetAttribute("gr_id"); TextBlock tb2 = new TextBlock(); tb2.Padding = new Thickness(10, 0, 0, 0); tb2.FontWeight = FontWeights.Normal; tb2.FontSize = 30; tb2.TextWrapping = TextWrapping.Wrap; tb2.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0xff, 0xff, 0xff)); tb2.Text = "Группа " + xmlreader.GetAttribute("gr_name"); Panel.Children.Add(tb2); Lvi.Content = Panel; GroupListView.Items.Add(Lvi); k++; }while (xmlreader.ReadToNextSibling("grupa")); } catch (Exception) { ListViewItem Lvi = new ListViewItem(); Lvi.Padding = new Thickness(0, 0, 0, 0); Lvi.Margin = new Thickness(0, 0, 0, 15); StackPanel Panel = new StackPanel(); Panel.Margin = new Thickness(0, 0, 0, 9.5); TextBlock tb1 = new TextBlock(); tb1.Padding = new Thickness(10, 0, 0, 0); tb1.FontWeight = FontWeights.Bold; tb1.FontSize = 30; tb1.TextWrapping = TextWrapping.Wrap; tb1.Foreground = new SolidColorBrush(Windows.UI.Color.FromArgb(0xff, 0, 0xff, 0xe8)); tb1.Text = "Список групп пуст"; Panel.Children.Add(tb1); Lvi.Content = Panel; GroupListView.Items.Add(Lvi); } await progInd.HideAsync(); } }