public TodoDetail(TodoItem todoItem) { BindingContext = todoItem; var titleLabel = new Label () { FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), Text = todoItem.Title }; var descriptionLabel = new Label{ FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), Text = todoItem.Description }; Content = new StackLayout { Children = { titleLabel, descriptionLabel }, }; Padding = new Thickness (10, Device.OnPlatform (20, 0, 0)); ToolbarItems.Add (new ToolbarItem { Text = todoItem.IsCompleted ? "Gjenåpne" : "Fullfør", Order = ToolbarItemOrder.Primary, Command = new Command(Complete) }); Title = todoItem.Title; }
async Task AddTodoPopup(){ var status = await UserDialogs.Instance.PromptAsync(new PromptConfig { Title = "Legg til todo", Text = "", IsCancellable = true, OkText = "Lagre" }); var todoItem = new TodoItem(); //todoItem. = DateTime.UtcNow; todoItem.Title = status.Text; _dataService.Create (todoItem); var todoItems = _dataService.GetAll (); _listView.ItemsSource = todoItems.ToList (); }
public int Update(TodoItem todoItem) { _todoItems [todoItem.Id] = todoItem; return todoItem.Id; }
public int Create(TodoItem todoItem) { _todoItems.Add (_idIterator, todoItem); _idIterator++; return _idIterator; }