コード例 #1
0
        public void LoadConfigurations()
        {
            try
            {
                var xdoc    = XDocument.Load("configuration.xml");
                var entries = from e in xdoc.Descendants("HapticDevices")
                              select new
                {
                    HapticType      = (string)e.Attribute("hapticType"),
                    WorkstationName = (string)e.Attribute("workstationName"),
                    ListeningMode   = (string)e.Attribute("listeningMode"),
                    IpAddress       = (string)e.Attribute("ipAddress")
                };

                for (int i = 0; i < entries.Count(); i++)
                {
                    HapticDevice device = new HapticDevice();
                    device.hapticType      = entries.ElementAt(i).HapticType;
                    device.workstationName = entries.ElementAt(i).WorkstationName;
                    device.listeningMode   = entries.ElementAt(i).ListeningMode;
                    device.ipAddress       = entries.ElementAt(i).IpAddress;
                    _devices.AddLast(device);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Error in loading configurations: " + e);
            }
        }
コード例 #2
0
ファイル: NovintFalcon.cs プロジェクト: Araxor/mouvtor
 private bool DeviceOperation(HapticDevice device)
 {
     device.Force.Update();
     return(true);
 }