Esempio n. 1
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            //ADD New Track
            List <String> ids;
            List <String> names;

            AllObjectIDs(out ids, out names);
            SelectObjectDialog dlg = new SelectObjectDialog();

            dlg.Owner = this;
            dlg.SetList(ids, names, _mostRecentlyClickedObject);
            if (dlg.ShowDialog().Value == false)
            {
                return;
            }
            if (IsBeingTracked(dlg.SelectedID))
            {
                MessageBox.Show(this, "That asset is already being tracked");
                return;
            }
            if (MaxTracks <= Objects.Count)
            {
                MessageBox.Show(this, String.Format("Adding this track would exceed your maximum number of tracks ({0}); Try removing a Track before adding a new track.", MaxTracks));
                return;
            }
            DDDObj d = GetFromAllObjects(dlg.SelectedID);

            Objects.Add(d);

            AddAlert("A new object (" + d.ID + ") was added", Urgency.NONE);
            SendTrackAddedEvent(MyDM, d.ID);
        }
Esempio n. 2
0
        private void ViewProInitializeObject(SimulationEvent ev)
        {//TargetPlayer, ObjectID, CurrentClassification
            if (((StringValue)ev["TargetPlayer"]).value != MyDM)
            {
                return;
            }
            //add object to AllObjects
            String objectID = ((StringValue)ev["ObjectID"]).value;

            if (IsInAllObjects(objectID))
            {
                return;
            }
            String objName = String.Format("unknown{0}", UnknownObjectCount++);
            DDDObj d       = new DDDObj(objectID, objName, "", "", "");

            AllObjects.Add(d);
        }
Esempio n. 3
0
        private void ViewProAttributeUpdate(SimulationEvent ev)
        {//TargetPlayer, ObjectID, Attributes
            //if Tracked asset, update attributes
            if (((StringValue)ev["TargetPlayer"]).value != MyDM)
            {
                return;
            }
            String objectID = ((StringValue)ev["ObjectID"]).value;
            //if (!IsBeingTracked(objectID))
            //    return;

            DDDObj d = GetFromAllObjects(objectID);

            if (d == null)
            {
                return;
            }
            AttributeCollectionValue acv = ev["Attributes"] as AttributeCollectionValue;

            if (acv.attributes.ContainsKey("ObjectName"))
            {
                if (((StringValue)acv["ObjectName"]).value != "")
                {
                    d.Name = ((StringValue)acv["ObjectName"]).value;
                }
            }
            if (acv.attributes.ContainsKey("ClassName"))
            {
                d.Type = ((StringValue)acv["ClassName"]).value;
            }
            if (acv.attributes.ContainsKey("CurrentClassification"))
            {
                d.Classification = ((StringValue)acv["CurrentClassification"]).value;
            }
            if (acv.attributes.ContainsKey("GroundTruthIFF"))
            {
                d.IFF = ((StringValue)acv["GroundTruthIFF"]).value;
            }
            if (IsBeingTracked(objectID))
            {
                RefreshTrackInfo();
            }
        }
Esempio n. 4
0
        private void ObjectSelected(SimulationEvent ev)
        {
            if (((StringValue)ev["UserID"]).value != MyDM)
            {
                return;
            }
            String objectID = ((StringValue)ev["ObjectID"]).value;

            _mostRecentlyClickedObject = objectID;
            DDDObj d = GetFromAllObjects(objectID);

            if (d == null)
            {
                return;
            }
            String tag = "unknown";

            if (d.Name != String.Empty)
            {
                tag = d.Name;
            }
            SimulationEvent evnt = new SimulationEvent();

            evnt.eventType = "UpdateTag";
            evnt.parameters.Add("Time", DataValueFactory.BuildInteger(time));
            evnt.parameters.Add("UnitID", DataValueFactory.BuildString(objectID));
            evnt.parameters.Add("Tag", DataValueFactory.BuildString(tag));
            List <String> dms = new List <string>();

            if (MyDM.Contains("Individ"))
            {
                dms.Add(MyDM);
            }
            else
            {
                dms.Add("BAMS DM");
                dms.Add("Firescout DM");
            }
            evnt.parameters.Add("TeamMembers", DataValueFactory.BuildStringList(dms));
            DDDConnection.SendSimEvent(evnt);//.SendObjectAttributeUpdateEvent(objectID, "InitialTag", DataValueFactory.BuildString(tag));
        }
Esempio n. 5
0
        private void AttackStarted(String attacker, String defender)
        {
            if (!IsBeingTracked(attacker))
            {
                return;
            }
            //if target is MV, alert user
            try
            {
                DDDObj d = GetFromAllObjects(defender);
                if (d == null)
                {
                    return;
                }

                String msg = String.Format("HOSTILE: Tracked object '{0}' has engaged the vessel '{1}'", attacker, defender);

                AddAlert(msg, Urgency.HIGH);
            }
            catch (Exception ex)
            {
                return;
            }
        }
Esempio n. 6
0
 private void ViewProInitializeObject(SimulationEvent ev)
 {//TargetPlayer, ObjectID, CurrentClassification
     if (((StringValue)ev["TargetPlayer"]).value != MyDM)
         return;
     //add object to AllObjects
     String objectID = ((StringValue)ev["ObjectID"]).value;
     if (IsInAllObjects(objectID))
         return;
     String objName = String.Format("unknown{0}", UnknownObjectCount++);
     DDDObj d = new DDDObj(objectID, objName, "", "", "");
     AllObjects.Add(d);
 }