Пример #1
0
 private void TestGetSiteList(object sender, RoutedEventArgs e)
 {
     if (login == null || String.IsNullOrEmpty(login.SessionID))
     {
         AddMessage("Not logged in.");
         return;
     }
     try {
         sites = api.GetSiteList(login.SessionID);
         SiteList.Items.Clear();
         AddMessage(string.Format("*** GetSiteList returned {0}", sites.ResultCodeString()));
         if (sites.Items != null)
         {
             AddMessage(string.Format("*** Found {0} sites", sites.Items.Count()));
             foreach (AeApi.ListItem s in sites.Items.OrderBy(z => z.Name.ToLower()))
             {
                 CheckBox siteCheckBox = new CheckBox();
                 siteCheckBox.Content = string.Format("{0}: {1}", s.ID, s.Name);
                 siteCheckBox.Tag     = s.ID;
                 SiteList.Items.Add(siteCheckBox);
             }
         }
         else
         {
             AddMessage("*** Found 0 sites");
         }
     } catch {
         AddMessage("GetSiteList failed. Please check your connection.");
     }
 }