public MainViewModel() { _statisticsViewModel = new StatisticsViewModel(); _buildingSettingsViewModel = new BuildingSettingsViewModel(); _presetsTreeViewModel = new PresetsTreeViewModel(new TreeLocalization()); _presetsTreeSearchViewModel = new PresetsTreeSearchViewModel(); _presetsTreeSearchViewModel.PropertyChanged += PresetsTreeSearchViewModel_PropertyChanged; _welcomeViewModel = new WelcomeViewModel(); _aboutViewModel = new AboutViewModel(); OpenProjectHomepageCommand = new RelayCommand(OpenProjectHomepage); CloseWindowCommand = new RelayCommand <ICloseable>(CloseWindow); CanvasResetZoomCommand = new RelayCommand(CanvasResetZoom); CanvasNormalizeCommand = new RelayCommand(CanvasNormalize); UpdateLanguage(); }
private void PresetsTreeSearchViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (string.Equals(e.PropertyName, nameof(PresetsTreeSearchViewModel.SearchText), StringComparison.OrdinalIgnoreCase)) { PresetsTreeViewModel.FilterText = PresetsTreeSearchViewModel.SearchText; if (string.IsNullOrWhiteSpace(PresetsTreeSearchViewModel.SearchText)) { PresetsTreeViewModel.SetCondensedTreeState(_treeViewState, AnnoCanvas.BuildingPresets.Version); } } else if (string.Equals(e.PropertyName, nameof(PresetsTreeSearchViewModel.HasFocus), StringComparison.OrdinalIgnoreCase) && PresetsTreeSearchViewModel.HasFocus && string.IsNullOrWhiteSpace(PresetsTreeSearchViewModel.SearchText)) { _treeViewState = PresetsTreeViewModel.GetCondensedTreeState(); } }