private void DoToggleActionArea(TabEntity tab)
 {
     if (!downloadButtonClicked)
     {
         tab.ActionAreaVisible = !tab.ActionAreaVisible;
     }
     downloadButtonClicked = false;
 }
        private void DownloadTabComplete(TabEntity tab, string filePath)
        {
            CurrentTabEntity = tab;
            // TabEntity CurrentPopularTabEntity = SearchPopularTabs.FirstOrDefault(t => t.SearchId == tab.SearchId);
            Deployment.Current.Dispatcher.BeginInvoke(
                () =>
            {
                if (!Database.IsGroupExists(CurrentTabEntity.Group))
                {
                    //Raise Band downloaded
                    Hub.RaiseBandCreated();
                }
                CurrentTab = new Tab
                {
                    Name    = tab.Name,
                    Group   = Database.GetOrCreateGroupByName(tab.Group),
                    TabType = Database.GetTabTypeByName(tab.Type),
                    Rating  = tab.Rating,
                    Path    = filePath,
                };
                Database.InsertTab(CurrentTab);
                //run album images search
                var tabAlbumSearch = _mediaSearcherFactory.Create();
                tabAlbumSearch.MediaSearchCompleted += tabAlbumSearch_MediaSearchCompleted;
                tabAlbumSearch.RunMediaSearch(CurrentTab.Group.Name, CurrentTab.Name);
                Hub.RaiseTabsDownloaded();

                //run group images search
                var groupImagesSearch = _mediaSearcherFactory.Create();
                groupImagesSearch.MediaSearchCompleted += groupImagesSearch_MediaSearchCompleted;
                groupImagesSearch.RunMediaSearch(tab.Group, string.Empty);

                CurrentTabEntity.IsDownloaded = true;
                CurrentTabEntity.Id           = CurrentTab.Id;
                IsDownloading = false;

                Dialog.Show(AppResources.Search_TabDownloadedText,
                            String.Format(AppResources.Search_TabDownloadedTitle, CurrentTabEntity.Name, CurrentTabEntity.Group),
                            new DialogActionContainer
                {
                    OnTapAction = (o, e) => DoGoToTabView(CurrentTab.Id)
                });


                DownloadTab.RaiseCanExecuteChanged();
            });
        }
        private void DoGoToTabView(object sender)
        {
            TabEntity tabEntity = sender as TabEntity;

            if (tabEntity != null)
            {
                Tab tab = (from Tab t in Database.Tabs
                           where t.Id == tabEntity.Id
                           select t).Single();
                NavigationService.NavigateToTab(new Dictionary <string, object>()
                {
                    { "Tab", tab }
                });
                Hub.RaiseBackGroundImageChangeActivity(tab.Group.ExtraLargeImageUrl);
                Hub.RaiseTabBrowsed();
            }
        }