public Run_Review_Session_Form()
        {
            InitializeComponent();
            if (TCPProcessor.ConnectedToServer)
                _remote_DataManager = (Patient_Remote_DataManager)Activator.GetObject(typeof(Patient_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005, "PatientRemoteDataManagerConnection"));

            //Register for events from the server
            TCPProcessor.AvatarSpeedChangedEvent += new TCPProcessor.AvatarSpeedChangedHandler(TCPProcessor_AvatarSpeedChangedEvent);
            TCPProcessor.FilteredMarkerListReceivedEvent += new TCPProcessor.FilteredMarkerListReceivedHandler(TCPProcessor_FilteredMarkerListReceivedEvent);
            TCPProcessor.TrackableListReceivedEvent += new TCPProcessor.TrackableListReceivedHandler(TCPProcessor_TrackableListReceivedEvent);
            TCPProcessor.JointListReceivedEvent += new TCPProcessor.JointListReceivedHandler(TCPProcessor_JointListReceivedEvent);


            m_objectsToDraw = (StromoLight_RemoteDrawingList.DrawingList)Activator.GetObject(typeof(StromoLight_RemoteDrawingList.DrawingList), "tcp://localhost:8002/TaskDesignerConnection");

            StroMoHab_Task_Designer.Externals.LoadVisualiser(m_objectsToDraw);

            _delayedWindowSetup.Interval = 1500;
            _delayedWindowSetup.Tick += new EventHandler(_delayedWindowSetup_Tick);
            _delayedWindowSetup.Start();
            this.TopMost = true;

            _waitForVisualiser.Interval = 1000;
            _waitForVisualiser.Start();
            _waitForVisualiser.Tick += new EventHandler(_waitForVisualiser_Tick);

            _guiUpdate.Interval = 100;
            _guiUpdate.Tick += new EventHandler(_guiUpdate_Tick);
            _guiUpdate.Start();
        }
