private void btn_1_Clicked(object sender, EventArgs e) { if (TeacherPage.lastClicked != null) { TeacherPage.list.Remove(TeacherPage.lastClicked); TeacherPage.lastClicked = null; TeacherPage.tp.DisableButton(); Navigation.PopPopupAsync(); TeacherPage.RefreshData(); TeacherPage.tp.RefreshSch(); } }
private void Button_Clicked(object sender, EventArgs e) { if (item == null && (iday.SelectedIndex == 0 || iclass.SelectedIndex == 0 || iroom.SelectedIndex == 0)) { new Popup(new ErrorMessage("Fyll i alla fälten."), TeacherPage.tp).Show(); return; } if (item == null) { for (int x = 0; x < TeacherPage.list.Count; x++) { var _a = TeacherPage.list[x]; if (_a.LecDay == iday.SelectedItem.ToString() && _a.LecTime == App.GetTime(itime.Time, false)) { new Popup(new ErrorMessage("Det finns redan en lektion med samma tid!"), TeacherPage.tp).Show(); return; } } } ListItem newItem = new ListItem { LecDay = iday.SelectedItem.ToString(), LecTime = App.GetTime(itime.Time, false), ItemColor = item != null?item.ItemColor:App.UNCLICKED, Class = iclass.SelectedItem.ToString(), Room = iroom.SelectedItem.ToString() }; if (item != null) { var _index = _Get(item); TeacherPage.list.RemoveAt(_index); TeacherPage.list.Insert(_index, newItem); TeacherPage.lastClicked = newItem; } else { TeacherPage.list.Add(newItem); } Navigation.PopPopupAsync(); TeacherPage.RefreshData(); TeacherPage.tp.RefreshSch(); }