/// <summary> /// 重置选中的接口参数 /// </summary> /// <param name="info"></param> private void DoReSetParameterCommand(InterfaceInfo info) { ParameterEditor patameterEditor = new ParameterEditor(info.ParameterFileName, this.curentBrokerType); bool? dil = patameterEditor.ShowDialog(); if (dil.HasValue && dil.Value) { //重新加载配置 } }
public AnalysisDebugRenderer(Font font, Player.Player player) { projection = Matrix4.CreateOrthographicOffCenter(0f, 1f, 1f, 0f, 0.0f, 10f); // 0,0 in top left float offset = 1.0f; int drawOrder = 1; components.Add(waterfall = new DebugSpectrumWaterfall() { DrawOrder = drawOrder++, ModelMatrix = GetLayout(0.5f, ref offset), ProjectionMatrix = projection }); components.Add(freqTracker = new BasicShaderHost("debugpeakfreq.glsl|vert", "debugpeakfreq.glsl|frag") { DrawOrder = drawOrder++, ModelMatrix = GetLayout(0.3f, ref offset), ProjectionMatrix = projection }); components.Add(spectrum = new DebugSpectrum() { DrawOrder = drawOrder++, ModelMatrix = GetLayout(0.2f, ref offset), ProjectionMatrix = projection }); components.Add(waterfall2 = new DebugSpectrum2() { DrawOrder = drawOrder++, ModelMatrix = GetLayout(0.2f, ref offset), ProjectionMatrix = projection }); components.Add(datagraphs = new DebugAudioData(font, player.FilterOutputNames) { DrawOrder = drawOrder++, ModelMatrix = GetLayout(10.0f, ref offset), ProjectionMatrix = projection }); components.Add(keyboardActions = new KeyboardActionManager() { KeyboardPriority = 100 }, 1); components.Add(parameterEditor = new ParameterEditor(font) { DrawOrder = drawOrder++ }); keyboardActions.Add(Keys.Up, 0, () => { ypostarget += yshift; }); keyboardActions.Add(Keys.Down, 0, () => { ypostarget -= yshift; }); //parameterEditor.AddParameter("p1", () => 123.4567f, (f) => { }); //parameterEditor.AddParameter("p2", () => 0.007f, (f) => { }); // copy parameters over foreach (var p in player.FilterParameters) { parameterEditor.AddParameter($"{p.Item1}_{p.Item2.Name}", p.Item2.GetValue, p.Item2.SetValue, p.Item2.Delta); } }
public void CustomizeView(Dynamo.Nodes.Symbol symbol, NodeView nodeView) { var input = new ParameterEditor(nodeView.ViewModel); nodeView.inputGrid.Children.Add(input); Grid.SetColumn(input, 0); Grid.SetRow(input, 0); input.DataContext = this; input.SetBinding(ParameterEditor.ParameterProperty, new Binding("InputSymbol") { Mode = BindingMode.OneWay, Source = symbol }); }
private void SetActiveEditParameterItem(ParameterListViewItem parameterItem, bool allowFocusChange) { if (parameterItem == null) { if (this._parameterEditor != null) { this._parameterEditor.Visible = false; this._parameterEditor = null; } } else { ParameterEditor editor = null; if (this._inAdvancedMode) { editor = this._advancedParameterEditor; } else if (parameterItem.Parameter != null) { if (parameterItem.Parameter.GetType() == typeof(Parameter)) { editor = this._staticParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(ControlParameter)) { editor = this._controlParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(FormParameter)) { editor = this._formParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(QueryStringParameter)) { editor = this._queryStringParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(CookieParameter)) { editor = this._cookieParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(SessionParameter)) { editor = this._sessionParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(ProfileParameter)) { editor = this._profileParameterEditor; } else if (parameterItem.Parameter.GetType() == typeof(RouteParameter)) { editor = this._routeParameterEditor; } } if (this._parameterEditor != editor) { if (this._parameterEditor != null) { this._parameterEditor.Visible = false; } this._parameterEditor = editor; } if (this._parameterEditor != null) { this._parameterEditor.InitializeParameter(parameterItem); this._parameterEditor.Visible = true; if (allowFocusChange) { this._parameterEditor.SetDefaultFocus(); } } } }
void Start() { if (uiHolder != null) { ParameterEditor.holder = uiHolder; } GetTarget(); FieldInfo[] infos = typeof(Parameters.Parameters).GetFields(); foreach (FieldInfo info in infos) { object[] attrs = info.GetCustomAttributes(true); foreach (object attr in attrs) { if (attr is ParameterAttribute) { ParameterAttribute parameterAttr = attr as ParameterAttribute; if (parameterAttr != null) { string name; if (parameterAttr.GetName() != "") { name = parameterAttr.GetName(); } else { name = info.Name; } ParameterEditor editor = parameterAttr.GetEditor(info.GetValue(target)); if (editor != null) { parameterEditors.Add(info, editor); continue; } bool found = false; switch (info.FieldType.ToString()) { case "System.String": parameterEditors.Add(info, new StringParameterEditor(name)); found = true; break; case "System.Single": parameterEditors.Add(info, new FloatParameterEditor(name, (float)info.GetValue(target))); found = true; break; case "System.Int32": parameterEditors.Add(info, new IntParameterEditor(name, (int)info.GetValue(target))); found = true; break; case "System.Boolean": parameterEditors.Add(info, new BooleanParameterEditor(name, (bool)info.GetValue(target))); found = true; break; } if (found == false && info.FieldType.BaseType == typeof(Enum)) { parameterEditors.Add(info, new EnumParameterEditor(name, info.FieldType, info.GetValue(target).ToString())); } } break; } } } }