private void CheckFree() { string URL = "http://13.65.148.113/api/Orders/Empty"; using (var webClient = new System.Net.WebClient()) { var json = webClient.DownloadString(URL); List <Order> orders = JsonConvert.DeserializeObject <List <Order> >(json); if (orders != null) { OrderListAdapter listAdapter = new OrderListAdapter(this, orders); if (listAdapter.Count > 4) { // Instantiate the builder and set notification elements: Notification.Builder builder = new Notification.Builder(Activity) .SetContentTitle("Смайлик Курьер") .SetContentText("У нас есть для тебя работа!") .SetSmallIcon(Android.Resource.Drawable.SymDefAppIcon); // Build the notification: Notification notification = builder.Build(); // Get the notification manager: NotificationManager notificationManager = Activity.GetSystemService(Context.NotificationService) as NotificationManager; // Publish the notification: const int notificationId = 0; notificationManager.Notify(notificationId, notification); } } } }
private void LoadData(View view) { string URL = "http://13.65.148.113/api/Orders/Active/" + Arguments.GetString("login"); using (var webClient = new System.Net.WebClient()) { var json = webClient.DownloadString(URL); List <Order> orders = JsonConvert.DeserializeObject <List <Order> >(json); if (orders != null) { OrderListAdapter listAdapter = new OrderListAdapter(this, orders); var listView = view.FindViewById <ListView>(Resource.Id.listView1); Activity.RunOnUiThread(() => listView.Adapter = listAdapter); } } }