internal void listView_ItemClicked(SelectedItemChangedEventArgs list) { //item selected event //dokununca duyuruyu yok etme if (list.SelectedItem == null || list == null) { return; } var data = (Announcements)list.SelectedItem; sqliteManager.Delete(data.key); if (SaveUserData.userBadge != 0) { SaveUserData.userBadge -= 1; } //page notifaction count düşürmek için SaveUserBadge(); if (data.type == null) { page.Navigation.PushAsync(new ReadPage(), true); MessagingCenter.Send <NotifyViewModel, Announcements>(this, "dataAnnouncements", data); } else { var section = (AnnCategory)Convert.ToInt32(data.type); switch (section) { case AnnCategory.activities: page.Navigation.PushAsync(new ReadPage(), true); MessagingCenter.Send <NotifyViewModel, Announcements>(this, "dataActivity_announ", data); break; case AnnCategory.survey: page.Navigation.PushModalAsync(new NavigationPage(new SurveyPage()), true); MessagingCenter.Send <NotifyViewModel, string>(this, "keySurveyAnnc", data.key); break; default: break; } } }
private void Edit(AdapterView.ItemClickEventArgs e) { DeviceInfo device = data[e.Position]; AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); View view = View.Inflate(this, Resource.Layout.Add, null); InitViewControls(view); InitViewControlsContents(device); alertDialog.SetView(view) .SetPositiveButton(GetString(Resource.String.add_device_save), (_s, _e) => { if (!TestDataFormat()) { Toast.MakeText(this, GetString(Resource.String.add_device_error), ToastLength.Long).Show(); return; } device.Name = DeviceName.Text; device.MacAddress = $"{DeviceMac1.Text}-{DeviceMac2.Text}-{DeviceMac3.Text}-{DeviceMac4.Text}-{DeviceMac5.Text}-{DeviceMac6.Text}"; device.IpAddress = $"{DeviceIp1.Text}.{DeviceIp2.Text}.{DeviceIp3.Text}.{DeviceIp4.Text}"; device.BroadcastAddress = $"{DeviceBroadcast1.Text}.{DeviceBroadcast2.Text}.{DeviceBroadcast3.Text}.{DeviceBroadcast4.Text}"; device.Port = Convert.ToByte(DevicePort.Text); device.SendingCount = Convert.ToByte(SendingCount.Text); device.Description = DeviceDesc.Text; device.IsShortcut = Shortcut.Checked; sqlite.Update(device); data = sqlite.QueryAll(); adapter = new DeviceListAdapter(this, Resource.Layout.device_list_item, data); DeviceList.Adapter = adapter; SetShortcut(); Toast.MakeText(this, GetString(Resource.String.add_device_save_success), ToastLength.Long).Show(); }) .SetNegativeButton(GetString(Resource.String.add_device_cancel), (_s, _e) => { (_s as AlertDialog).Dismiss(); }) .SetNeutralButton(Resource.String.add_device_delete, (_s, _e) => { sqlite.Delete(device); data = sqlite.QueryAll(); adapter = new DeviceListAdapter(this, Resource.Layout.device_list_item, data); DeviceList.Adapter = adapter; if (data.Count != 0) { DeviceList.Visibility = ViewStates.Visible; Tips.Visibility = ViewStates.Gone; } Toast.MakeText(this, GetString(Resource.String.add_device_delete_success), ToastLength.Long).Show(); }) .Create(); AlertDialog show = alertDialog.Show(); }