using System.Windows; using System.Collections.ObjectModel; using StackedGeometry; using System.Reflection; using System.IO; namespace StackedGeometryDesigner { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { private ObservableCollection<IGeometrySource> geometrySources = new ObservableCollection<IGeometrySource>(); private ObservableCollection<IEffectFactory> effectFactories = new ObservableCollection<IEffectFactory>(); public MainWindow() { InitializeComponent(); } private void Window_Loaded(object sender, RoutedEventArgs e) { Height = 540; geometrySources.Clear(); effectFactories.Clear(); AttributeReflector ar = new AttributeReflector(); ar.ReflectionItems.Add(new AttributeReflectionItem { AssemblyAttribute = typeof(ContainsGeometrySourcesAttribute), ClassAttribute = typeof(GeometrySourceAttribute), List = geometrySources }); ar.ReflectionItems.Add(new AttributeReflectionItem { AssemblyAttribute = typeof(ContainsEffectFactoriesAttribute), ClassAttribute = typeof(EffectFactoryAttribute), List = effectFactories }); string currentAssemblyDirectoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); ar.Reflect(currentAssemblyDirectoryName, SearchOption.AllDirectories); foreach (IGeometrySource gs in geometrySources) { gs.DesignMode = true; } foreach (IEffectFactory ef in effectFactories) { ef.DesignMode = true; } cmbGeometry.ItemsSource = geometrySources; cmbEffectFactory.ItemsSource = effectFactories; cmbGeometry.SelectedIndex = 0; cmbEffectFactory.SelectedIndex = 0; XamlDocumenter doc = (XamlDocumenter)FindResource("StackedDocumenter"); doc.XamlRun = xamlRun; doc.Enabled = false; } private void DisplayTabs_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { XamlDocumenter doc = (XamlDocumenter)FindResource("StackedDocumenter"); if (DisplayTabs.SelectedIndex ==0) { doc.Enabled = false; }else { doc.Enabled = true; } } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)