public ImageFilterMenuViewModel(IEnumerable <ImageFilterData> menuItems, SelectedFiltersViewModel selectedVM) { MenuTiles = menuItems.CreateDerivedCollection(ifd => { var menuTile = new ImageFilterMenuTileViewModel(ifd.Id, ifd.Name, ifd.Description); menuTile.Add.Subscribe(x => selectedVM.AddFilter(ImageFilterFactory.CreateFilter(ifd.Id))); return(menuTile); }); }
private static ImageFilter CreateImageFilterModel(SelectedFilterTileViewModel fvm) { var @params = new List <ImageFilterParam>(); foreach (var p in fvm.Parameters) { @params.Add(new ImageFilterParam(p.Name, p.Min, p.Max, p.Step, p.Default) { Value = p.Value }); } return(ImageFilterFactory.CreateFilter(fvm.FilterType, @params.ToArray())); }
public Bootstrap(string fileLocation) { Locator.CurrentMutable.Register(() => new CineImageView(), typeof(IViewFor <ImageViewModel>)); Locator.CurrentMutable.Register(() => new ImageFilterMenuView(), typeof(IViewFor <ImageFilterMenuViewModel>)); Locator.CurrentMutable.Register(() => new ImageFilterMenuTileView(), typeof(IViewFor <ImageFilterMenuTileViewModel>)); Locator.CurrentMutable.Register(() => new SelectedFilterTileView(), typeof(IViewFor <SelectedFilterTileViewModel>)); Locator.CurrentMutable.Register(() => new FilterParameterTileView(), typeof(IViewFor <FilterParameterTileViewModel>)); Locator.CurrentMutable.Register(() => new SelectedFiltersView(), typeof(IViewFor <SelectedFiltersViewModel>)); var imgFilters = ImageFilterFactory.GetAvailableFilters(); var selectedFilters = new List <ImageFilter>(); var selectedFiltersVM = new SelectedFiltersViewModel(); var imgFilterMenuVM = new ImageFilterMenuViewModel(imgFilters, selectedFiltersVM); var cineImgVM = new ImageViewModel(fileLocation, selectedFiltersVM.FiltersChanged); var mainWinVM = new MainWindowViewModel(cineImgVM, imgFilterMenuVM, selectedFiltersVM); _mainView = new MainWindowView(mainWinVM); }