Ejemplo n.º 2
0
        public Run_Review_Session_Form()
        {
            InitializeComponent();
            if (TCPProcessor.ConnectedToServer)
            {
                _remote_DataManager = (Patient_Remote_DataManager)Activator.GetObject(typeof(Patient_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005, "PatientRemoteDataManagerConnection"));
            }

            //Register for events from the server
            TCPProcessor.AvatarSpeedChangedEvent         += new TCPProcessor.AvatarSpeedChangedHandler(TCPProcessor_AvatarSpeedChangedEvent);
            TCPProcessor.FilteredMarkerListReceivedEvent += new TCPProcessor.FilteredMarkerListReceivedHandler(TCPProcessor_FilteredMarkerListReceivedEvent);
            TCPProcessor.TrackableListReceivedEvent      += new TCPProcessor.TrackableListReceivedHandler(TCPProcessor_TrackableListReceivedEvent);
            TCPProcessor.JointListReceivedEvent          += new TCPProcessor.JointListReceivedHandler(TCPProcessor_JointListReceivedEvent);


            m_objectsToDraw = (StromoLight_RemoteDrawingList.DrawingList)Activator.GetObject(typeof(StromoLight_RemoteDrawingList.DrawingList), "tcp://localhost:8002/TaskDesignerConnection");

            StroMoHab_Task_Designer.Externals.LoadVisualiser(m_objectsToDraw);

            _delayedWindowSetup.Interval = 1500;
            _delayedWindowSetup.Tick    += new EventHandler(_delayedWindowSetup_Tick);
            _delayedWindowSetup.Start();
            this.TopMost = true;

            _waitForVisualiser.Interval = 1000;
            _waitForVisualiser.Start();
            _waitForVisualiser.Tick += new EventHandler(_waitForVisualiser_Tick);

            _guiUpdate.Interval = 100;
            _guiUpdate.Tick    += new EventHandler(_guiUpdate_Tick);
            _guiUpdate.Start();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Attempts to load the Visualiser.
        /// </summary>
        /// <param name="objectsToDraw"></param>
        public static void LoadVisualiser(StromoLight_RemoteDrawingList.DrawingList objectsToDraw)
        {
            string visualiserPath;

            try
            {
                objectsToDraw.Initialise();

                WindowAlignment.BringVisualiserToFrontAndAlignWindows();
            }
            catch (System.Net.Sockets.SocketException socketException)
            {
                System.Diagnostics.Debug.WriteLine("The Visualiser is not running. Attempting to start the Visualiser. Exeception message: " + socketException.Message);
                try
                {
                    if (System.IO.File.Exists("StromoLight_Visualiser.exe")) // installed to same dir
                    {
                        visualiserPath = new DirectoryInfo(Environment.CurrentDirectory) + @"\StromoLight_Visualiser.exe";
                    }
                    else // otherwise running from visual studio solutions
                    {
                        DirectoryInfo dInfo = new DirectoryInfo(Environment.CurrentDirectory);
                        // go back down towards the root looking for Visual studio solutions, if you get to the root then break
                        while (dInfo.Name != "Visual Studio Solutions")
                        {
                            if (dInfo.FullName == dInfo.Root.Name)
                            {
                                break;
                            }
                            dInfo = dInfo.Parent;
                        }
                        #if (DEBUG)
                        //go back up towards the visualiser
                        visualiserPath = dInfo.FullName + @"\StromoLight_Visualiser\StromoLight_Visualiser\bin\Debug\StromoLight_Visualiser.exe";
                        #endif
                        #if (!DEBUG)
                        //go back up towards the visualiser
                        visualiserPath = dInfo.FullName + @"\StromoLight_Visualiser\StromoLight_Visualiser\bin\Release\StromoLight_Visualiser.exe";
                        #endif
                    }
                    if (File.Exists(visualiserPath)) // Check that its been found
                    {
                        System.Diagnostics.Process.Start(visualiserPath);
                    }
                    else
                    {
                        throw new System.IO.FileNotFoundException("Cannot find the visualiser");
                    }
                }
                catch (System.IO.IOException ioException)
                {
                    System.Windows.Forms.MessageBox.Show("Visualiser not found. Please start manually. Exception message: " + ioException.Message, "IO Exception");
                    System.Diagnostics.Debug.WriteLine("Exception Message: " + ioException.Message);
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Main Task Designer Form.
        /// </summary>
        public Form_TaskDesigner()
        {
            InitializeComponent();

            m_objectsToDraw = (StromoLight_RemoteDrawingList.DrawingList)Activator.GetObject(typeof(StromoLight_RemoteDrawingList.DrawingList), "tcp://localhost:8002/TaskDesignerConnection");
            m_prevHeight = this.numericUpDownObjectHeight.Value;
            
            Connect();
            //Set up getting tasks from server
            
            remote_DataManager = (Task_Remote_DataManager)Activator.GetObject(typeof(Task_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005,"TaskRemoteDataManagerConnection"));
            
            //make the default task
            _defaultTask = new Task();
            Corridor corridor = new Corridor(-1.5f, 0.0f, 4.0f, 1.5f, 6.0f, -500.0f);
            _defaultTask.ObjectList.Add(corridor);
           
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Main Task Designer Form.
        /// </summary>
        public Form_TaskDesigner()
        {
            InitializeComponent();

            m_objectsToDraw = (StromoLight_RemoteDrawingList.DrawingList)Activator.GetObject(typeof(StromoLight_RemoteDrawingList.DrawingList), "tcp://localhost:8002/TaskDesignerConnection");
            m_prevHeight    = this.numericUpDownObjectHeight.Value;

            Connect();
            //Set up getting tasks from server

            remote_DataManager = (Task_Remote_DataManager)Activator.GetObject(typeof(Task_Remote_DataManager), TCPProcessor.BuildServerRemotingString(8005, "TaskRemoteDataManagerConnection"));

            //make the default task
            _defaultTask = new Task();
            Corridor corridor = new Corridor(-1.5f, 0.0f, 4.0f, 1.5f, 6.0f, -500.0f);

            _defaultTask.ObjectList.Add(corridor);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Loads the default StromoLight task.
        /// </summary>
        /// <param name="objectsToDraw"></param>
        public static void LoadDefaultTask(StromoLight_RemoteDrawingList.DrawingList objectsToDraw)
        {
            bool   defaultTaskFileFound = false;
            string defaultTaskPath      = null;

            try
            {
                DirectoryInfo defaultTaskDirectoryInfo = new DirectoryInfo(Environment.CurrentDirectory);
                defaultTaskDirectoryInfo = defaultTaskDirectoryInfo.Parent;
                defaultTaskPath          = defaultTaskDirectoryInfo.FullName + @"\Tasks\tightropeTest.spf";

                //If running in release enviroment
                if (File.Exists(defaultTaskPath))
                {
                    defaultTaskFileFound = true;
                }
            }
            catch (DirectoryNotFoundException ex)
            {
                System.Windows.Forms.MessageBox.Show("Unable to find default task file. Default task not loaded. Exception message: " + ex.Message, "Default Task File Missing");
            }

            if (defaultTaskFileFound == true)
            {
                //Pause to allow the visualiser to initialise
                System.Threading.Thread.Sleep(5000);

                //Load the default task
                objectsToDraw.ObjectsToDraw = TaskFileIO.Open(defaultTaskPath);

                //if the task doesn't load
                while (objectsToDraw.ObjectsToDraw.Count <= 1)
                {
                    //keep trying until it does.
                    objectsToDraw.ObjectsToDraw = TaskFileIO.Open(defaultTaskPath);
                }
            }
        }