/// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            if (IsInDesignMode)
            {
                // Code runs in Blend --> create design time data.
            }
            else
            {
                noLabel = new LabelViewModel(new LabelMock() { Text = "No label" }, this);

                openNote = new OpenNoteCommand(this);
                newNote = new NewNoteCommand(this);
                closeNote = new CloseNoteCommand(this);
                deleteNote = new DeleteNoteCommand(this);
                saveNote = new SaveNoteCommand(this);
                delayedSaveNote = new DelayedSaveNoteCommand(this);
                simpleSearch = new SimpleSearchCommand(this);
                search = new ComplexSearchCommand(this);
                toggleSearch = new ToggleAdvancedSearchCommand(this);
                hideSearch = new HideSearchViewCommand(this);
                hideComplexSearch = new HideComplexSearchCommand(this);

                OpenNotes.CollectionChanged += openNotes_CollectionChanged;
                SearchResults.CollectionChanged += searchResults_CollectionChanged;
            }
        }
        private async void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            Stopwatch t = new Stopwatch();
            SearchResultslistBox.DataContext = new object();
            SearchProgressRing.BeginInit();
            SearchProgressRing.Opacity = 1f;
            SearchProgressRing.IsActive = true;
            SearchProgressRing.EndInit();
            List<SearchResults> res = null;
            t.Start();
            MyCommand.MyCommand search_command = new SimpleSearchCommand();
            if (FrequencySearchradioButton.IsChecked == true)
            {
                search_command = new FrequencySearchCommand(new Reciever(), SearchQuerytextBox.Text);
            }

            if (SimpleSearchradioButton.IsChecked == true)
            {
                search_command = new SimpleSearchCommand(new Reciever(), SearchQuerytextBox.Text);
            }

            if (LocationSearchradioButton.IsChecked == true)
            {
                search_command = new SearchByLocationCommand(new Reciever(), SearchQuerytextBox.Text);
            }

            await Task.Run(() =>
                        {
                            res = this.invoker.ExecuteCommand(search_command);
                            this.invoker.Current++;
                            Application.Current.Dispatcher.BeginInvoke(new System.Action(() =>
                            {
                                SearchResultslistBox.DataContext = res;
                                SearchProgressRing.Opacity = 0f;
                                t.Stop();
                                ExecutionTimetextBlock.Text = t.ElapsedMilliseconds + "ms";
                            }));
                        });
        }