Пример #1
0
 /// <summary>Renders the fractal with the specified bounds, optionally ignoring pushing the bounds on to the history stack.</summary>
 private void RenderNew(Bounds bounds, bool ignoreHistory)
 {
     AsyncLoader.OnFinished += fractal => {
         if (!ignoreHistory)
         {
             History.Push(fractal);
         }
         SetImageDispatch(fractal);
     };
     AsyncLoader.PostFinish += fractal => PostRender(fractal);
     AsyncLoader.LoadAsync(SelectedFractal, bounds);
 }
Пример #2
0
        /// <summary>Creates a new MainWindowViewModel, with dependencies.</summary>
        public MainWindowViewModel(IFractalRenderer renderer, IImageProvider imageProvider, MainWindow mainWindow, IFractalStore fractals, IColorizationStore colorizers)
        {
            this.renderer = renderer;
            this.mainWindow = mainWindow;

            AvailableFractals = fractals;
            AvailableColorizations = colorizers.Select(x => GetViewModel(x)).ToList();

            ImageProvider = imageProvider;
            AsyncLoader = new AsyncLoader(renderer);

            BoundingBoxProvider = new BoundingBoxProvider();
            BoundingBoxProvider.BoxReleased += LoadFractalFromScreenBounds;

            History = new FractalHistoryProvider();
            History.OnBack += OnHistoryBack;

            Commands = new MainWindowCommands(this);

            SelectedColorizer = AvailableColorizations.FirstOrDefault();
            SelectedFractal = AvailableFractals.FirstOrDefault();

            MaximumIterations = 800;
        }
Пример #3
0
        /// <summary>Creates a new MainWindowViewModel, with dependencies.</summary>
        public MainWindowViewModel(IFractalRenderer renderer, IImageProvider imageProvider, MainWindow mainWindow, IFractalStore fractals, IColorizationStore colorizers)
        {
            this.renderer   = renderer;
            this.mainWindow = mainWindow;

            AvailableFractals      = fractals;
            AvailableColorizations = colorizers.Select(x => GetViewModel(x)).ToList();

            ImageProvider = imageProvider;
            AsyncLoader   = new AsyncLoader(renderer);

            BoundingBoxProvider              = new BoundingBoxProvider();
            BoundingBoxProvider.BoxReleased += LoadFractalFromScreenBounds;

            History         = new FractalHistoryProvider();
            History.OnBack += OnHistoryBack;

            Commands = new MainWindowCommands(this);

            SelectedColorizer = AvailableColorizations.FirstOrDefault();
            SelectedFractal   = AvailableFractals.FirstOrDefault();

            MaximumIterations = 800;
        }