public void OnItemTap(SearchResultVM result) { //if (AppStats.Current.IsTrialExpired) //{ // App.MessageTrialCount(true); // return; //} FoodItem item = null; try { item = result.MakeItem() as FoodItem; } catch (Exception ex) { LittleWatson.ReportException(ex); } if (item == null) { return; } int i = 0; try { for (int j = 0; j < this.ItemList.Count; j++) { if (ItemList[j] == result) { i = j; } } } catch (Exception ex) { LittleWatson.ReportException(ex); } SessionLog.RecordNewEntry(item.Text, result.GetType().Name, "Recent Item", null, i); Entry entry = new Entry(this.date, this.period, item); entry.Save(); MessageQueue.Push(new EntryUpdatedMessage(entry)); EntryList.Insert(0, new EntryRowVM(entry)); ItemList.Remove(result); if (EntryList.Count == 1) { NotifyPropertyChanged("NoEntriesVisibility"); } }
public void OnItemTap(SearchResultVM result) { if (result.IsLocked) { // Navigate.ToBuyNowPage (); return; } FoodItem item = null; try { item = result.MakeItem() as FoodItem; } catch (Exception ex) { LittleWatson.ReportException(ex); } if (item == null) { return; } int i = 0; try { if (Results != null) { for (int j = 0; j < Results.Count; j++) { if (Results[j] == result) { i = j; } } } } catch (Exception ex) { LittleWatson.ReportException(ex); } TraceQuery(true, true); SessionLog.RecordNewEntry(item.Text, result.GetType().Name, Query, LastQuery, i); // Entry entry = new Entry(Navigate.selectedDate, Navigate.selectedPeriod, item); // // if (item.IsNewItem) // Navigate.ToEntryDetail(entry); // else // { // // if (Navigate.IAcceptsNewEntry != null) // if (!Navigate.IAcceptsNewEntry.ShouldSaveNewEntry(entry)) // { // Navigate.BackFromSearch(); // return; // } // // entry.Save(); // // MessageQueue.Push(new EntryUpdatedMessage(entry)); // // //Cache.AddEntry(entry); // <-- the double entry bug!!! // Navigate.BackFromSearch(); // } }