Exemplo n.º 1
0
        // Funtion to open a new dialog window to load the virtual world file
        public void GetStimulus()
        {
            string fileName = "";
            Thread t        = new Thread((ThreadStart)(() =>
            {
                OpenFileDialog fileDialog = new OpenFileDialog();
                fileDialog.InitialDirectory = Assembly.GetExecutingAssembly().Location;
                fileDialog.Title = "Open File";
                fileDialog.Filter = "XML Files (*.xml)|*.xml|" +
                                    "All Files (*.*)|*.*";

                if (fileDialog.ShowDialog() == DialogResult.OK)
                {
                    fileName = fileDialog.SafeFileName;
                    root = LoadStimulus(fileDialog.FileName);
                }
            }));

            t.SetApartmentState(ApartmentState.STA);
            t.Start();
            t.Join();

            if (root != null)
            {
                Init(root);
                VRProtocolFactory vrpF = (VRProtocolFactory)root.objectBuilder[0];
                vrpF.Initialize(root, this);
                this.vRProtocol = (VRProtocol)root.GetService(typeof(VRProtocol));
                if (vRProtocol.recordCam1 || vRProtocol.recordCam2 || vRProtocol.recordTracking || vRProtocol.recordStimulus || vRProtocol.recordPhotodiode)
                {
                    CreateSaveDirectory(fileName, this.vRProtocol);
                }
            }
        }
Exemplo n.º 2
0
        public void GetStimulus(string protName)
        {
            root = LoadStimulus(protName);
            string fileName = Path.GetFileName(protName);

            if (root != null)
            {
                Init(root);
                VRProtocolFactory vrpF = (VRProtocolFactory)root.objectBuilder[0];
                vrpF.Initialize(root, this);
                this.vRProtocol = (VRProtocol)root.GetService(typeof(VRProtocol));
                if (vRProtocol.recordCam1 || vRProtocol.recordCam2 || vRProtocol.recordTracking || vRProtocol.recordStimulus || vRProtocol.recordPhotodiode)
                {
                    CreateSaveDirectory(fileName, this.vRProtocol);
                }
            }
        }