private void UpdateItem(int index) { numVertices = 0; if (index >= 0 && index < Variables.Count) { ObservedVariable variable = Variables[index]; if (DebugHandler.Debugger.CurrentMode == dbgDebugMode.dbgBreakMode) { PointCloud pointCloud = null; if (variable.MemberData == null) { pointCloud = DebugHandler.Load(variable.Name); } else { pointCloud = DebugHandler.Load(variable.Name, variable.MemberData); } if (pointCloud != null) { OpenGL gl = openGLControl.OpenGL; vao.Bind(gl); vbo.Bind(gl); gl.BufferData(OpenGL.GL_ARRAY_BUFFER, pointCloud.vertices, OpenGL.GL_STATIC_DRAW); numVertices = pointCloud.numVertices; } } } }
public void AddItem(string name, PointCloudVisualizationData memberData) { bool success = false; if (Variables.Count > 0) { var variable = Variables[Variables.Count - 1]; if (variable.Name == null || variable.Name == "") { variable = new ObservedVariable(name); variable.MemberData = memberData; ResetAt(variable, Variables.Count - 1); SelectItem(Variables.Count - 1); UpdateItem(Variables.Count - 1); success = true; } } if (!success) { var variable = new ObservedVariable(name); variable.MemberData = memberData; ResetAt(variable, Variables.Count); SelectItem(Variables.Count - 1); } ResetAt(new ObservedVariable(), Variables.Count); }
private void SelectCurrentItem(object sender, KeyboardFocusChangedEventArgs e) { TextBox item = (TextBox)sender; ObservedVariable var = (ObservedVariable)item.DataContext; int index = Variables.IndexOf(var); SelectItem(index); }
private void ResetAt(ObservedVariable item, int index) { ((System.ComponentModel.INotifyPropertyChanged)item).PropertyChanged += ObservedVariable_NameChanged; if (index < Variables.Count) { Variables.RemoveAt(index); } Variables.Insert(index, item); }
private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListBox list = (ListBox)sender; ObservedVariable variable = (ObservedVariable)list.SelectedItem; int index = Variables.IndexOf(variable); currentlyObservedVariable = index; if (index < 0 || index >= listBox.Items.Count) { return; } UpdateItem(index); }