void CloneWaveAction() { TriggeredAction selAction = (listBoxActions.SelectedItem as TriggeredAction); if (selAction != null) { TriggeredAction ta = new TriggeredAction(FormMain.Tracker, TheProfile); ta.LoadFromXml(selAction.GetXml()); RefreshActionsListbox(); SkipFlaggedEventHandlers = true; listBoxActions.SelectedItem = ta; SkipFlaggedEventHandlers = false; WaveActionCtl.LoadWaveAction(ta); } }
bool PasteWaveAction(XElement xAction) { if (xAction != null) { TriggeredAction ta = new TriggeredAction(FormMain.Tracker, TheProfile); ta.LoadFromXml(xAction); RefreshActionsListbox(); SkipFlaggedEventHandlers = true; listBoxActions.SelectedItem = ta; SkipFlaggedEventHandlers = false; WaveActionCtl.LoadWaveAction(ta); return(true); } return(false); }
public void LoadFromXml(XElement xUserProfile) { if (xUserProfile != null) { Name = xUserProfile.GetElementValueTrimmed("Name"); Frozen = xUserProfile.GetElementValueBool("Frozen"); RequireHome = xUserProfile.GetElementValueBool("RequireHome"); if (xUserProfile.GetElementValueOrNull("API") == null) { API = Config.LegacyAPI; // backwards compatibility, API was in config-xml before } else { if (Enum.TryParse(xUserProfile.GetElementValueTrimmed("API"), out VRAPI a)) { API = a; } else { API = VRAPI.OculusVR; } } string wout = xUserProfile.GetElementValueTrimmed("WaveOutDeviceSource"); if (Enum.TryParse(wout, out AudioDeviceSource ads)) { WaveOutDeviceSource = ads; } else { if (String.Compare(wout, "Oculus", true) == 0) // backwards compatibility { WaveOutDeviceSource = AudioDeviceSource.OculusHome; } else { WaveOutDeviceSource = AudioDeviceSource.Windows; } } string waveOutName = xUserProfile.GetElementValueTrimmed("WaveOutDeviceName"); TheWaveOutDevice = AudioDevicePool.GetWaveOutDevice(waveOutName); OriginalWaveOutDeviceNotFound = false; if (TheWaveOutDevice == null && WaveOutDeviceSource == AudioDeviceSource.Manual) { OriginalWaveOutDeviceNotFound = true; NotFoundDeviceName = waveOutName; if (API == VRAPI.OculusVR) { WaveOutDeviceSource = AudioDeviceSource.OculusHome; } else { WaveOutDeviceSource = AudioDeviceSource.Windows; } } foreach (var trig in xUserProfile.Descendants().Where(element => element.Name == "TriggeredAction")) { TriggeredAction newAct = new TriggeredAction(FormMain.Tracker, this); newAct.LoadFromXml(trig, false); } } }