public async void Search_Clicked(object sender, EventArgs e)
        {
            var con = MPDConnection.GetInstance();

            if (con.IsConnected())
            {
                List <MPDFileEntry> list = await Task.Factory.StartNew(() =>
                {
                    List <MPDFileEntry> newList = con.GetSearchedFiles(SearchEntry.Text, currentType);
                    lastSearchTerm = SearchEntry.Text;
                    lastSearchType = currentType;
                    return(newList);
                });

                if (list.Count != 0)
                {
                    SearchResultList = list.Cast <MPDTrack>().ToList();
                }
                else
                {
                    SearchResultList = new List <MPDTrack>();
                    await DisplayAlert("Nothing found", "No files found for your search term", "ok");
                }
            }
        }
        public SearchPage()
        {
            BindingContext = this;
            InitializeComponent();

            foreach (string s in nameToSearchType.Keys)
            {
                TypePicker.Items.Add(s);
            }
            TypePicker.SelectedIndex         = 1;
            TypePicker.SelectedIndexChanged += (sender, args) =>
            {
                string typeName = TypePicker.Items[TypePicker.SelectedIndex];
                currentType = nameToSearchType[typeName];
            };
        }
        public static SongListPage CreateWithSearch(string searchValue, MPDCommands.MPD_SEARCH_TYPE searchType)
        {
            SongListPage result = new SongListPage()
            {
                Title = searchValue, type = searchType, listType = ListType.SEARCH
            };

            CreateToolbarItems(result);

            Task t = Task.Factory.StartNew(async() =>
            {
                await Task.Delay(App.PAGE_ANIMATION_DELAY);
                await result.GetSongsFromMPD();
            });

            return(result);
        }