public void AddRequest(RecentSearch search) { var database = _client.GetDatabase("db"); var collection = database.GetCollection <RecentSearch>("history"); collection.InsertOne(search); }
public SearchedSongsViewModel(ISongDataProvider songDataProvider, IQueuedSongDataProvider queuedSongDataProvider, ISearchHistoryProvider searchHistory, IVoiceControl voiceControl, IEventAggregator eventAggregator, IRegionManager regionManager, IDjHorsifyService djHorsifyService, ILoggerFacade loggerFacade) : base(queuedSongDataProvider, eventAggregator, loggerFacade) { _eventAggregator = eventAggregator; _regionManager = regionManager; _djHorsifyService = djHorsifyService; _voiceControl = voiceControl; _voiceControl.VoiceCommandSent += _voiceControl_VoiceCommandSent; _songDataProvider = songDataProvider; _searchHistory = searchHistory; RecentSearch = new RecentSearch(); SearchedSongs = _songDataProvider.SearchedSongs; SongsListView = new ListCollectionView(_songDataProvider.SearchedSongs); SongsListView.CurrentChanged += SongsListView_CurrentChanged; //Dialog requests RequestRandomViewRequest = new InteractionRequest <INotification>(); RequestSortDialogRequest = new InteractionRequest <INotification>(); RequestViewCommand = new DelegateCommand <string>((viewName) => OnRequestView(viewName)); }
protected async void SaveRecentSearch() { var recentSearch = this.Item.RecentSearches.FirstOrDefault( o => o.Recent.ToLowerInvariant() == this.Item.Location.ToLowerInvariant()); if (recentSearch == null) { RecentSearch newRecent = new RecentSearch(); newRecent.Recent = this.Item.Location; newRecent.TotalResult = this.Item.ItemCount; newRecent.Date = DateTime.Now; this.Item.RecentSearches.Insert(0, newRecent); await this.LocalRepository.InsertAsync(newRecent); } else { if (this.Item.RecentSearches.IndexOf(recentSearch) > 0) { this.Item.RecentSearches.Remove(recentSearch); this.Item.RecentSearches.Insert(0, recentSearch); } recentSearch.Date = DateTime.Now; await this.LocalRepository.UpdateAsync(recentSearch); } }
private void Button_RecentSearchClick(object sender, RoutedEventArgs e) { FrameworkElement fe = sender as FrameworkElement; RecentSearch recentSearch = fe.DataContext as RecentSearch; RecentSearchSelected(this, new RecentSearchSelectedEventArgs(recentSearch)); }
public void AddRequest(RecentSearch search) { _history.Add(search); if (_history.Count > MAX_HISTORY_SIZE) { _history.RemoveAt(0); } }
public override void Navigated(NavigatedParameter parameter) { if (parameter.Data is SearchResult) { SearchResult transferedResult = parameter.Data as SearchResult; this.ViewQuery.FilterQuery = transferedResult.Location; base.OnDataLoaded(transferedResult.Items, DataLoadingMode.Load); } else { RecentSearch recent = parameter.Data as RecentSearch; this.ViewQuery.FilterQuery = recent.Recent; base.Navigated(parameter); } }
private void ResultsListItem_Clicked(object sender, AdapterView.ItemClickEventArgs e) { if (showingRecentSearches) { RecentSearchAdapter adapter = (RecentSearchAdapter)resultsList.Adapter; RecentSearch item = adapter.GetItem(e.Position); RecentSearchSelected(this, new RecentSearchSelectedEventArgs(item)); } else { AmbiguousLocationsAdapter adapter = (AmbiguousLocationsAdapter)resultsList.Adapter; Location item = adapter.GetItem(e.Position); LocationSelected(this, new LocationSelectedEventArgs(item)); } }
public void UpdateCell(RecentSearch aRecentSearch) { this.lblKeyword.Text = aRecentSearch.Keyword; this.lblLocation.Text = aRecentSearch.Location; AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate; if (appDelegate.Window.Frame.Size.Width == 320 && appDelegate.Window.Frame.Size.Height == 568) { this.lblKeyword.Frame = new CGRect(100, 10, 200, 21); this.lblLocation.Frame = new CGRect(100, 35, 200, 21); } else if (appDelegate.Window.Frame.Size.Width == 414) { // iPhone 6+ this.lblKeyword.Frame = new CGRect(100, 10, 290, 21); this.lblLocation.Frame = new CGRect(100, 35, 290, 21); } }
/// <summary> /// Adds the given search to the RecentSearches list. /// </summary> public void AddSearchToRecent(RecentSearch search) { // if we already have this search saved, move it to the top if (RecentSearches.Any(r => r.Search.DisplayText == search.Search.DisplayText)) { var matchingSearch = RecentSearches.Single(r => r.Search.DisplayText == search.Search.DisplayText); RecentSearches.Remove(matchingSearch); RecentSearches.Insert(0, matchingSearch); } else { // otherwise, add it RecentSearches.Insert(0, search); if (RecentSearches.Count > 4) { RecentSearches.RemoveAt(RecentSearches.Count - 1); } } _persistenceService.SaveState(this); }
public async Task <Tweet[]> ObserveNewTweetMentionsAsync(string search_term) { List <Tweet> ToReturn = new List <Tweet>(); DateTimeOffset LastObservedAt = await GetMostRecentlyProcessedTweetProcessedAtAsync(); //Get the tweets TwitterService ts = new TwitterService(TwitterBearerToken); RecentSearch rs = await ts.RecentSearchAsync(search_term, 25, null, new TweetField[] { TweetField.CreatedAt, TweetField.AuthorId }); if (rs.Tweets != null) { if (rs.Tweets.Length > 0) { //Collect the ones that apply foreach (Tweet t in rs.Tweets) { if (t.CreatedAt.Value > LastObservedAt) { ToReturn.Add(t); } } //Get the newest DateTimeOffset newest = rs.Tweets[0].CreatedAt.Value; foreach (Tweet t in rs.Tweets) { if (t.CreatedAt.Value > newest) { newest = t.CreatedAt.Value; } } //Upload the newest time await UploadMostRecentlyProcessedTweetProcessedAtAsync(newest); } } return(ToReturn.ToArray()); }
void AddRecentSearchData() { string keyword = this.txtKeyword.Text.Trim(); string location = this.txtLocation.Text.Trim(); if (string.IsNullOrEmpty(keyword) && string.IsNullOrEmpty(location)) { // Blank search so Don't save search // do nothing } else { if (string.IsNullOrEmpty(keyword)) { keyword = "N/A"; } if (string.IsNullOrEmpty(location)) { location = "N/A"; } // Add search into local data base RecentSearch _aRecentSearch = new RecentSearch { Keyword = keyword, Location = location, LocationLatLong = Constants.LocationLatLong }; DbHelper.AddRecentSearch(_aRecentSearch); // Refresh the listing. _recentSearchs = DbHelper.GetRecentSearches(); tblView.Source = new TableSource(jobList, _recentSearchs, isRecentSearch, this); tblView.ReloadData(); } }
public void Remove(RecentSearch file) { _files.Remove(file); }
public void Add(RecentSearch file) { if (file == null) throw new ArgumentNullException("file"); _files.AddOrUpdate(file); }
private void DoRecentSearchSelected(RecentSearch recentSearch) { _searchItem = recentSearch.Search; SearchText = recentSearch.Search.DisplayText; SearchForProperties(); }
public override void RowSelected(UITableView tableView, NSIndexPath indexPath) { if (isRecentSearch) { int index = _recentSearchs.Count - 1 - indexPath.Row; RecentSearch aRecentSearch = _recentSearchs[index]; string keyword = aRecentSearch.Keyword; string location = aRecentSearch.Location; if (keyword.Equals("N/A")) { keyword = ""; } if (location.Equals("N/A")) { location = ""; } if (!string.IsNullOrEmpty(aRecentSearch.LocationLatLong)) { Constants.LocationLatLong = aRecentSearch.LocationLatLong; } _introViewCtrl.searchJobButtonPressed = true; _introViewCtrl.txtKeyword.Text = keyword; _introViewCtrl.txtLocation.Text = location; _introViewCtrl.GetJobSearchData(keyword, location); } else { string keyword = _introViewCtrl.txtKeyword.Text.Trim(); string location = _introViewCtrl.txtLocation.Text.Trim(); if (keyword.Equals("N/A")) { keyword = ""; } if (location.Equals("N/A")) { location = ""; } Constants.JobKeyword = keyword; Constants.JobLocation = location; JobCMS aJob = jobList[indexPath.Row]; AppDelegate appDelegate = (AppDelegate)UIApplication.SharedApplication.Delegate; UIStoryboard storyboard = UIStoryboard.FromName(appDelegate.storyboard, null); var jobDetailVC = (JobDetailVC)storyboard.InstantiateViewController("JobDetailVC"); jobDetailVC.JobId = aJob.JobId; jobDetailVC.jobTitle = aJob.JobTitle; jobDetailVC.postingDate = aJob.PostedDate; jobDetailVC.salary = aJob.Salary; jobDetailVC.jobCategory = aJob.JobCategoryTitle; jobDetailVC.aJob = aJob; jobDetailVC.loaction = aJob.JobLocation; jobDetailVC.isNew = aJob.isExpiredorNew; _introViewCtrl.NavController.PushViewController(jobDetailVC, true); } tableView.DeselectRow(indexPath, true); }
private void RecentSearchItem_Clicked(object sender, AdapterView.ItemClickEventArgs e) { RecentSearch item = adapter.GetItem(e.Position); RecentSearchSelected(this, new RecentSearchSelectedEventArgs(item)); }