public InstrumentMenu(InstrumentBoundUserInterface owner) { RobustXamlLoader.Load(this); IoCManager.InjectDependencies(this); _owner = owner; if (_owner.Instrument != null) { _owner.Instrument.OnMidiPlaybackEnded += InstrumentOnMidiPlaybackEnded; Title = IoCManager.Resolve <IEntityManager>().GetComponent <MetaDataComponent>(_owner.Instrument.Owner).EntityName; LoopButton.Disabled = !_owner.Instrument.IsMidiOpen; LoopButton.Pressed = _owner.Instrument.LoopMidi; StopButton.Disabled = !_owner.Instrument.IsMidiOpen; PlaybackSlider.MouseFilter = _owner.Instrument.IsMidiOpen ? MouseFilterMode.Pass : MouseFilterMode.Ignore; } if (!_midiManager.IsAvailable) { UnavailableOverlay.Visible = true; // We return early as to not give the buttons behavior. return; } InputButton.OnToggled += MidiInputButtonOnOnToggled; FileButton.OnPressed += MidiFileButtonOnOnPressed; LoopButton.OnToggled += MidiLoopButtonOnOnToggled; StopButton.OnPressed += MidiStopButtonOnPressed; PlaybackSlider.OnValueChanged += PlaybackSliderSeek; PlaybackSlider.OnKeyBindUp += PlaybackSliderKeyUp; MinSize = SetSize = (400, 150); }