public override void StartSimulation(IRTIambassador rtiAmb)
        {
            if (log.IsInfoEnabled)
            {
                log.Info("Start Time Management simulation");
            }

            try
            {
                rti      = (XrtiExecutiveAmbassador)rtiAmb;
                form     = new TimeManagementForm(rti, this);
                scenario = form.Scenario;

                federateAmbassador = new TimeManagementFederateAmbassador(rtiAmb);
                timeManagementFederateAmbassador = (TimeManagementFederateAmbassador)federateAmbassador;
                mobileServices = new MobileFederateServices(new DoubleValuedLogicalTimeFactory(), new DoubleValuedLogicalTimeIntervalFactory());
                JoinSimulation(rtiAmb, federate.Type, federation.Name);

                AddVisualElements();

                InitFederate();

                // Add Federation's interaction listener
                TimeManagementObjectModelInteractionListener l1 = new TimeManagementObjectModelInteractionListener(rti, mobileServices._timeFactory, home, moveActorInterval, form, this);
                rti.interactionManager.AddInteractionListener(l1);

                MyLowLevelManagementObjectModelInteractionListener l2 = new MyLowLevelManagementObjectModelInteractionListener(rti, "My", form);
                rti.interactionManager.AddInteractionListener(l2);
Esempio n. 2
0
        public void LogAndRtiInit()
        {
            app = new MainApplication(new string[] { "-dialog=false" });

            FileInfo logFile = new System.IO.FileInfo("Log4Net.config");

            if (logFile.Exists)
            {
                // Log4Net is configured using a DOMConfigurator.
                log4net.Config.XmlConfigurator.Configure(logFile);
            }
            else
            {
                // Set up a simple configuration that logs on the console.
                log4net.Config.BasicConfigurator.Configure();
            }

            // Log an baseInfo level message
            if (log.IsDebugEnabled)
            {
                if (string.IsNullOrEmpty(System.Threading.Thread.CurrentThread.Name))
                {
                    System.Threading.Thread.CurrentThread.Name = "Main(" + System.Threading.Thread.CurrentThread.ManagedThreadId + ")";
                }
                log.Debug(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + " Tests Start");
            }

            if (rtiAmbassador == null)
            {
                rtiAmbassador = new XrtiExecutiveAmbassador(app.ConfigSource);
            }
        }
Esempio n. 3
0
        public TimeManagementForm(XrtiExecutiveAmbassador aRti, TimeManagementSimulation aTms)
        {
            InitializeComponent();
            InitializeScenario();

            this.rti = aRti;
            this.tms = aTms;
        }
 public TimeManagementObjectModelInteractionListener(XrtiExecutiveAmbassador aRti,
                                                     ILogicalTimeFactory aTimeFactory, Home home, ILogicalTimeInterval moveActorInterval,
                                                     TimeManagementForm form, TimeManagementSimulation simulation)
 {
     this.rti               = aRti;
     this.timeFactory       = aTimeFactory;
     this.home              = home;
     this.moveActorInterval = moveActorInterval;
     this.form              = form;
     this.simulation        = simulation;
 }
Esempio n. 5
0
 public virtual void TearDown()
 {
     // Log an baseInfo level message
     if (log.IsDebugEnabled)
     {
         log.Debug(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType + " Tests End");
     }
     if (rtiAmbassador != null)
     {
         rtiAmbassador = null;
     }
 }
Esempio n. 6
0
 protected override void OnFormClosed(FormClosedEventArgs e)
 {
     if (rtiAmbassador != null)
     {
         rtiAmbassador.Stop();
         rtiAmbassador = null;
     }
     if (channelManager != null)
     {
         channelManager.Close();
     }
     OnStopPrograms(null, null);
 }
Esempio n. 7
0
        public MainForm(string[] args)
        {
            InitializeComponent();

            app = new MainApplication(args);
            IConfig cfg = app.ConfigSource.Configs["PeerInfo"];

            if (cfg != null)
            {
                peerName        = cfg.Get("PeerName", "NoNamePeer");
                peerDescription = cfg.Get("PeerDescription", "A generic peer description");
            }
            this.Text = "Main Application for " + peerName + " : " + peerDescription;
            OnTraceOn(null, null);
            // Log an info level message
            if (log.IsDebugEnabled)
            {
                System.Threading.Thread.CurrentThread.Name = "Main(" + System.Threading.Thread.CurrentThread.ManagedThreadId + ")";
                log.Debug("Tests Server Start");
            }
            // Write output to the file and to the console screen.
            if (log.IsInfoEnabled)
            {
                log.Info("Welcome to the Sxta Test Kit !");
            }

            if (rtiAmbassador == null)
            {
                rtiAmbassador = new XrtiExecutiveAmbassador(app.ConfigSource);
            }
            OnLoadPlugins();

            showRightToLeft.Checked                 = (RightToLeft == RightToLeft.Yes);
            RightToLeftLayout                       = showRightToLeft.Checked;
            m_objectModelExplorer                   = new ObjectModelExplorer(rtiAmbassador.descriptorManager);
            m_objectModelExplorer.PropertyGrid      = m_propertyWindow;
            m_objectModelExplorer.RightToLeftLayout = RightToLeftLayout;
            m_deserializeDockContent                = new DeserializeDockContent(GetContentFromPersistString);
        }
Esempio n. 8
0
        //protected Dictionary<long, HLAfederation> federations = new Dictionary<long, HLAfederation>();
        //protected IAttributeHandleValueMapFactory factory = new XRTIAttributeHandleValueMapFactory();

        public LowLevelManagementObjectModelInteractionListener(XrtiExecutiveAmbassador p, String aName)
            : base(aName)
        {
            parent = p;
            federationExecutionDescriptor = parent.descriptorManager.GetObjectClassDescriptor("HLAfederationExecution");
        }
Esempio n. 9
0
 public MetaFederationLowLevelManagementInteractionListener(XrtiExecutiveAmbassador p, String aName)
     : base(p, aName)
 {
 }
Esempio n. 10
0
 public ManagementObjectModelInteractionListener(XrtiExecutiveAmbassador p, String aName)
     : base(aName)
 {
     parent = p;
 }
Esempio n. 11
0
 public MyLowLevelManagementObjectModelInteractionListener(XrtiExecutiveAmbassador p, String aName, TimeManagementForm form)
     : base(p, aName)
 {
     this.form = form;
 }
Esempio n. 12
0
        public void ShowInformationFromRtiAmbassador(MetaFederateAmbassador metaFederateAmbassador, XrtiExecutiveAmbassador rti)
        {
            TreeView objectTreeView = this.treeView1;

            objectTreeView.ImageList = this.imageList1;

            if (metaFederateAmbassador != null)
            {
                DumpMetaFederationObjects(metaFederateAmbassador, META_FEDERATION_NODE_NAME);
            }

            if (rti.FederateAmbassador != null)
            {
                IList <HLAobjectRoot> objectsFederation = ((FederateAmbassador)rti.FederateAmbassador).GetObjects();

                DumpFederationObjects(metaFederateAmbassador, objectsFederation, "Federation : " + rti.FederationName, rti.FederationName);
            }

            //objectTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
            //objectTreeView.Location = new System.Drawing.Point(4, 4);
            //objectTreeView.Margin = new System.Windows.Forms.Padding(4);
            //objectTreeView.Name = "Object View";
            //objectTreeView.Size = new System.Drawing.Size(251, 268);
            //objectTreeView.TabIndex = 0;
            //objectTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.TreeViewAfterSelect);
        }