示例#1
0
    //Public method that allows to remove a button recording
    public void RemoveButton(string name, float timeButton, string button)
    {
        VRPNButtonRecordings test;

        if (VRPNButtonDevice.TryGetValue(button, out test))
        {
            List <VRPNButtonRecording> .Enumerator e = test.recordings.GetEnumerator();
            VRPNButtonRecording recording            = null;
            while (e.MoveNext())
            {
                if (e.Current.reportTime == timeButton && e.Current.name == name)
                {
                    recording = e.Current;
                    break;
                }
            }
            if (recording != null)
            {
                test.recordings.Remove(recording);
            }
            if (test.recordings.Count == 0)
            {
                VRPNButtonDevice.Remove(button);
            }
        }
    }
示例#2
0
    //Public method that allows to add a button recording
    public void AddButton(string name, float timeButton, string path)
    {
        if (File.Exists(path))
        {
            BinaryFormatter          bf   = new BinaryFormatter();
            FileStream               file = File.Open(path, FileMode.Open);
            VRPNButton.ButtonReports data = (VRPNButton.ButtonReports)bf.Deserialize(file);

            file.Close();

            VRPNButtonRecording recording = new VRPNButtonRecording(name, timeButton, data);

            VRPNButtonRecordings test;
            if (VRPNButtonDevice.TryGetValue(data.deviceType + " " + data.deviceName, out test))
            {
                test.recordings.Add(recording);
            }
            else
            {
                test = new VRPNButtonRecordings();
                test.recordings.Add(recording);
                VRPNButtonDevice.Add(data.deviceType + " " + data.deviceName, test);
            }
        }
    }
示例#3
0
    //Public method that allows to add a button recording
    public void AddButton(string name, float timeButton, string path)
    {
        if (File.Exists(path))
        {
            BinaryFormatter bf = new BinaryFormatter();
            FileStream file = File.Open(path, FileMode.Open);
            VRPNButton.ButtonReports data = (VRPNButton.ButtonReports)bf.Deserialize(file);

            file.Close();

            VRPNButtonRecording recording = new VRPNButtonRecording(name, timeButton, data);

            VRPNButtonRecordings test;
            if (VRPNButtonDevice.TryGetValue(data.deviceType + " " + data.deviceName, out test))
            {
                test.recordings.Add(recording);
            }
            else
            {
                test = new VRPNButtonRecordings();
                test.recordings.Add(recording);
                VRPNButtonDevice.Add(data.deviceType + " " + data.deviceName, test);
            }
        }
    }