void StartRecording(SettingsMapItem map = null) { if (map == null) { map = RecordAllMaps.FirstOrDefault(); if (map == null) { return; } RecordAllMaps.Remove(map); } var cbx = (ComboBox)map.Control; /* * if (_CurrentCbx != cbx) * _CurrentCbx = cbx; */ _Imager.Recorder.StartRecording(map); var helpText = SettingsConverter.ThumbDirections.Contains(map.Code) || SettingsConverter.TriggerButtonCodes.Contains(map.Code) ? "Move Axis" : "Press Button"; XboxImage.HelpTextLabel.Content = helpText; GeneralPanel.RemapAllButton.Content = RemapStopName; }
private void UpdateControlFromDInput() { lock (updateFromDirectInputLock) { var ud = CurrentUserDevice; var instanceGuid = Guid.Empty; var enable = ud != null; if (enable) { instanceGuid = ud.InstanceGuid; } ControlsHelper.SetEnabled(GeneralPanel.RemapAllButton, enable && ud.DiState != null); PadItemPanel.SetEnabled(enable); // If device instance changed then... if (!Equals(instanceGuid, _InstanceGuid)) { _InstanceGuid = instanceGuid; GeneralPanel.ResetDiMenuStrip(enable ? ud : null); } // Update direct input form and return actions (pressed Buttons/DPads, turned Axis/Sliders). UpdateDirectInputTabPage(ud); DInputPanel.UpdateFrom(ud); if (enable && _Imager.Recorder.Recording) { // Stop recording if DInput value captured. var stopped = _Imager.Recorder.StopRecording(ud.DiState); // If value was found and recording stopped then... if (stopped) { // Device not initialized yet. if (ud.DiState == null) { RecordAllMaps.Clear(); } if (RecordAllMaps.Count == 0) { if (ud.DiState != null) { XboxImage.SetHelpText(XboxImage.MappingDone); } else { XboxImage.HelpTextLabel.Content = ""; } GeneralPanel.RemapAllButton.Content = RemapName; return; } else { XboxImage.HelpTextLabel.Content = ""; } // Try to record next available control from the list. ControlsHelper.BeginInvoke(() => StartRecording(), 1000); } } } }
public bool StopRecording() { RecordAllMaps.Clear(); GeneralPanel.RemapAllButton.Content = RemapName; return(_Imager.Recorder.StopRecording()); }