Exemplo n.º 1
0
 /// <summary>
 /// This should display the item, focus the world map on that item and then
 /// create the popup
 /// </summary>
 public void ChoseItem(object sender, EventArgs e)
 {
     if (_formUser.InterestingItemsList.SelectedIndex == -1)
     {
         return;
     }
     foreach (var id in _formUser.LocalDrawClass.LocalButtonCreationClass.ButtonsForTimePeriodList)
     {
         _formUser.LocalDrawClass.CenterOnButton(id.ButtonCenterPoint);
         if (id.name.Equals(_formUser.InterestingItemsList.Items[_formUser.InterestingItemsList.SelectedIndex]))
         {
             InformationPanel infoPanel = new InformationPanel(id.Text);
             infoPanel.ShowDialog();
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// this creates and displays all the buttons that should be shown on the ui at this point in time
        /// </summary>
        public void CreateButtons(WorldMapUser localForm, DrawClass localClass, LocalDate startDate, LocalDate endDate)
        {
            //this had issues with being accessed multiple times on original load, added this to stop issues with pointers
            if (_inUse)
            {
                return;
            }
            _inUse = true;
            //if we dont have a new time
            //if we have a new time
            if (!startDate.Equals(_startDateTime) || !endDate.Equals(_endDateTime))
            {
                _startDateTime = startDate;
                _endDateTime   = endDate;
                GetButtons(startDate, endDate);
                localForm.InterestingItemsList.Items.Clear();
                foreach (var localButtonStorage in ButtonsForTimePeriodList)
                {
                    localForm.InterestingItemsList.Items.Add(localButtonStorage.name);
                }
            }
            //get rid of all the old buttons
            foreach (var tempButton in _buttonControlList)
            {
                tempButton.Dispose();
            }
            //empty the list
            _buttonControlList.Clear();
            if (!localForm.RenderButtons)
            {
                if (AdminPanel.AdminPanel.ButtonName != null)
                {
                    Point?location = ButtonLocation(localClass, AdminPanel.AdminPanel.ButtonName);
                    //If the point returned is invalid we no longer want to add the label to the list
                    if (!location.HasValue)
                    {
                    }
                    else
                    {
                        //Create the label and assign it the correct values
                        Label tempButton = new Label
                        {
                            Height   = 50,
                            Width    = 50,
                            Image    = Properties.Resources.icons8_marker_50,
                            Location = location.Value,
                        };
                        tempButton.Click += (a, b) =>
                        {
                            InformationPanel infoPanel = new InformationPanel(AdminPanel.AdminPanel.ButtonName.Text);
                            infoPanel.ShowDialog();
                        };
                        //set up transparency
                        tempButton.BackColor = Color.Transparent;
                        tempButton.Parent    = localForm.WorldMap;
                        //add it to the list
                        _buttonControlList.Add(tempButton);
                    }
                }
                _inUse = false;
                return;
            }
            //Check if we should continue to attempt to draw the buttons on
            foreach (var localButtonStorage in ButtonsForTimePeriodList)
            {
                Point?location = ButtonLocation(localClass, localButtonStorage);
                //If the point returned is invalid we no longer want to add the label to the list
                if (!location.HasValue)
                {
                }
                else
                {
                    //Create the label and assign it the correct values
                    Label tempButton = new Label
                    {
                        Height   = 50,
                        Width    = 50,
                        Image    = Properties.Resources.icons8_marker_50,
                        Location = location.Value,
                    };
                    tempButton.Click += (a, b) =>
                    {
                        InformationPanel infoPanel = new InformationPanel(localButtonStorage.Text);
                        infoPanel.ShowDialog();
                    };
                    //set up transparency
                    tempButton.BackColor = Color.Transparent;
                    tempButton.Parent    = localForm.WorldMap;
                    //add it to the list
                    _buttonControlList.Add(tempButton);
                }
            }
            //add it to the control list for later removal
            foreach (var tempButton in _buttonControlList)
            {
                localForm.WorldMap.Controls.Add(tempButton);
            }

            _inUse = false;
        }