public FilterSelectorViewModel() { // Initialization - Lists InactiveFilters = new ObservableCollection<FilterType>(FilterTypes.GetAllFilters()); ActiveFilters = new ObservableCollection<FilterType>(); ActiveFilters.Add(new FilterType(FilterType.Type.GrayscaleFilter, "Grayscale")); ActiveFilters.Add(new FilterType(FilterType.Type.SobelCompassOperation, "Sobel Compass Operation")); ActiveFilters.Add(new FilterType(FilterType.Type.ThresholdFilter160, "Threshold 160")); ActiveFilters.Add(new FilterType(FilterType.Type.InvertFilter, "Invert Filter")); ActiveFilters.Add(new FilterType(FilterType.Type.ClearBorderFilter, "Clear Border")); // Initialization - Lists Selectors SelectedInactiveFilter = -1; SelectedActiveFilter = -1; // Initialization - Buttons/Commands AddToActiveFilterCommand = new RelayCommand(a => AddToActiveFilter()); RemoveFromActiveFilterCommand = new RelayCommand(a => RemoveFromActiveFilter()); MoveActiveFilterUpCommand = new RelayCommand(a => MoveActiveFilterUp(), b => HasActiveFilterSelected()); MoveActiveFilterDownCommand = new RelayCommand(a => MoveActiveFilterDown(), b => HasActiveFilterSelected()); DeleteAllActiveFiltersCommand = new RelayCommand(a => DeleteAllActiveFilters(), b => HasActiveFilters()); }
public MainViewModel() { // Initial startup HasProgress = Visibility.Hidden; IsBusy = false; // Setup Commands LoadImageButton = new RelayCommand(a => LoadImage(), e => IsNotBusy()); SelectFiltersButton = new RelayCommand(a => SelectFilters(), e => IsNotBusy()); ApplyButton = new RelayCommand(a => ApplyImage(), e => IsNotBusy()); DetectObjectsButton = new RelayCommand(a => DetectObjects(), e => IsNotBusy()); SaveButton = new RelayCommand(a => SaveImage(), e => IsNotBusy()); // Setup for FilterSelectorWindow with ViewModel fsWindow = new FilterSelectorWindow() { DataContext = new FilterSelectorViewModel() }; decoratedFilter = null; // Setup Dialogs openImageDialog = new OpenFileDialog(); openImageDialog.Filter = "Bitmap files|*.bmp;*.gif;*.png;*.tiff;*.jpg;*.jpeg"; saveImageDialog = new SaveFileDialog(); saveImageDialog.Filter = "Bitmap file|*.bmp"; }