public void AddSector(string key, SectorItem sectorItem, SectorActionsSupporting sectorActionsSupporting)
        {
            if(sectorItem.Behavior == SectorBehavior.Simple || sectorItem.HasSimpleDuplicate)
              {
            SimpleSectorView sectorView = new SimpleSectorView();
            sectorView.Name = key;
            sectorView.SectorItem = sectorItem;
            sectorView.SetDescription(sectorItem.Name);
            sectorView.MouseDoubleClick += new MouseEventHandler(sectorView_MouseDoubleClick);
            sectorView.SetImage(Program.LogicHandler.ServicesProvider.ImagesService.GetSectorBackground(sectorItem.Code));
            simpleSectorsContainer.Controls.Add(sectorView);

            SectorMenuContainer menu = new SectorMenuContainer();
            menu.SectorView = sectorView;
            sectorView.ContextMenuStrip = menu.InnerMenu;
              }
        }
示例#2
0
        public void AddSector(string playerKey, string sectorKey, SectorItem sectorItem, SectorActionsSupporting sectorActionsSupporting)
        {
            if(InvokeRequired)
            Invoke(new Action<string, string, SectorItem, SectorActionsSupporting>(AddSector), playerKey, sectorKey, sectorItem, sectorActionsSupporting);
              else
              {
            try
            {
              this.sectorActionsSupporting.Add(sectorKey, sectorActionsSupporting);

              gameStructure.GetPlayer(playerKey).Sectors.Add(new SectorStructure() { SectorKey = sectorKey, Item = sectorItem });

              foreach(PlayerView playerView in Controls.Find(playerKey, true).OfType<PlayerView>())
            playerView.AddSector(sectorKey, sectorItem, sectorActionsSupporting);
              foreach(PlayerStatusView playerStatusView in Controls.Find(playerKey, true).OfType<PlayerStatusView>())
            playerStatusView.AddSector(sectorKey, sectorItem, sectorActionsSupporting);
            }
            catch(Exception ex)
            {
              HandleException(ex);
            }
              }
        }