public MainViewModel()
        {
            var setting = SearchQueryCompilerBuilder.Instance.BuildUpDefaultObjectCompilerSetting<ProductViewModel>();
            compiler = SearchQueryCompilerBuilder.Instance.BuildUpCompiler<ProductViewModel>(setting);
            Preferences = new PreferencesViewModel(((App)Application.Current).Preferences);

            Products = new ObservableCollection<ProductViewModel>();
            SearchResult = new ObservableCollection<ProductViewModel>();
            AutoCompleteItems = new ObservableCollection<IAutoCompleteItem>(setting.ExtractAutoCompleteItems());

            SearchCommand = new RelayCommand(o => Search(o.ToString()));
            LogCommand = new RelayCommand(o => OpenDiagnosticsView());
            PreferencesCommand = new RelayCommand(o => OpenPreferencesView());
            AboutCommand = new RelayCommand(o => OpenAboutView());
            CloseCommand = new RelayCommand(o => Close());
        }
示例#2
0
        public MainViewModel()
        {
            var setting = SearchQueryCompilerBuilder.Instance.BuildUpDefaultObjectCompilerSetting <ProductViewModel>();

            compiler    = SearchQueryCompilerBuilder.Instance.BuildUpCompiler <ProductViewModel>(setting);
            Preferences = new PreferencesViewModel(((App)Application.Current).Preferences);

            Products          = new ObservableCollection <ProductViewModel>();
            SearchResult      = new ObservableCollection <ProductViewModel>();
            AutoCompleteItems = new ObservableCollection <IAutoCompleteItem>(setting.ExtractAutoCompleteItems());

            SearchCommand      = new RelayCommand(o => Search(o.ToString()));
            LogCommand         = new RelayCommand(o => OpenDiagnosticsView());
            PreferencesCommand = new RelayCommand(o => OpenPreferencesView());
            AboutCommand       = new RelayCommand(o => OpenAboutView());
            CloseCommand       = new RelayCommand(o => Close());
        }
示例#3
0
        private void OpenPreferencesView()
        {
            PreferencesWindow    view  = new PreferencesWindow();
            PreferencesViewModel model = new PreferencesViewModel(((App)Application.Current).Preferences);

            model.CloseRequired += delegate
            {
                view.Close();
            };
            model.Committed += delegate
            {
                Preferences = model;
            };

            view.DataContext = model;
            view.ShowDialog();
        }
        private void OpenPreferencesView()
        {
            PreferencesWindow view = new PreferencesWindow();
            PreferencesViewModel model = new PreferencesViewModel(((App)Application.Current).Preferences);

            model.CloseRequired += delegate
            {
                view.Close();
            };
            model.Committed += delegate
            {
                Preferences = model;
            };

            view.DataContext = model;
            view.ShowDialog();
        }