Example #1
0
        private void DestroyView()
        {
            Debug.Assert(this.view != null);
            Debug.Assert(this.model != null);

            this.searchController.DataModelUpdated -= this.OnDataModelUpdated;
            this.searchController.StopSearch();

            this.model.PropertyChanged -= OnViewModelPropertyChanged;
            this.model = null;

            this.view.Closed      -= OnViewClosed;
            this.view.Deactivated -= OnDeactivated;
            this.view              = null;
        }
Example #2
0
        private void CreateView()
        {
            Debug.Assert(this.view == null);
            Debug.Assert(this.model == null);

            this.searchController.DataModelUpdated += this.OnDataModelUpdated;

            this.model = new OmniBoxViewModel(this);
            this.model.PropertyChanged += OnViewModelPropertyChanged;

            // TODO: better ownership behavior for multiple window scenarios. For now, main is king.
            this.view = new OmniBoxView()
            {
                DataContext = this.model,
                Owner       = Application.Current.MainWindow
            };

            this.view.Closed      += this.OnViewClosed;
            this.view.Deactivated += this.OnDeactivated;
        }