static void MergeDefinitionLists <T>(List <T> output, List <T> input) where T : MyDefinitionBase { m_helperDict.Clear(); foreach (MyDefinitionBase definition in output) { m_helperDict[definition.Id] = definition; } foreach (var definition in input) { if (definition.Enabled) { m_helperDict[definition.Id] = definition; } else { m_helperDict.Remove(definition.Id); } } output.Clear(); foreach (var definition in m_helperDict.Values) { output.Add((T)definition); } m_helperDict.Clear(); }
private void UserControl_Loaded(object sender, RoutedEventArgs e) { (DataContext as ShaderEditorPageViewModel).TextEditor = textEditor; _loaded = true; _columnWidthMap.Clear(); _columnWidthMap.Add(new DefinitionStorage(explorerColumn.ActualWidth, MinimumWidthExplorer, explorerColumn)); _columnWidthMap.Add(new DefinitionStorage(codeViewColumn.ActualWidth, MinimumWidthCodeView, codeViewColumn)); _columnWidthMap.Add(new DefinitionStorage(shaderViewPropColumn.ActualWidth, MinimumWidthViewportShaderProp, shaderViewPropColumn)); _errorRowHeight = errorRow.ActualHeight; _shaderPropertiesHeight = shaderPropertiesRow.ActualHeight; _viewportHeight = viewportRow.ActualHeight; explorerColumn.Width = new GridLength(_columnWidthMap[explorerColumn].Actual, GridUnitType.Star); codeViewColumn.Width = new GridLength(_columnWidthMap[codeViewColumn].Actual, GridUnitType.Star); shaderViewPropColumn.Width = new GridLength(_columnWidthMap[shaderViewPropColumn].Actual, GridUnitType.Star); errorRow.Height = new GridLength(_errorRowHeight, GridUnitType.Star); shaderPropertiesRow.Height = new GridLength(_shaderPropertiesHeight, GridUnitType.Star); viewportRow.Height = new GridLength(_viewportHeight, GridUnitType.Star); editorRow.Height = new GridLength(editorRow.ActualHeight, GridUnitType.Star); }