private void ColorMapping_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (PseudoColor_Panel != null) { ComboBox comboBox = sender as ComboBox; if (comboBox != null) { ComboBoxItem comboBoxItem = comboBox.SelectedItem as ComboBoxItem; if (comboBoxItem != null) { PseudoColor_Panel.Effect = null; string name = comboBoxItem.Name.ToString(); if (!String.IsNullOrWhiteSpace(name) && name != "None") { string file = PseudoColorPath + name + ".lut"; ColorMappingEffect colorMappingEffect = new ColorMappingEffect(); ImageBrush colorMappingBrush = new ImageBrush(); colorMappingBrush.ImageSource = new BitmapImage(new Uri(file, UriKind.RelativeOrAbsolute)); colorMappingEffect.MappingTextureSampler = colorMappingBrush; PseudoColor_Panel.Effect = colorMappingEffect; } else { name = "None"; } HistoryPseudoColor pseudoColor = new HistoryPseudoColor(); pseudoColor.name = name; if (!HistoryList.IsOpen && !IsMacroButtonClicked && !IsApplyHistoryFromSetup) { m_History.AddStep(pseudoColor); } IsMacroButtonClicked = false; IsApplyHistoryFromSetup = false; } } } }
private void ColorMapping_SelectionChanged (object sender, SelectionChangedEventArgs e) { if (PseudoColor_Panel != null) { ComboBox comboBox = sender as ComboBox; if (comboBox != null) { ComboBoxItem comboBoxItem = comboBox.SelectedItem as ComboBoxItem; if (comboBoxItem != null) { PseudoColor_Panel.Effect = null; string name = comboBoxItem.Name.ToString(); if (!String.IsNullOrWhiteSpace(name) && name != "None") { string file = PseudoColorPath + name + ".lut"; ColorMappingEffect colorMappingEffect = new ColorMappingEffect(); ImageBrush colorMappingBrush = new ImageBrush(); colorMappingBrush.ImageSource = new BitmapImage(new Uri(file, UriKind.RelativeOrAbsolute)); colorMappingEffect.MappingTextureSampler = colorMappingBrush; PseudoColor_Panel.Effect = colorMappingEffect; } else { name = "None"; } HistoryPseudoColor pseudoColor = new HistoryPseudoColor(); pseudoColor.name = name; if (!HistoryList.IsOpen && !IsMacroButtonClicked && !IsApplyHistoryFromSetup) { m_History.AddStep(pseudoColor); } IsMacroButtonClicked = false; IsApplyHistoryFromSetup = false; } } } }