/// <summary> /// this function prepares the selected task for editing /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditBtn_Tapped(object sender, TappedRoutedEventArgs e) { Button btn = (Button)sender; int id = (int)btn.Tag; placeholder = tList.Where(x => x.id == id).First(); FinalEdit.Visibility = Windows.UI.Xaml.Visibility.Visible; TaskBtn.Visibility = Windows.UI.Xaml.Visibility.Collapsed; NewDate.Date = placeholder.dateTime.Date; NewTime.Time = placeholder.dateTime.TimeOfDay; NewProject.Text = placeholder.project; NewDescription.Text = placeholder.description; }
private Task prepareTask(Task task) { task.description = NewDescription.Text; task.project = NewProject.Text; string dateTime = NewDate.Date.ToString("yyyy-MM-dd"); string time = NewTime.Time.ToString(); task.duedate = dateTime + "T" + time; Logger.log(dateTime + "T" + time); return task; }
private void TaskBtn_Tapped(object sender, TappedRoutedEventArgs e) { Task task = new Task(); task.completed = false; if(!NewDescription.Equals("") && !NewProject.Equals("")){ task = prepareTask(task); api.Post(task); } }
/// <summary> /// here we send the edited task to the server /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FinalEdit_Tapped(object sender, TappedRoutedEventArgs e) { placeholder = prepareTask(placeholder); api.Put(placeholder); NewProject.Text = ""; NewDescription.Text = ""; FinalEdit.Visibility = Windows.UI.Xaml.Visibility.Collapsed; TaskBtn.Visibility = Windows.UI.Xaml.Visibility.Visible; }