Example #1
0
        //Constructor for Creating border pin
        public Pin(InterventionPin interventionPin, MapSectionPage mapSection)
        {
            this.relatedObject = interventionPin;
            this.mapSection    = mapSection;

            //Adding the border pin to the list of all pins
            pinList.Add(this);
        }
        public InterventionContainer(InterventionPin interventionPin, MapSectionPage mapSection) : base(interventionPin, mapSection)
        {
            this.interventionPin = interventionPin;
            this.Canvas_map      = mapSection.Canvas_map;

            //Creating border that defines the edge of the container
            Border border = new Border();

            border.BorderThickness = new Thickness(1);
            border.CornerRadius    = new CornerRadius(5);
            border.BorderBrush     = new SolidColorBrush(Colors.Red);
            this.Children.Add(border);
        }
Example #3
0
        public TeamPin(Team team, MapSectionPage mapSection) : base(team, mapSection, size)
        {
            this.team       = team;       //Providing a link to the team that this pin represents
            this.mapSection = mapSection;
            //Updating image to match training and status of team in addition to text
            Update();

            //Creating a context menu for TeamPin objects
            MenuItem[] menuItems = new MenuItem[4];

            //Menu items for status change
            menuItems[0]        = new MenuItem();
            menuItems[0].Uid    = "MenuItem_TeamPin_Available";
            menuItems[0].Header = ETD.Properties.Resources.MenuItem_TeamPin_Available;

            menuItems[1]        = new MenuItem();
            menuItems[1].Uid    = "MenuItem_TeamPin_Moving";
            menuItems[1].Header = ETD.Properties.Resources.MenuItem_TeamPin_Moving;

            menuItems[2]        = new MenuItem();
            menuItems[2].Uid    = "MenuItem_TeamPin_Intervening";
            menuItems[2].Header = ETD.Properties.Resources.MenuItem_TeamPin_Intervening;

            menuItems[3]        = new MenuItem();
            menuItems[3].Uid    = "MenuItem_TeamPin_Unavailable";
            menuItems[3].Header = ETD.Properties.Resources.MenuItem_TeamPin_Unavailable;

            //Adding the method to be called when a menu item is clicked and adding the menuitem to the TeamPin context menu
            ContextMenu contextMenu = new ContextMenu();

            for (int i = 0; i < menuItems.Length; i++)
            {
                menuItems[i].Click += ChangeStatus_Click;
                contextMenu.Items.Add(menuItems[i]);
            }
            this.ContextMenu = contextMenu;

            //When the context menu is opened, check the appropriate status of the team
            this.ContextMenu.Opened += CheckCurrentStatus_Opened;

            //Register as an observer to the team instance that this pin represents
            team.RegisterInstanceObserver(this);

            //Register as an observer to the GPS locations so that it will be notified when the GPS locations are changed (team has moved)
            if (team.getGPSLocation() != null)            //The team has been associated to GPS locations
            {
                gpsLocation = team.getGPSLocation();      //Getting a direct pointer for ease of access only
                gpsLocation.RegisterInstanceObserver(this);
            }
        }
Example #4
0
        //Creating regular pin
        public Pin(object relatedObject, MapSectionPage mapSection, int size) : base()
        {
            //Setting relatedObject, used for position recovery
            this.relatedObject = relatedObject;
            this.mapSection    = mapSection;

            //Initializing grid attibutes
            this.Width  = size;
            this.Height = size;
            this.MouseLeftButtonDown += new MouseButtonEventHandler(mapSection.DragStart_MouseLeftButtonDown);
            this.MouseMove           += new MouseEventHandler(mapSection.DragMove_MouseMove);
            this.MouseLeftButtonUp   += new MouseButtonEventHandler(mapSection.DragStop_MouseLeftButtonUp);

            //Adding the pin to the list of all pins
            pinList.Add(this);
        }
