private void SetupBindingCombos() { if (DeviceList.SelectedIndex > -1 && MapsView.SelectedIndices.Count > 0) { MidiMap midiMap = (MidiMap)DeviceList.SelectedItem; ControlBinding binding = (ControlBinding)MapsView.SelectedItems[0].Tag; TargetTypeCombo.Items.Clear(); TargetTypeCombo.Items.AddRange(UiTools.GetBindingTargetTypeList()); TargetTypeCombo.SelectedIndex = (int)binding.TargetType; BindTypeCombo.Items.Clear(); BindTypeCombo.Items.AddRange(Enum.GetNames(typeof(BindingType))); BindTypeCombo.SelectedIndex = (int)binding.BindingType; RepeatCheckbox.Checked = binding.Parent.AutoRepeat; UpdatePropertyCombo(); DeviceImage.Invalidate(); } else { TargetTypeCombo.Items.Clear(); BindTypeCombo.Items.Clear(); TargetPropertyCombo.ClearText(); } }
private void UpdatePropertyCombo() { BindingTargetType tt = (BindingTargetType)TargetTypeCombo.SelectedIndex; TargetPropertyCombo.Items.Clear(); TargetPropertyCombo.ClearText(); filterLabel.Visible = false; filterList.Visible = false; if (DeviceList.SelectedIndex > -1 && MapsView.SelectedIndices.Count > 0) { MidiMap midiMap = (MidiMap)DeviceList.SelectedItem; ControlBinding binding = (ControlBinding)MapsView.SelectedItems[0].Tag; binding.TargetType = tt; IScriptable scriptInterface = null; bool comboVisible = true; switch (tt) { case BindingTargetType.Setting: scriptInterface = Settings.Active as IScriptable; break; case BindingTargetType.SpaceTimeController: scriptInterface = SpaceTimeController.ScriptInterface; break; case BindingTargetType.Goto: comboVisible = false; break; case BindingTargetType.Layer: scriptInterface = LayerManager.ScriptInterface; break; case BindingTargetType.Navigation: scriptInterface = Earth3d.MainWindow as IScriptable; break; //case BindingTargetType.Actions: // break; //case BindingTargetType.Key: // break; //case BindingTargetType.Mouse: // break; default: break; } if (comboVisible) { TargetPropertyCombo.Visible = true; PropertyNameText.Visible = false; BindTypeCombo.Visible = true; BindTypeLabel.Visible = true; if (scriptInterface != null) { switch (binding.BindingType) { case BindingType.Action: TargetPropertyCombo.Items.Clear(); TargetPropertyCombo.Items.AddRange(scriptInterface.GetActions()); break; case BindingType.Toggle: TargetPropertyCombo.Items.Clear(); TargetPropertyCombo.Items.AddRange(UiTools.GetFilteredProperties(scriptInterface.GetProperties(), binding.BindingType)); break; case BindingType.SyncValue: TargetPropertyCombo.Items.Clear(); TargetPropertyCombo.Items.AddRange(scriptInterface.GetProperties()); break; case BindingType.SetValue: TargetPropertyCombo.Items.Clear(); TargetPropertyCombo.Items.AddRange(scriptInterface.GetProperties()); break; default: break; } } TargetPropertyCombo.SelectedItem = binding.PropertyName; } else { PropertyNameText.Visible = true; TargetPropertyCombo.Visible = false; PropertyNameText.Text = binding.PropertyName; BindTypeCombo.Visible = false; BindTypeLabel.Visible = false; } MapsView.SelectedItems[0].SubItems[4].Text = binding.ToString(); UpdateSelectedControlMap(); } }