Example #1
0
        public MainWindow()
        {
            InitializeComponent();

            Settings.Recompute += RecomputeFractal;

            foreach (var DragEffectName in Enum.GetNames(typeof(DragEffect)))
            {
                var menuItem = new MenuItem()
                {
                    Header = DragEffectName.Replace('_', ' '),
                    Tag    = (ushort)((int)Enum.Parse(typeof(DragEffect), DragEffectName)),
                };

                if (DragEffectName == "Reset")
                {
                    menuItem.Click += (object sender, RoutedEventArgs e) =>
                    {
                        AlgorithmFunction = Function;
                        RecomputeFractal();
                    }
                }
                ;
                else
                {
                    menuItem.Click += (object sender, RoutedEventArgs e) => Settings.Instance.drageffect = (ushort)((sender as MenuItem).Tag);
                }

                ContextMenuDragEffects.Items.Add(menuItem);
            }

            foreach (var DragEffectName in Enum.GetNames(typeof(Algorithm)))
            {
                var menuItem = new MenuItem()
                {
                    Header = DragEffectName.Replace('_', ' '),
                    Tag    = (ushort)((int)Enum.Parse(typeof(Algorithm), DragEffectName)),
                };
                menuItem.Click += (object sender, RoutedEventArgs e) => Settings.Instance.algorithm = (ushort)((sender as MenuItem).Tag);
                ContextMenuAlgorithms.Items.Add(menuItem);
            }

            foreach (var DragEffectName in Enum.GetNames(typeof(Colorer)))
            {
                var menuItem = new MenuItem()
                {
                    Header = DragEffectName.Replace('_', ' '),
                    Tag    = (ushort)((int)Enum.Parse(typeof(Colorer), DragEffectName)),
                };
                menuItem.Click += (object sender, RoutedEventArgs e) => Settings.Instance.colorer = (ushort)((sender as MenuItem).Tag);
                ContextMenuColorer.Items.Add(menuItem);
            }
        }
Example #2
0
        public SettingsWindow()
        {
            DataContext = Settings.Instance;
            InitializeComponent();

            foreach (var DragEffectName in Enum.GetNames(typeof(DragEffect)))
            {
                DragEffectComboBox.Items.Add(new ComboBoxItem()
                {
                    Content = DragEffectName.Replace('_', ' ')
                });
            }

            foreach (var AlgorithmName in Enum.GetNames(typeof(Algorithm)))
            {
                AlgorithmComboBox.Items.Add(new ComboBoxItem()
                {
                    Content = AlgorithmName.Replace('_', ' ')
                });
            }
        }