Ejemplo n.º 1
0
        private void ClearPathsToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            CustomPathWaypoints.Clear();
            CustomPathStartWaypoints.Clear();
            CustomPathEndWaypoints.Clear();
            CustomPathNames.Clear();

            MapPictureBox.Invalidate();
        }
Ejemplo n.º 2
0
        private void LoadPathToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Text |*.txt";
            ofd.Title  = "Open path";
            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                try
                {
                    string path = File.ReadAllText(ofd.FileName);

                    string[] waypointsComponents = path.Split(';');

                    List <uint> mapIds = Program.ExtractCommaDelimitedUInts(waypointsComponents[0].Trim());

                    if (mapIds[0] != SetPathWaypoints[0].MapId)
                    {
                        MessageBox.Show("Path not on current map.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    List <double>   xs           = Program.ExtractCommaDelimitedDoubles(waypointsComponents[1].Trim());
                    List <double>   ys           = Program.ExtractCommaDelimitedDoubles(waypointsComponents[2].Trim());
                    List <Waypoint> waypointList = new List <Waypoint>();

                    for (int i = 0; i < mapIds.Count; i++)
                    {
                        waypointList.Add(new Waypoint(mapIds[i], xs[i], ys[i]));
                    }

                    CustomPathWaypoints.AddRange(waypointList);
                    CustomPathStartWaypoints.Add(waypointList[0]);
                    CustomPathEndWaypoints.Add(waypointList[waypointList.Count - 1]);

                    FileInfo fi = new FileInfo(ofd.FileName);
                    CustomPathNames.Add(fi.Name);

                    MapPictureBox.Invalidate();
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 3
0
        public void ProcessThisTag(object sender, TagEventArgs e)
        {
            // show current RFID tag to label
            theRFIDstring = Convert.ToString(e.Tag);
            // just test
            tempClient        = null;
            tempCampSpotGuest = null;

            if ((tempClient = connectionDB.SearchClient(theRFIDstring)) != null)
            {
                if (!assignOtherGuests)
                {
                    tempCampHost = null;

                    if ((tempCampHost = connectionDB.SearchCampHost(tempClient.AccountNumber)) != null)
                    {
                        groupBox1.BackColor = Color.Green;
                        groupBox2.BackColor = Color.Gray;
                        HostName.Text       = "Name: " + tempClient.First_name;
                        NrOfGuest.Text      = "Guest to assign :" + tempCampHost.NumberOfGuests.ToString();
                        CampSpotNumber.Text = "Number: " + tempCampHost.Camp_id.ToString();

                        assignOtherGuests    = true;
                        LatterButton.Visible = true;
                    }
                    else if ((tempCampSpotGuest = connectionDB.SearchCampGuest(tempClient.AccountNumber)) != null)
                    {
                        groupBox1.BackColor = Color.Yellow;
                        HostName.Text       = "Name: " + tempClient.First_name;
                        NrOfGuest.Text      = " ";
                        groupBox2.BackColor = Color.Green;
                        CampSpotNumber.Text = "Number: " + tempCampSpotGuest.CampId;
                    }
                    else
                    {
                        groupBox1.BackColor = Color.Red;
                        groupBox2.BackColor = Color.Red;

                        HostName.Text       = "..";
                        NrOfGuest.Text      = "..";
                        CampSpotNumber.Text = "..";
                        MessageBox.Show(tempClient.First_name + " is not assignet to any Camp Spot Or had paid for one!");
                    }
                }
                else
                {
                    connectionDB.AssignGuest(tempCampHost, tempClient.AccountNumber);
                    groupBox1.BackColor = Color.Gray;
                    HostName.Text       = "Name: " + tempClient.First_name;
                    groupBox2.BackColor = Color.Green;
                    CampSpotNumber.Text = "Number: " + tempCampHost.Camp_id;
                    tempCampHost.numberOfGuests--;
                    NrOfGuest.Text = tempCampHost.numberOfGuests.ToString();
                    if (tempCampHost.numberOfGuests == 0)
                    {
                        assignOtherGuests    = false;
                        LatterButton.Visible = false;
                    }
                }
            }
            else
            {
                groupBox1.BackColor = Color.Red;
                groupBox2.BackColor = Color.Red;
                HostName.Text       = "RFID is not registered!";
                NrOfGuest.Text      = "...";
                CampSpotNumber.Text = "..";
                MessageBox.Show("RFID is not registered!");
            }

            MapPictureBox.Refresh();
        }
Ejemplo n.º 4
0
 private void M_ApiDataUpdateTimer_Tick(object sender, System.EventArgs e)
 {
     MapPictureBox.Invalidate();
 }
Ejemplo n.º 5
0
        public void ProcessThisTag(object sender, TagEventArgs e)
        {
            // show current RFID tag to label
            theRFIDstring = Convert.ToString(e.Tag);
            // just test
            tempClient        = null;
            tempCampSpotGuest = null;

            if ((tempClient = connectionDB.SearchClient(theRFIDstring)) != null) // if RFID is assigned
            {
                if (!assignOtherGuests)                                          // if assigning other guest
                {
                    tempCampHost = null;

                    if ((tempCampHost = connectionDB.SearchCampHost(tempClient.AccountNumber)) != null) // check if Client payed for camp spot
                    {
                        groupBox1.BackColor = Color.Green;
                        groupBox2.BackColor = Color.Gray;
                        HostName.Text       = "Name: " + tempClient.First_name;
                        NrOfGuest.Text      = "Guest to assign :" + tempCampHost.NumberOfGuests.ToString();
                        CampSpotNumber.Text = "Number: " + tempCampHost.Camp_id.ToString();

                        if (tempCampHost.numberOfGuests > 0) // checks if he stil have some guest to assign
                        {
                            assignOtherGuests    = true;     // next rfid (if in db) will be assigned to same camp spot as HOST
                            LatterButton.Visible = true;
                        }
                    }
                    else if ((tempCampSpotGuest = connectionDB.SearchCampGuest(tempClient.AccountNumber)) != null) //checks if client is assigned to any camp spot
                    {
                        groupBox1.BackColor = Color.Yellow;
                        HostName.Text       = "Name: " + tempClient.First_name;
                        NrOfGuest.Text      = " ";
                        groupBox2.BackColor = Color.Green;
                        CampSpotNumber.Text = "Number: " + tempCampSpotGuest.CampId;
                    }
                    else      // Client is in db but not assiged to any camp spot ar have payed for one
                    {
                        groupBox1.BackColor = Color.Red;
                        groupBox2.BackColor = Color.Red;

                        HostName.Text       = "..";
                        NrOfGuest.Text      = "..";
                        CampSpotNumber.Text = "..";
                        MessageBox.Show(tempClient.First_name + " is not assignet to any Camp Spot Or had payed for one!");
                    }
                }
                else
                {
                    if (tempCampHost.numberOfGuests > 0)   //check if there is still guest left to assign
                    {
                        connectionDB.AssignGuest(tempCampHost, tempClient.AccountNumber);
                        groupBox1.BackColor = Color.Gray;
                        HostName.Text       = "Name: " + tempClient.First_name;
                        groupBox2.BackColor = Color.Green;
                        CampSpotNumber.Text = "Number: " + tempCampHost.Camp_id;
                        tempCampHost.numberOfGuests--;
                        NrOfGuest.Text = tempCampHost.numberOfGuests.ToString();
                    }
                    else
                    {
                        assignOtherGuests    = false;
                        LatterButton.Visible = false;
                    }
                }
            }
            else // rfid is not assigned to any client
            {
                groupBox1.BackColor = Color.Red;
                groupBox2.BackColor = Color.Red;
                HostName.Text       = "RFID is not registered!";
                NrOfGuest.Text      = "...";
                CampSpotNumber.Text = "..";
                MessageBox.Show("RFID is not registered!");
            }

            MapPictureBox.Refresh();
        }