private void InitSiteList()
 {
     SiteList.Children.Clear();
     sconnSite[] sites = sconnDataShare.getSites();
     _sitesPanel = new SitePanel(SiteList.Width, SiteList.Height);
     foreach (sconnSite site in sites)
     {
         SitePanelItem item = new SitePanelItem(site.siteName, SiteList.Width, SiteList.Height * 0.1, site.siteID);
         item.SiteBtn1.Click += new RoutedEventHandler((sender, e) => ViewSiteClick(sender, e, item.SiteName));
         item.SiteBtn2.Click += new RoutedEventHandler((sender, e) => ConfigSiteClick(sender, e, item.SiteName));
         item.SiteBtn3.Click += new RoutedEventHandler((sender, e) => EditSiteClick(sender, e, item.SiteName));
         //siteList.Children.Add(item);
         _sitesPanel.AddStatusItem(item);
     }
     _sitesPanel.SelectItemChanged += sitesPanel_SelectItemChanged;
     SiteList.Children.Add(_sitesPanel);
     //ImageBrush img1 = new ImageBrush();
     //ImageBrush img2 = new ImageBrush();
     //ImageBrush img3 = new ImageBrush();
     //img1.ImageSource = new BitmapImage(new Uri("pack://application:,,,/images/cog3.jpg", UriKind.Absolute));
     //btnSites.Background = img1;
     //img2.ImageSource = new BitmapImage(new Uri("pack://application:,,,/images/key1.jpg", UriKind.Absolute));
     //btnConfig.Background = img2;
     //img3.ImageSource = new BitmapImage(new Uri("pack://application:,,,/images/stat1.jpg", UriKind.Absolute));
     //btnMap.Background = img3;
 }
Exemple #2
0
 public void AddStatusItem(SitePanelItem item)
 {
     try
     {
         _itemCount++;
         SitePanelItem[] resizedItems = new SitePanelItem[_itemCount];
         for (int i = 0; i < _items.GetLength(0); i++)
         {
             resizedItems[i] = _items[i];
         }
         resizedItems[_itemCount - 1]            = item;
         resizedItems[_itemCount - 1].MouseDown += new MouseButtonEventHandler((sender, e) => SetItemSelected(sender, e, item.SiteId));
         _items = resizedItems;
         //check if item is selected and modify
         if (item.SiteId == _selectedItemId)
         {
             item.Background = new SolidColorBrush(Colors.Aqua);
         }
         this.Children.Add(item);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #3
0
 public void ReloadSitesFromShare()
 {
     RemoveItems();
     sconnSite[] sites = sconnDataShare.getSites();
     foreach (sconnSite site in sites)
     {
         SitePanelItem item = new SitePanelItem(site.siteName, this.Width, this.Height * 0.2, site.siteID);
         this.AddStatusItem(item);
     }
 }
 private void InitSiteList()
 {
     SiteListPanel.Children.Clear();
     sconnSite[] sites = sconnDataShare.getSites();
     _sitesPanel = new SitePanel(SiteListPanel.Width, SiteListPanel.Height);
     foreach (sconnSite site in sites)
     {
         SitePanelItem item = new SitePanelItem(site.siteName, SiteListPanel.Width, SiteListPanel.Height * 0.2, site.siteID);
         _sitesPanel.AddStatusItem(item);
     }
     _sitesPanel.SelectItemChanged += sitesPanel_SelectItemChanged;
     SiteListPanel.Children.Add(_sitesPanel);
 }
Exemple #5
0
 public void RemoveStatusItem(int id)
 {
     if (id <= 0 && id > _itemCount - 1)
     {
         return;
     }
     for (int i = id; i < _itemCount - 2; i++)
     {
         _items[i] = _items[i + 1];
     }
     _itemCount--;
     SitePanelItem[] resizedItems = new SitePanelItem[_itemCount];
     _items.CopyTo(resizedItems, 0);
     _items = resizedItems;
 }