private void init(LiveSplitState state, USB2SnesW.USB2SnesW usb2snesw) { _state = state; _config_state = ConfigState.NONE; _proto_state = ProtocolState.NONE; _ready_timer = new Stopwatch(); _attached_device = string.Empty; _settings = new ComponentSettings(_state) { Dock = DockStyle.Fill, }; _model = new TimerModel() { CurrentState = _state }; _state.RegisterTimerModel(_model); _stateChanged = false; _splits = new List <string>(); _inTimer = false; _update_timer = new Timer() { Interval = 1000 }; _update_timer.Tick += (sender, args) => UpdateSplitsWrapper(); _update_timer.Enabled = true; _state.OnReset += _state_OnReset; _state.OnStart += _state_OnStart; HorizontalWidth = 3; VerticalHeight = 3; _usb2snes = usb2snesw; }
// Events private async void btnDetectDevice_Click(object sender, EventArgs e) { USB2SnesW.USB2SnesW usb = new USB2SnesW.USB2SnesW(); await usb.Connect(); if (usb.Connected()) { List <String> devices = await usb.GetDevices(); if (devices.Count > 0) { txtDevice.Text = devices[devices.Count - 1]; } return; } MessageBox.Show("Could not auto-detect usb2snes compatible device, make sure it's connected and (Q)Usb2Snes is running"); }
internal USB2SNESComponent(LiveSplitState state, USB2SnesW.USB2SnesW usb2snesw) { init(state, usb2snesw); }