private void RequestIconList() { var loading = Acr.UserDialogs.UserDialogs.Instance.Loading("Getting icon list..."); string hwid = Android.OS.Build.Serial; var SharedSettings = new Dictionary <String, String>(); var prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); String gcmID = prefs.GetString("GCMID", ""); try { var client = new RestClient(Shared.SERVERURL); var request = new RestRequest("resource/{id}", Method.POST); var parameters = new Dictionary <string, string>(); parameters.Add(Shared.ParamType.REQUEST_CODE, Shared.RequestCode.GET_ICON_LIST.ToString()); //parameters.Add(Shared.ParamType.WAVIO_ID, micId); parameters.Add(Shared.ParamType.GCM_ID, gcmID); parameters.Add(Shared.ParamType.HWID, hwid); string requestJson = JsonConvert.SerializeObject(parameters); request.AddParameter(Shared.ParamType.REQUEST, requestJson); Console.WriteLine("Waiting for response"); client.ExecuteAsync(request, response => { ServerResponse serverResponse = JsonConvert.DeserializeObject <ServerResponse>(response.Content); if (serverResponse == null) { Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); return; } if (serverResponse.error == Shared.ServerResponsecode.OK) { icons = JsonConvert.DeserializeObject <List <Icon> >(serverResponse.data); adapter.SetItems(icons); parent.RunOnUiThread(() => { adapter.NotifyDataSetChanged(); }); loading.Hide(); } else if (serverResponse.error == Shared.ServerResponsecode.DATABASE_ERROR) { Acr.UserDialogs.UserDialogs.Instance.ShowError("Server error!"); } else { if (serverResponse.request != Shared.RequestCode.GET_ICON_LIST) { Acr.UserDialogs.UserDialogs.Instance.ShowError("Request type mismatch!"); return; } Acr.UserDialogs.UserDialogs.Instance.ShowError("Unknown error!"); } Acr.UserDialogs.UserDialogs.Instance.HideLoading(); return; }); } catch (WebException ex) { string _exception = ex.ToString(); Acr.UserDialogs.UserDialogs.Instance.ShowError("Network error!"); Console.WriteLine("--->" + _exception); } }
private void SearchChanged(object sender, TextChangedEventArgs e) { _iconSource.SetSearch(e.Text.ToString()); _iconAdapter.NotifyDataSetChanged(); }