/// <summary> /// Calls web api to get the data from the cloud /// </summary> /// <returns>Data that was received from the web API/cloud</returns> public List <Location> GetDataList() { List <Location> mResponse = TidalioApi.GetInstance() .FetchLocations(AuthHelper.GetInstance(Activity).CurrentUserEmail); return(mResponse); }
/// <summary> /// Calls web api to get the data from the cloud /// </summary> /// <returns>Data that was received from the web API/cloud</returns> public List <ForecastCard> GetDataList() { // get logged user emai string user_email = AuthHelper.GetInstance(Activity).CurrentUserEmail; // get list of models to display in recycler List <ForecastCard> mResponse = TidalioApi.GetInstance().FetchForecasts(user_email); return(mResponse); }
/// <summary> /// Button related to adding/saving the new location /// </summary> /// <param name="sender">Clicked button</param> /// <param name="e">Event arguments</param> private void AddLocationBtn_Click(object sender, EventArgs e) { string dataToAdd = autoComplete.Text; if (dataToAdd != string.Empty && dataToAdd != null) { Location loc = new Location(dataToAdd); adapter.AddRow(loc); TidalioApi.GetInstance() .PostLocationAsync(AuthHelper.GetInstance(Activity).CurrentUserEmail, loc); autoComplete.Text = string.Empty; } }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.forecastCard, parent, false); MyViewholder holder = new MyViewholder(v); holder.checkboxSaved.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => { // remove saved forecast card from web API and recyclerView if (!e.IsChecked) { string user_email = AuthHelper.GetInstance(context).CurrentUserEmail; TidalioApi.GetInstance().DeleteCardAsync(user_email, displayData[holder.LayoutPosition]); // On Checkbox uncheck displayData.RemoveAt(holder.LayoutPosition); NotifyItemRemoved(holder.LayoutPosition); } }; return(holder); }
public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { View v = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.savedLocationRow, parent, false); MyViewholder holder = new MyViewholder(v); holder.deleteButton.Click += (object sender, EventArgs e) => { TidalioApi.GetInstance().DeleteLocationAsync(AuthHelper.GetInstance(activity).CurrentUserEmail, displayData[holder.LayoutPosition]); displayData.RemoveAt(holder.LayoutPosition); NotifyItemRemoved(holder.LayoutPosition); }; holder.root.Click += (object sender, EventArgs e) => { if (activity is Dashboard) { Dashboard d = (Dashboard)activity; d.SearchLocation(displayData[holder.LayoutPosition]); } }; return(holder); }