Example #5
0
        public MainWindow()
        {
            InitializeComponent();

            //only attach SelectionChanged event here to avoid the culture being updated twice
            ComboBox_Languages.SelectedItem           = Properties.Settings.Default.DefaultCulture.NativeName;
            this.ComboBox_Languages.SelectionChanged += new System.Windows.Controls.SelectionChangedEventHandler(this.ComboBox_Languages_SelectionChanged);

            FormPopup.RegisterMainWindow(this);//Register main window as the master window, used for displaying popups
            followupSection        = new FollowUpSectionForm();
            shiftSection           = new ShiftsSection();
            mapModificationSection = new AdditionalInfoPage(this);
            teamsSection           = new TeamsSectionPage(this);
            mapSection             = new MapSectionPage(this, mapModificationSection);
            interventionsSection   = new InterventionSectionPage(this);

            previousWidth  = MapSection.ActualWidth;
            previousHeight = MapSection.ActualHeight;

            //Populating the Map modification section
            Frame AIFrame = new Frame();

            AIFrame.Content  = mapModificationSection;
            AIPSection.Child = AIFrame;


            //Populating the Teams section
            Frame teamsFrame = new Frame();

            teamsFrame.Content = teamsSection;
            TeamsSection.Child = teamsFrame;

            //Populating the Map section
            Frame mapFrame = new Frame();

            mapFrame.Content = mapSection;
            MapSection.Child = mapFrame;

            //Populating the Interventions section
            Frame interventionsFrame = new Frame();

            interventionsFrame.Content = interventionsSection;
            InterventionsSection.Child = interventionsFrame;

            //Starting GPS Services tasks
            GPSServices.StartServices(this);
        }
Example #6
0
        public InterventionPin(Intervention intervention, MapSectionPage mapSection) : base(intervention, mapSection, size)
        {
            this.intervention = intervention;             //Providing a link to the team that this pin represents

            //Setting the image and text of the pin
            base.setImage(TechnicalServices.getImage("intervention"));
            base.setText(intervention.getInterventionNumber().ToString());

            //Setting the intervention pin  of all team pins that are intervening on this pin
            foreach (TeamPin teamPin in getInterveningTeamsPin())
            {
                teamPin.setInterventionPin(this);
            }

            //Register as an observer to the intervention instance so that any modification to it are reflected on the map, e.g. addition of a team
            intervention.RegisterInstanceObserver(this);
        }
Example #7
0
        public EquipmentPin(Equipment equipment, MapSectionPage mapSection) : base(equipment, mapSection, size)
        {
            this.equipment = equipment;                                              //Providing a link to the equipment that this pin represents

            base.setImage(TechnicalServices.getImage(equipment.getEquipmentType())); //Setting background image

            //Adding contect menu so that the user can delete the equipment
            MenuItem menuItem = new MenuItem();

            menuItem.Uid    = "MenuItem_EquipmentPin_Delete";
            menuItem.Header = ETD.Properties.Resources.MenuItem_EquipmentPin_Delete;
            menuItem.Click += DeleteEquipment_Click;

            ContextMenu contextMenu = new ContextMenu();

            contextMenu.Items.Add(menuItem);

            this.ContextMenu = contextMenu;
        }
Example #8
0
        //Setting up translation of GPS coordinates (lattitude and longitude) to Map coordinates (x, y)
        internal static void SetupGPSToMapTranslation_Start(MapSectionPage mapSectionInstance, List <Team> registeredTeams)
        {
            setupOngoing = true;

            MessageBox.Show(Properties.Resources.MessageBox_EnteringSetup);

            mapSection = mapSectionInstance;

            //Get the TeamPins of the registered teams
            List <TeamPin> registeredTeamPins = new List <TeamPin>();
            List <Pin>     pinList            = Pin.getPinList();

            foreach (Pin pin in pinList)
            {
                if (registeredTeams.Contains(pin.getRelatedObject()))
                {
                    registeredTeamPins.Add((TeamPin)pin);
                }
            }

            //Hiding all pins except the pins of registered teams, change their context menu for team selection
            Pin.ClearAllPins(mapSection.Canvas_map);
            foreach (TeamPin teamPin in registeredTeamPins)
            {
                MenuItem menuItem = new MenuItem();
                menuItem.Header = "Use this team for setup";
                menuItem.Click += ChooseTeamForSetup_Click;

                ContextMenu contextMenu = new ContextMenu();
                contextMenu.Items.Add(menuItem);
                teamPin.ContextMenu = contextMenu;

                mapSection.Canvas_map.Children.Add(teamPin);
                double[] previousPinPosition = Pin.getPreviousPinPosition(teamPin.getRelatedObject());
                if (previousPinPosition == null)
                {
                    previousPinPosition = new double[] { teamPin.Width / 2, teamPin.Height / 2 };                     //Top-left corner
                }
                teamPin.setPinPosition(previousPinPosition[0], previousPinPosition[1]);
            }

            MessageBox.Show("From the teams that remain on the map, select one of them that will be used for the setup by right-clicking on the team and selecting \"Use this team for setup\".");
        }
Example #9
0
 public TeamPin(Team team, MapSectionPage mapSection, TeamPin parentPin) : this(team, mapSection)
 {
     this.parentPin = parentPin;
 }