Example #1
0
        // Update positions of all Teams who are Tracked or Delayed
        // Update the positions of all Places/
        // This function sends the list of teams to the HTTP server
        /// <summary>
        /// Sends the list of tracked items to http server.
        /// </summary>
        private void UpdateHttpStatus()
        {
            List <TeamData> ltd = new List <TeamData>();

            foreach (TeamData tdi in m_Teams.Values)
            {
                if ((tdi.Status == TrackStatus.TRACKING) ||
                    (tdi.Status == TrackStatus.DELAYED))
                {
                    ltd.Add(tdi);
                }
            }
            foreach (PlaceData pdi in m_Places.Values)
            {
                TeamData tdi = new TeamData();
                tdi.Description = pdi.Description;
                tdi.Name        = pdi.Name;
                tdi.Coordinates = pdi.Coordinates;
                tdi.Status      = TrackStatus.PLACES;
                ltd.Add(tdi);
            }
            m_TrackingServer.Update(ltd);
        }
Example #2
0
        /// <summary>
        /// Called when user double-clicks on the Team/Place - bring appropriate dialog
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StatusView_DoubleClick(object sender, EventArgs e)
        {
            if (StatusView.SelectedItems.Count != 0)
            {
                ListViewItem lvi   = StatusView.SelectedItems[0];
                String       lvigs = lvi.Group.Name;
                if (lvigs.Equals("Places"))
                {
                    AddPlace ap_dlg = new AddPlace();
                    if (m_Places.ContainsKey(lvi.Name))
                    {
                        ap_dlg.m_PlaceData = m_Places[lvi.Name];
                    }
                    else
                    {
                        PlaceData pd = new PlaceData();
                        pd.Name             = lvi.SubItems[1].Text;
                        pd.Coordinates.MGRS = lvi.SubItems[2].Text;
                        ap_dlg.m_PlaceData  = pd;
                    }
                    ap_dlg.Text = "Change/View Place";
                    if (ap_dlg.ShowDialog() == DialogResult.OK)
                    {
                        PlaceData pd = ap_dlg.m_PlaceData;
                        m_Places[pd.Name] = pd; UpdateTrackingHistory(pd);

                        lvi.SubItems.Clear();
                        lvi.Name = pd.Name;
                        lvi.Text = "*****";
                        lvi.SubItems.Add(pd.Name);
                        lvi.SubItems.Add(pd.Coordinates.MGRS + " / " + pd.Coordinates.Latitude.ToString("N6") + ", " + pd.Coordinates.Longitude.ToString("N6"));
                        DateTime add_time = DateTime.Now;
                        lvi.SubItems.Add(add_time.ToShortTimeString() + add_time.ToUniversalTime().ToString(" (HH:mm:ssZ)"));
                    }
                }
                else
                {
                    AddTeam at_dlg = new AddTeam();
                    at_dlg.m_PlaceData = m_Places;

                    if (m_Teams.ContainsKey(lvi.Text))
                    {
                        at_dlg.m_TeamData = m_Teams[lvi.Text];
                    }
                    else
                    {
                        TeamData td = new TeamData();
                        td.CID              = lvi.Text;
                        td.Name             = lvi.SubItems[1].Text;
                        td.Coordinates.MGRS = lvi.SubItems[2].Text;
                        at_dlg.m_TeamData   = td;
                    }
                    at_dlg.Text = "Change/View Team";
                    if (at_dlg.ShowDialog() == DialogResult.OK)
                    {
                        TeamData td = at_dlg.m_TeamData;
                        td.Coordinates.Time = DateTime.Now;
                        m_Teams[td.CID]     = td;  UpdateTrackingHistory(td);
                        lvi.SubItems.Clear();
                        lvi.Name = td.CID;
                        lvi.Text = td.CID;
                        lvi.SubItems.Add(td.Name);
                        lvi.SubItems.Add(td.Coordinates.MGRS + " / " + td.Coordinates.Latitude.ToString("N6") + ", " + td.Coordinates.Longitude.ToString("N6"));
                        DateTime add_time = td.Coordinates.Time;
                        lvi.SubItems.Add(add_time.ToShortTimeString() + add_time.ToUniversalTime().ToString(" (HH:mm:ssZ)"));
                    }
                }
            }
        }