private void btnAddSurface_Click(object sender, RoutedEventArgs e) { TemplateSurface tSurf = new TemplateSurface(null, pObjTemplate.ParamNames); bool? result = tSurf.ShowDialog(); if (result == true) { pObjTemplate.Children.Add((tSurf.Tag as ParameterObjectTemplate)); lbxSurfaceList.Items.Add((tSurf.Tag as ParameterObjectTemplate).name); } }
private void btnEditSurface_Click(object sender, RoutedEventArgs e) { if (pObjTemplate.Children == null || pObjTemplate.Children.Count == 0) { return; } int index = lbxSurfaceList.SelectedIndex; if (index >= 0) { TemplateSurface tSurf = new TemplateSurface(pObjTemplate.Children[index], pObjTemplate.ParamNames); bool? result = tSurf.ShowDialog(); if (result == true) { pObjTemplate.Children[index] = tSurf.Tag as ParameterObjectTemplate; lbxSurfaceList.Items.RemoveAt(index); lbxSurfaceList.Items.Insert(index, (tSurf.Tag as ParameterObjectTemplate).name); } } }