public Task ShowDialog(ListsModel _item, string _description) { var tcs = new TaskCompletionSource <bool>(); var builder = new AlertDialog.Builder(Forms.Context); var inflater = Forms.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; var dialogView = inflater.Inflate(Resource.Layout.DroidContentDialog, null); AlertDialog dialog = null; builder.SetView(dialogView); builder.SetTitle(_description); builder.SetCancelable(true); EditText txtNewName = ((EditText)dialogView.FindViewById(Resource.Id.newName)); txtNewName.KeyPress += (sender, e) => { if (e.KeyCode == Keycode.Enter) { if (txtNewName.Text.Trim().Length > 0) { _item.Name = txtNewName.Text; } dialog.Dismiss(); } }; // Add change button builder.SetPositiveButton(Android.Resource.String.Ok, (sender, e) => { if (txtNewName.Text.Trim().Length > 0) { _item.Name = txtNewName.Text; } tcs.SetResult(true); }); // Add cancel button builder.SetNegativeButton(Android.Resource.String.Cancel, (sender, e) => { tcs.SetResult(false); }); dialog = builder.Create(); dialog.DismissEvent += (sender, e) => { //just in case the user pressed the back button or press outside dialog tcs.TrySetResult(false); }; dialog.Show(); return(tcs.Task); }
public async Task ShowDialog(ListsModel _item, string _description) { UWPContentDialog contentDialog = new UWPContentDialog(_description); await contentDialog.ShowAsync(); if (UWPContentDialog.CloseResult.OK == contentDialog.dialogResult) { _item.Name = contentDialog.newName; } }
public ActionResult Edit(ListsModel listsModel) { var list = ListDataMapper.GetListDataMapper().GetById(listsModel.Id); if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(list.Board.Id)) { return(RedirectToAction("Index", "Boards")); } list.Name = listsModel.Name; return(RedirectToAction("GetLists", "Boards", new { id = list.Board.Id })); }
public ActionResult RemoveList(ListsModel listsModel) { var list = ListDataMapper.GetListDataMapper().GetById(listsModel.Id); int boardId = list.Board.Id; if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(boardId)) { return(RedirectToAction("Index", "Boards")); } ListDataMapper.GetListDataMapper().Remove(list); return(RedirectToAction("GetLists", "Boards", new { id = boardId })); }
public Task ShowDialog(ListsModel _item, string _description) { var tcs = new TaskCompletionSource <bool>(); try { UIAlertController alert = UIAlertController.Create("", _description, UIAlertControllerStyle.Alert); UITextField field = null; // Add and configure text field alert.AddTextField((textField) => { // Save the field field = textField; // Initialize field field.Placeholder = "Add new name"; field.AutocorrectionType = UITextAutocorrectionType.No; field.KeyboardType = UIKeyboardType.Default; field.ReturnKeyType = UIReturnKeyType.Done; field.ClearButtonMode = UITextFieldViewMode.WhileEditing; }); // Add cancel button alert.AddAction(UIAlertAction.Create("CANCEL", UIAlertActionStyle.Cancel, (actionCancel) => { tcs.SetResult(false); })); // Add ok button alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, (actionOK) => { if (field.Text.Trim().Length > 0) { _item.Name = field.Text.Trim(); } tcs.SetResult(true); })); // Display the alert UIWindow window = UIApplication.SharedApplication.KeyWindow; UIViewController controller = window.RootViewController; controller.PresentViewController(alert, true, null); } catch { tcs.TrySetResult(false); } return(tcs.Task); }
public ActionResult CreateList(ListsModel listsModel, int id) { var board = BoardDataMapper.GetBoardDataMapper().GetById(id); if (!AccountDataMapper.GetAccountDataMapper().GetById(User.Identity.Name).CanWriteBoard(board.Id)) { return(RedirectToAction("Index")); } listsModel.Board = board; var ldm = ListDataMapper.GetListDataMapper(); ldm.Add(listsModel); return(Redirect(String.Format("~/Boards/GetLists/{0}", id))); }
// PUT: api/Lists/5 public int Put(int id, [FromBody] ListsModel list) { var result = ListsRepository.Get(id); if (result.Item1 != null) { var resultId = ListsRepository.NewList(list.Title); return(resultId); } else { ListsRepository.UpdateList(id, list.Title); } return(0); }
public ListsModel GetLists() { SqlDataAccess sql = new SqlDataAccess(); var categoryList = sql.LoadData <CategoryModel, dynamic>("dbo.spCategory_GetAll", new { }, "BRData"); var frequencyList = sql.LoadData <FrequencyModel, dynamic>("dbo.spFrequency_GetAll", new { }, "BRData"); var priorityList = sql.LoadData <PriorityModel, dynamic>("dbo.spPriority_GetAll", new { }, "BRData"); var projectList = sql.LoadData <ProjectModel, dynamic>("dbo.spProject_GetAll", new { }, "BRData"); ListsModel output = new ListsModel { CategoryList = categoryList, FrequencyList = frequencyList, PriorityList = priorityList, ProjectList = projectList }; return(output); }
public void Update(ListsModel model) { ListID = model.ListID; Name = model.Name; CreatedDate = model.CreatedDate; }
public List(ListsModel model) { this.Update(model); CreatedDate = DateTime.Now; }
public IEnumerable <CardsModel> GetAllByList(ListsModel list) { return(_cards.FindAll(card => card.List != null && list.Id == card.List.Id).OrderBy(card => card.Idx)); }
public Lists() { InitializeComponent(); BindingContext = new ListsModel(); }
public void Update(ListsModel model) { Name = model.Name; }
// POST: api/Lists public int Post([FromBody] ListsModel list) { var id = ListsRepository.NewList(list.Title); return(id); }