Пример #1
0
        /// <summary>
        /// This should get the start and end date for the sql statement by adding a value of the combobox to a second date and then returning
        /// the original selected date and the combo box date
        /// </summary>
        /// <param name="formMapUser"></param>
        /// <returns></returns>
        private Tuple <LocalDate, LocalDate> GetTimes(WorldMapUser formMapUser)
        {
            var endDate = CurrentDate;

            switch (formMapUser.TimeSkipInterval.SelectedIndex)
            {
            case 0:
                endDate = endDate.PlusDays(1);
                break;

            case 1:
                endDate = endDate.PlusDays(7);
                break;

            case 2:
                endDate = endDate.PlusMonths(1);
                break;

            case 3:
                endDate = endDate.PlusYears(1);
                break;

            case 4:
                endDate = endDate.PlusYears(10);
                break;

            case 5:
                endDate = endDate.PlusYears(100);
                break;
            }
            return(new Tuple <LocalDate, LocalDate>(CurrentDate, endDate));
        }
Пример #2
0
 public ClickAndDrag(WorldMapUser users, Action <MouseEventArgs> eventCallback)
 {
     _users        = users;
     PixelDistance = 24;
     _update       = eventCallback;
     SetupEvents();
 }
Пример #3
0
 /// <summary>
 /// Draws the map at the current zoom level to the main UI
 /// </summary>
 /// <param name="user"></param>
 public DrawClass(WorldMapUser user)
 {
     //set up the rectangle based on the image size (incase we want to modify the image later)
     RenderRectangle = new Rectangle(0, 0, _localMap.Width, _localMap.Height);
     //We then draw the polygons on the map so as to allow them to zoom correctly
     _localMap = PolygonCreator.DrawBorders(Resources.maps_world_map_02, CurrentDate, Zoom);
     //Then we create a local bitmap of the image so as to have something to draw on
     _bitmap      = new Bitmap(_localMap);
     _formMapUser = user;
     //finaly we draw the map
     RenderMap();
 }
Пример #4
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;
        }
Пример #5
0
 /// <summary>
 /// constructor to get the form we need to interact with
 /// </summary>
 /// <param name="formUser"></param>
 public ListHandlerClass(WorldMapUser formUser)
 {
     _formUser = formUser;
 }