Example #1
0
        async private void MainPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (Sites == null || Sites != null && !Sites.Any())
            {
                pb.Visibility = Visibility.Visible;
                var list = await WebGard.GetSites();

                if (list == null || list != null && !list.Any())
                {
                    string str = "There is a problem that couldn't retrive sites." + Environment.NewLine
                                 + "Please check your network and try again.";
                    await new Windows.UI.Popups.MessageDialog(str).ShowAsync();
                }
                else
                {
                    Sites = list;
                    gridView.ItemsSource = Sites;
                    await new Windows.UI.Popups.MessageDialog(string.Format("{0} site(s) added...", list.Count)).ShowAsync();
                }
            }
            else
            {
                gridView.ItemsSource = Sites;
            }
            pb.Visibility = Visibility.Collapsed;
        }